diff --git a/device/cameo/x86_64-cameo_esc600_128q-r0/default_sku b/device/cameo/x86_64-cameo_esc600_128q-r0/default_sku new file mode 100644 index 0000000000..bbf6939681 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc600_128q-r0/default_sku @@ -0,0 +1 @@ +esc600-128q t1 diff --git a/device/cameo/x86_64-cameo_esc600_128q-r0/esc600-128q/buffers.json.j2 b/device/cameo/x86_64-cameo_esc600_128q-r0/esc600-128q/buffers.json.j2 new file mode 100644 index 0000000000..93dac6b199 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc600_128q-r0/esc600-128q/buffers.json.j2 @@ -0,0 +1,137 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '40m' %} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) %} + {%- set cable_len = [] %} + {%- for local_port in DEVICE_NEIGHBOR %} + {%- if local_port == port_name %} + {%- if DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor_role = neighbor.type %} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role %} + {%- set roles1 = roles1 | lower %} + {%- set roles2 = roles2 | lower %} + {%- if roles1 in ports2cable %} + {%- if cable_len.append(ports2cable[roles1]) %}{% endif %} + {%- elif roles2 in ports2cable %} + {%- if cable_len.append(ports2cable[roles2]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else %} + {%- if switch_role.lower() == 'torrouter' %} + {%- for local_port in VLAN_MEMBER %} + {%- if local_port[1] == port_name %} + {%- set roles3 = switch_role + '_' + 'server' %} + {%- set roles3 = roles3 | lower %} + {%- if roles3 in ports2cable %} + {%- if cable_len.append(ports2cable[roles3]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- endif %} +{%- endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "47218432", + "type": "ingress", + "mode": "dynamic", + "xoff": "17708800" + }, + "lossy_pool": { + "size": "18874368", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xoff":"38816", + "size":"1518", + "dynamic_th":"1", + "xon_offset":"13440" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"9497600" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"0", + "static_th":"9497600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"1518", + "dynamic_th":"2" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/cameo/x86_64-cameo_esc600_128q-r0/esc600-128q/buffers_defaults_def_lossy.j2 b/device/cameo/x86_64-cameo_esc600_128q-r0/esc600-128q/buffers_defaults_def_lossy.j2 new file mode 100644 index 0000000000..1a31812c26 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc600_128q-r0/esc600-128q/buffers_defaults_def_lossy.j2 @@ -0,0 +1,38 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "BUFFER_POOL": { + "lossy_pool": { + "size": "56985600", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"0", + "static_th":"9497600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"1518", + "dynamic_th":"2" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-7": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|0-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/cameo/x86_64-cameo_esc600_128q-r0/esc600-128q/buffers_defaults_t1.j2 b/device/cameo/x86_64-cameo_esc600_128q-r0/esc600-128q/buffers_defaults_t1.j2 new file mode 100644 index 0000000000..93dac6b199 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc600_128q-r0/esc600-128q/buffers_defaults_t1.j2 @@ -0,0 +1,137 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '40m' %} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) %} + {%- set cable_len = [] %} + {%- for local_port in DEVICE_NEIGHBOR %} + {%- if local_port == port_name %} + {%- if DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor_role = neighbor.type %} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role %} + {%- set roles1 = roles1 | lower %} + {%- set roles2 = roles2 | lower %} + {%- if roles1 in ports2cable %} + {%- if cable_len.append(ports2cable[roles1]) %}{% endif %} + {%- elif roles2 in ports2cable %} + {%- if cable_len.append(ports2cable[roles2]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else %} + {%- if switch_role.lower() == 'torrouter' %} + {%- for local_port in VLAN_MEMBER %} + {%- if local_port[1] == port_name %} + {%- set roles3 = switch_role + '_' + 'server' %} + {%- set roles3 = roles3 | lower %} + {%- if roles3 in ports2cable %} + {%- if cable_len.append(ports2cable[roles3]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- endif %} +{%- endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "47218432", + "type": "ingress", + "mode": "dynamic", + "xoff": "17708800" + }, + "lossy_pool": { + "size": "18874368", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xoff":"38816", + "size":"1518", + "dynamic_th":"1", + "xon_offset":"13440" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"9497600" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"0", + "static_th":"9497600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"1518", + "dynamic_th":"2" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/cameo/x86_64-cameo_esc600_128q-r0/esc600-128q/config_128x100G_Cameo-esc600-128q.yaml b/device/cameo/x86_64-cameo_esc600_128q-r0/esc600-128q/config_128x100G_Cameo-esc600-128q.yaml new file mode 100644 index 0000000000..a887e1c982 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc600_128q-r0/esc600-128q/config_128x100G_Cameo-esc600-128q.yaml @@ -0,0 +1,1248 @@ +ifcs: + options: + log_level: "info" +nodes: +- node_id: "0" + options: + sku: "configs/sku/innovium.77700_B" + netdev: + - auto_create: "no" + multi_interface: "yes" + buffer_management_mode: "api_driven" + max_lossless_tc: "2" + wred_cr_ip_proto_list: "17" + ilpm_enable: "1" + forward_profile: "IFCS_FORWARD_PROFILE_ID_PROFILE_E" + mac_clk: "1340" + sys_clk: "1720" + ifc_clk: "1200" + txring: + - txring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "3" + desc_count: "1024" + prio: "1" + netdev: "true" + rxring: + - rxring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39" + - rxring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40" + - rxring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "2, 5, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35, 38, 41, 47" + - rxring_id: "3" + desc_count: "1024" + prio: "1" + queues: "42, 43, 44, 45, 46" + devports: + - id: "0" + sysport: "1000" + type: "cpu" + - fec: "KPFEC" + id: "57" + lanes: "0:2" + serdes_group: "7" + speed: "100G" + sysport: "57" + type: "eth" + - fec: "KPFEC" + id: "59" + lanes: "2:2" + serdes_group: "7" + speed: "100G" + sysport: "59" + type: "eth" + - fec: "KPFEC" + id: "61" + lanes: "4:2" + serdes_group: "7" + speed: "100G" + sysport: "61" + type: "eth" + - fec: "KPFEC" + id: "63" + lanes: "6:2" + serdes_group: "7" + speed: "100G" + sysport: "63" + type: "eth" + - fec: "KPFEC" + id: "49" + lanes: "0:2" + serdes_group: "6" + speed: "100G" + sysport: "49" + type: "eth" + - fec: "KPFEC" + id: "51" + lanes: "2:2" + serdes_group: "6" + speed: "100G" + sysport: "51" + type: "eth" + - fec: "KPFEC" + id: "53" + lanes: "4:2" + serdes_group: "6" + speed: "100G" + sysport: "53" + type: "eth" + - fec: "KPFEC" + id: "55" + lanes: "6:2" + serdes_group: "6" + speed: "100G" + sysport: "55" + type: "eth" + - fec: "KPFEC" + id: "41" + lanes: "0:2" + serdes_group: "5" + speed: "100G" + sysport: "41" + type: "eth" + - fec: "KPFEC" + id: "43" + lanes: "2:2" + serdes_group: "5" + speed: "100G" + sysport: "43" + type: "eth" + - fec: "KPFEC" + id: "45" + lanes: "4:2" + serdes_group: "5" + speed: "100G" + sysport: "45" + type: "eth" + - fec: "KPFEC" + id: "47" + lanes: "6:2" + serdes_group: "5" + speed: "100G" + sysport: "47" + type: "eth" + - fec: "KPFEC" + id: "33" + lanes: "0:2" + serdes_group: "4" + speed: "100G" + sysport: "33" + type: "eth" + - fec: "KPFEC" + id: "35" + lanes: "2:2" + serdes_group: "4" + speed: "100G" + sysport: "35" + type: "eth" + - fec: "KPFEC" + id: "37" + lanes: "4:2" + serdes_group: "4" + speed: "100G" + sysport: "37" + type: "eth" + - fec: "KPFEC" + id: "39" + lanes: "6:2" + serdes_group: "4" + speed: "100G" + sysport: "39" + type: "eth" + - fec: "KPFEC" + id: "25" + lanes: "0:2" + serdes_group: "3" + speed: "100G" + sysport: "25" + type: "eth" + - fec: "KPFEC" + id: "27" + lanes: "2:2" + serdes_group: "3" + speed: "100G" + sysport: "27" + type: "eth" + - fec: "KPFEC" + id: "29" + lanes: "4:2" + serdes_group: "3" + speed: "100G" + sysport: "29" + type: "eth" + - fec: "KPFEC" + id: "31" + lanes: "6:2" + serdes_group: "3" + speed: "100G" + sysport: "31" + type: "eth" + - fec: "KPFEC" + id: "17" + lanes: "0:2" + serdes_group: "2" + speed: "100G" + sysport: "17" + type: "eth" + - fec: "KPFEC" + id: "19" + lanes: "2:2" + serdes_group: "2" + speed: "100G" + sysport: "19" + type: "eth" + - fec: "KPFEC" + id: "21" + lanes: "4:2" + serdes_group: "2" + speed: "100G" + sysport: "21" + type: "eth" + - fec: "KPFEC" + id: "23" + lanes: "6:2" + serdes_group: "2" + speed: "100G" + sysport: "23" + type: "eth" + - fec: "KPFEC" + id: "9" + lanes: "0:2" + serdes_group: "1" + speed: "100G" + sysport: "9" + type: "eth" + - fec: "KPFEC" + id: "11" + lanes: "2:2" + serdes_group: "1" + speed: "100G" + sysport: "11" + type: "eth" + - fec: "KPFEC" + id: "13" + lanes: "4:2" + serdes_group: "1" + speed: "100G" + sysport: "13" + type: "eth" + - fec: "KPFEC" + id: "15" + lanes: "6:2" + serdes_group: "1" + speed: "100G" + sysport: "15" + type: "eth" + - fec: "KPFEC" + id: "1" + lanes: "0:2" + serdes_group: "0" + speed: "100G" + sysport: "1" + type: "eth" + - fec: "KPFEC" + id: "3" + lanes: "2:2" + serdes_group: "0" + speed: "100G" + sysport: "3" + type: "eth" + - fec: "KPFEC" + id: "5" + lanes: "4:2" + serdes_group: "0" + speed: "100G" + sysport: "5" + type: "eth" + - fec: "KPFEC" + id: "7" + lanes: "6:2" + serdes_group: "0" + speed: "100G" + sysport: "7" + type: "eth" + - fec: "KPFEC" + id: "249" + lanes: "0:2" + serdes_group: "31" + speed: "100G" + sysport: "249" + type: "eth" + - fec: "KPFEC" + id: "251" + lanes: "2:2" + serdes_group: "31" + speed: "100G" + sysport: "251" + type: "eth" + - fec: "KPFEC" + id: "253" + lanes: "4:2" + serdes_group: "31" + speed: "100G" + sysport: "253" + type: "eth" + - fec: "KPFEC" + id: "255" + lanes: "6:2" + serdes_group: "31" + speed: "100G" + sysport: "255" + type: "eth" + - fec: "KPFEC" + id: "241" + lanes: "0:2" + serdes_group: "30" + speed: "100G" + sysport: "241" + type: "eth" + - fec: "KPFEC" + id: "243" + lanes: "2:2" + serdes_group: "30" + speed: "100G" + sysport: "243" + type: "eth" + - fec: "KPFEC" + id: "245" + lanes: "4:2" + serdes_group: "30" + speed: "100G" + sysport: "245" + type: "eth" + - fec: "KPFEC" + id: "247" + lanes: "6:2" + serdes_group: "30" + speed: "100G" + sysport: "247" + type: "eth" + - fec: "KPFEC" + id: "233" + lanes: "0:2" + serdes_group: "29" + speed: "100G" + sysport: "233" + type: "eth" + - fec: "KPFEC" + id: "235" + lanes: "2:2" + serdes_group: "29" + speed: "100G" + sysport: "235" + type: "eth" + - fec: "KPFEC" + id: "237" + lanes: "4:2" + serdes_group: "29" + speed: "100G" + sysport: "237" + type: "eth" + - fec: "KPFEC" + id: "239" + lanes: "6:2" + serdes_group: "29" + speed: "100G" + sysport: "239" + type: "eth" + - fec: "KPFEC" + id: "225" + lanes: "0:2" + serdes_group: "28" + speed: "100G" + sysport: "225" + type: "eth" + - fec: "KPFEC" + id: "227" + lanes: "2:2" + serdes_group: "28" + speed: "100G" + sysport: "227" + type: "eth" + - fec: "KPFEC" + id: "229" + lanes: "4:2" + serdes_group: "28" + speed: "100G" + sysport: "229" + type: "eth" + - fec: "KPFEC" + id: "231" + lanes: "6:2" + serdes_group: "28" + speed: "100G" + sysport: "231" + type: "eth" + - fec: "KPFEC" + id: "217" + lanes: "0:2" + serdes_group: "27" + speed: "100G" + sysport: "217" + type: "eth" + - fec: "KPFEC" + id: "219" + lanes: "2:2" + serdes_group: "27" + speed: "100G" + sysport: "219" + type: "eth" + - fec: "KPFEC" + id: "221" + lanes: "4:2" + serdes_group: "27" + speed: "100G" + sysport: "221" + type: "eth" + - fec: "KPFEC" + id: "223" + lanes: "6:2" + serdes_group: "27" + speed: "100G" + sysport: "223" + type: "eth" + - fec: "KPFEC" + id: "209" + lanes: "0:2" + serdes_group: "26" + speed: "100G" + sysport: "209" + type: "eth" + - fec: "KPFEC" + id: "211" + lanes: "2:2" + serdes_group: "26" + speed: "100G" + sysport: "211" + type: "eth" + - fec: "KPFEC" + id: "213" + lanes: "4:2" + serdes_group: "26" + speed: "100G" + sysport: "213" + type: "eth" + - fec: "KPFEC" + id: "215" + lanes: "6:2" + serdes_group: "26" + speed: "100G" + sysport: "215" + type: "eth" + - fec: "KPFEC" + id: "201" + lanes: "0:2" + serdes_group: "25" + speed: "100G" + sysport: "201" + type: "eth" + - fec: "KPFEC" + id: "203" + lanes: "2:2" + serdes_group: "25" + speed: "100G" + sysport: "203" + type: "eth" + - fec: "KPFEC" + id: "205" + lanes: "4:2" + serdes_group: "25" + speed: "100G" + sysport: "205" + type: "eth" + - fec: "KPFEC" + id: "207" + lanes: "6:2" + serdes_group: "25" + speed: "100G" + sysport: "207" + type: "eth" + - fec: "KPFEC" + id: "193" + lanes: "0:2" + serdes_group: "24" + speed: "100G" + sysport: "193" + type: "eth" + - fec: "KPFEC" + id: "195" + lanes: "2:2" + serdes_group: "24" + speed: "100G" + sysport: "195" + type: "eth" + - fec: "KPFEC" + id: "197" + lanes: "4:2" + serdes_group: "24" + speed: "100G" + sysport: "197" + type: "eth" + - fec: "KPFEC" + id: "199" + lanes: "6:2" + serdes_group: "24" + speed: "100G" + sysport: "199" + type: "eth" + - fec: "KPFEC" + id: "185" + lanes: "0:2" + serdes_group: "23" + speed: "100G" + sysport: "185" + type: "eth" + - fec: "KPFEC" + id: "187" + lanes: "2:2" + serdes_group: "23" + speed: "100G" + sysport: "187" + type: "eth" + - fec: "KPFEC" + id: "189" + lanes: "4:2" + serdes_group: "23" + speed: "100G" + sysport: "189" + type: "eth" + - fec: "KPFEC" + id: "191" + lanes: "6:2" + serdes_group: "23" + speed: "100G" + sysport: "191" + type: "eth" + - fec: "KPFEC" + id: "177" + lanes: "0:2" + serdes_group: "22" + speed: "100G" + sysport: "177" + type: "eth" + - fec: "KPFEC" + id: "179" + lanes: "2:2" + serdes_group: "22" + speed: "100G" + sysport: "179" + type: "eth" + - fec: "KPFEC" + id: "181" + lanes: "4:2" + serdes_group: "22" + speed: "100G" + sysport: "181" + type: "eth" + - fec: "KPFEC" + id: "183" + lanes: "6:2" + serdes_group: "22" + speed: "100G" + sysport: "183" + type: "eth" + - fec: "KPFEC" + id: "169" + lanes: "0:2" + serdes_group: "21" + speed: "100G" + sysport: "169" + type: "eth" + - fec: "KPFEC" + id: "171" + lanes: "2:2" + serdes_group: "21" + speed: "100G" + sysport: "171" + type: "eth" + - fec: "KPFEC" + id: "173" + lanes: "4:2" + serdes_group: "21" + speed: "100G" + sysport: "173" + type: "eth" + - fec: "KPFEC" + id: "175" + lanes: "6:2" + serdes_group: "21" + speed: "100G" + sysport: "175" + type: "eth" + - fec: "KPFEC" + id: "161" + lanes: "0:2" + serdes_group: "20" + speed: "100G" + sysport: "161" + type: "eth" + - fec: "KPFEC" + id: "163" + lanes: "2:2" + serdes_group: "20" + speed: "100G" + sysport: "163" + type: "eth" + - fec: "KPFEC" + id: "165" + lanes: "4:2" + serdes_group: "20" + speed: "100G" + sysport: "165" + type: "eth" + - fec: "KPFEC" + id: "167" + lanes: "6:2" + serdes_group: "20" + speed: "100G" + sysport: "167" + type: "eth" + - fec: "KPFEC" + id: "153" + lanes: "0:2" + serdes_group: "19" + speed: "100G" + sysport: "153" + type: "eth" + - fec: "KPFEC" + id: "155" + lanes: "2:2" + serdes_group: "19" + speed: "100G" + sysport: "155" + type: "eth" + - fec: "KPFEC" + id: "157" + lanes: "4:2" + serdes_group: "19" + speed: "100G" + sysport: "157" + type: "eth" + - fec: "KPFEC" + id: "159" + lanes: "6:2" + serdes_group: "19" + speed: "100G" + sysport: "159" + type: "eth" + - fec: "KPFEC" + id: "145" + lanes: "0:2" + serdes_group: "18" + speed: "100G" + sysport: "145" + type: "eth" + - fec: "KPFEC" + id: "147" + lanes: "2:2" + serdes_group: "18" + speed: "100G" + sysport: "147" + type: "eth" + - fec: "KPFEC" + id: "149" + lanes: "4:2" + serdes_group: "18" + speed: "100G" + sysport: "149" + type: "eth" + - fec: "KPFEC" + id: "151" + lanes: "6:2" + serdes_group: "18" + speed: "100G" + sysport: "151" + type: "eth" + - fec: "KPFEC" + id: "137" + lanes: "0:2" + serdes_group: "17" + speed: "100G" + sysport: "137" + type: "eth" + - fec: "KPFEC" + id: "139" + lanes: "2:2" + serdes_group: "17" + speed: "100G" + sysport: "139" + type: "eth" + - fec: "KPFEC" + id: "141" + lanes: "4:2" + serdes_group: "17" + speed: "100G" + sysport: "141" + type: "eth" + - fec: "KPFEC" + id: "143" + lanes: "6:2" + serdes_group: "17" + speed: "100G" + sysport: "143" + type: "eth" + - fec: "KPFEC" + id: "129" + lanes: "0:2" + serdes_group: "16" + speed: "100G" + sysport: "129" + type: "eth" + - fec: "KPFEC" + id: "131" + lanes: "2:2" + serdes_group: "16" + speed: "100G" + sysport: "131" + type: "eth" + - fec: "KPFEC" + id: "133" + lanes: "4:2" + serdes_group: "16" + speed: "100G" + sysport: "133" + type: "eth" + - fec: "KPFEC" + id: "135" + lanes: "6:2" + serdes_group: "16" + speed: "100G" + sysport: "135" + type: "eth" + - fec: "KPFEC" + id: "121" + lanes: "0:2" + serdes_group: "15" + speed: "100G" + sysport: "121" + type: "eth" + - fec: "KPFEC" + id: "123" + lanes: "2:2" + serdes_group: "15" + speed: "100G" + sysport: "123" + type: "eth" + - fec: "KPFEC" + id: "125" + lanes: "4:2" + serdes_group: "15" + speed: "100G" + sysport: "125" + type: "eth" + - fec: "KPFEC" + id: "127" + lanes: "6:2" + serdes_group: "15" + speed: "100G" + sysport: "127" + type: "eth" + - fec: "KPFEC" + id: "113" + lanes: "0:2" + serdes_group: "14" + speed: "100G" + sysport: "113" + type: "eth" + - fec: "KPFEC" + id: "115" + lanes: "2:2" + serdes_group: "14" + speed: "100G" + sysport: "115" + type: "eth" + - fec: "KPFEC" + id: "117" + lanes: "4:2" + serdes_group: "14" + speed: "100G" + sysport: "117" + type: "eth" + - fec: "KPFEC" + id: "119" + lanes: "6:2" + serdes_group: "14" + speed: "100G" + sysport: "119" + type: "eth" + - fec: "KPFEC" + id: "105" + lanes: "0:2" + serdes_group: "13" + speed: "100G" + sysport: "105" + type: "eth" + - fec: "KPFEC" + id: "107" + lanes: "2:2" + serdes_group: "13" + speed: "100G" + sysport: "107" + type: "eth" + - fec: "KPFEC" + id: "109" + lanes: "4:2" + serdes_group: "13" + speed: "100G" + sysport: "109" + type: "eth" + - fec: "KPFEC" + id: "111" + lanes: "6:2" + serdes_group: "13" + speed: "100G" + sysport: "111" + type: "eth" + - fec: "KPFEC" + id: "97" + lanes: "0:2" + serdes_group: "12" + speed: "100G" + sysport: "97" + type: "eth" + - fec: "KPFEC" + id: "99" + lanes: "2:2" + serdes_group: "12" + speed: "100G" + sysport: "99" + type: "eth" + - fec: "KPFEC" + id: "101" + lanes: "4:2" + serdes_group: "12" + speed: "100G" + sysport: "101" + type: "eth" + - fec: "KPFEC" + id: "103" + lanes: "6:2" + serdes_group: "12" + speed: "100G" + sysport: "103" + type: "eth" + - fec: "KPFEC" + id: "89" + lanes: "0:2" + serdes_group: "11" + speed: "100G" + sysport: "89" + type: "eth" + - fec: "KPFEC" + id: "91" + lanes: "2:2" + serdes_group: "11" + speed: "100G" + sysport: "91" + type: "eth" + - fec: "KPFEC" + id: "93" + lanes: "4:2" + serdes_group: "11" + speed: "100G" + sysport: "93" + type: "eth" + - fec: "KPFEC" + id: "95" + lanes: "6:2" + serdes_group: "11" + speed: "100G" + sysport: "95" + type: "eth" + - fec: "KPFEC" + id: "81" + lanes: "0:2" + serdes_group: "10" + speed: "100G" + sysport: "81" + type: "eth" + - fec: "KPFEC" + id: "83" + lanes: "2:2" + serdes_group: "10" + speed: "100G" + sysport: "83" + type: "eth" + - fec: "KPFEC" + id: "85" + lanes: "4:2" + serdes_group: "10" + speed: "100G" + sysport: "85" + type: "eth" + - fec: "KPFEC" + id: "87" + lanes: "6:2" + serdes_group: "10" + speed: "100G" + sysport: "87" + type: "eth" + - fec: "KPFEC" + id: "73" + lanes: "0:2" + serdes_group: "9" + speed: "100G" + sysport: "73" + type: "eth" + - fec: "KPFEC" + id: "75" + lanes: "2:2" + serdes_group: "9" + speed: "100G" + sysport: "75" + type: "eth" + - fec: "KPFEC" + id: "77" + lanes: "4:2" + serdes_group: "9" + speed: "100G" + sysport: "77" + type: "eth" + - fec: "KPFEC" + id: "79" + lanes: "6:2" + serdes_group: "9" + speed: "100G" + sysport: "79" + type: "eth" + - fec: "KPFEC" + id: "65" + lanes: "0:2" + serdes_group: "8" + speed: "100G" + sysport: "65" + type: "eth" + - fec: "KPFEC" + id: "67" + lanes: "2:2" + serdes_group: "8" + speed: "100G" + sysport: "67" + type: "eth" + - fec: "KPFEC" + id: "69" + lanes: "4:2" + serdes_group: "8" + speed: "100G" + sysport: "69" + type: "eth" + - fec: "KPFEC" + id: "71" + lanes: "6:2" + serdes_group: "8" + speed: "100G" + sysport: "71" + type: "eth" + isg: + - id: "0" + tx_polarity: "01110011" + rx_polarity: "01100111" + lane_swap: "71635420" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "8, 8, 8, 8, 8, 8, 8, 8" + - id: "1" + tx_polarity: "00111011" + rx_polarity: "01100111" + lane_swap: "71635420" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "8, 8, 8, 8, 8, 8, 8, 8" + - id: "2" + tx_polarity: "01100011" + rx_polarity: "10100111" + lane_swap: "71634520" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "8, 8, 8, 8, 8, 8, 8, 8" + - id: "3" + tx_polarity: "01111011" + rx_polarity: "00111000" + lane_swap: "73614520" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "8, 8, 8, 8, 8, 8, 8, 8" + - id: "4" + tx_polarity: "01100011" + rx_polarity: "01100000" + lane_swap: "71634520" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "8, 8, 8, 8, 8, 8, 8, 8" + - id: "5" + tx_polarity: "00101011" + rx_polarity: "01000111" + lane_swap: "71635420" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "8, 8, 8, 8, 8, 8, 8, 8" + - id: "6" + tx_polarity: "01110011" + rx_polarity: "10000001" + lane_swap: "71634520" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "8, 8, 8, 8, 8, 8, 8, 8" + - id: "7" + tx_polarity: "01101111" + rx_polarity: "00011100" + lane_swap: "71324065" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "8, 8, 8, 8, 8, 8, 8, 8" + - id: "8" + tx_polarity: "00000001" + rx_polarity: "11000001" + lane_swap: "71635420" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "8, 8, 8, 8, 8, 8, 8, 8" + - id: "9" + tx_polarity: "01001001" + rx_polarity: "01000101" + lane_swap: "71635420" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "8, 8, 8, 8, 8, 8, 8, 8" + - id: "10" + tx_polarity: "01000001" + rx_polarity: "10000001" + lane_swap: "71634520" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "8, 8, 8, 8, 8, 8, 8, 8" + - id: "11" + tx_polarity: "00001101" + rx_polarity: "01001101" + lane_swap: "03215467" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "8, 8, 8, 8, 8, 8, 8, 8" + - id: "12" + tx_polarity: "00000001" + rx_polarity: "00100001" + lane_swap: "71635420" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "8, 8, 8, 8, 8, 8, 8, 8" + - id: "13" + tx_polarity: "00000101" + rx_polarity: "00101011" + lane_swap: "71634520" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "8, 8, 8, 8, 8, 8, 8, 8" + - id: "14" + tx_polarity: "00000001" + rx_polarity: "10101001" + lane_swap: "71634520" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "8, 8, 8, 8, 8, 8, 8, 8" + - id: "15" + tx_polarity: "00001101" + rx_polarity: "00001100" + lane_swap: "01235467" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "8, 8, 8, 8, 8, 8, 8, 8" + - id: "16" + tx_polarity: "00000001" + rx_polarity: "10100011" + lane_swap: "71635420" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "8, 8, 8, 8, 8, 8, 8, 8" + - id: "17" + tx_polarity: "01000101" + rx_polarity: "00101011" + lane_swap: "71634520" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "8, 8, 8, 8, 8, 8, 8, 8" + - id: "18" + tx_polarity: "01000000" + rx_polarity: "10100011" + lane_swap: "71634520" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "8, 8, 8, 8, 8, 8, 8, 8" + - id: "19" + tx_polarity: "00110111" + rx_polarity: "01010110" + lane_swap: "01235467" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "8, 8, 8, 8, 8, 8, 8, 8" + - id: "20" + tx_polarity: "01100101" + rx_polarity: "01001011" + lane_swap: "71635420" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "6, 6, 6, 6, 6, 6, 6, 6" + - id: "21" + tx_polarity: "10111011" + rx_polarity: "10101110" + lane_swap: "71635420" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "6, 6, 6, 6, 6, 6, 6, 6" + - id: "22" + tx_polarity: "01110011" + rx_polarity: "01101011" + lane_swap: "71634520" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "6, 6, 6, 6, 6, 6, 6, 6" + - id: "23" + tx_polarity: "01110011" + rx_polarity: "01011000" + lane_swap: "01235467" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "6, 6, 6, 6, 6, 6, 6, 6" + - id: "24" + tx_polarity: "01110011" + rx_polarity: "11100111" + lane_swap: "71635420" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "6, 6, 6, 6, 6, 6, 6, 6" + - id: "25" + tx_polarity: "00101011" + rx_polarity: "01100111" + lane_swap: "71635420" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "6, 6, 6, 6, 6, 6, 6, 6" + - id: "26" + tx_polarity: "01110011" + rx_polarity: "10100111" + lane_swap: "71634520" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "6, 6, 6, 6, 6, 6, 6, 6" + - id: "27" + tx_polarity: "01000111" + rx_polarity: "00011101" + lane_swap: "01235467" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "6, 6, 6, 6, 6, 6, 6, 6" + - id: "28" + tx_polarity: "01100011" + rx_polarity: "11111101" + lane_swap: "71634520" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "8, 8, 8, 8, 8, 8, 8, 8" + - id: "29" + tx_polarity: "00111011" + rx_polarity: "01101110" + lane_swap: "71635420" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "8, 8, 8, 8, 8, 8, 8, 8" + - id: "30" + tx_polarity: "01110011" + rx_polarity: "00100010" + lane_swap: "71634520" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "8, 8, 8, 8, 8, 8, 8, 8" + - id: "31" + tx_polarity: "01010011" + rx_polarity: "00110111" + lane_swap: "71235460" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "8, 8, 8, 8, 8, 8, 8, 8" + - id: "32" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" diff --git a/device/cameo/x86_64-cameo_esc600_128q-r0/esc600-128q/innovium.77700_A b/device/cameo/x86_64-cameo_esc600_128q-r0/esc600-128q/innovium.77700_A new file mode 100644 index 0000000000..84aa419836 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc600_128q-r0/esc600-128q/innovium.77700_A @@ -0,0 +1,59 @@ +sku: innovium.77700_A + +device_id: 0x1b58 + +# Hardware constraint information +hardware: + num_ibs: 6 + + ports_per_ib: 32, 32, 32, 32, 20, 20 + recirc_port_num: 32, 32, 32, 32, 32, 32 + cpu_port_num: 33 + cpu_port_ib: 0 + mgmt_port_num: 33 + mgmt_port_ibs: 1,2 + + pics_per_ib: 6, 7, 6, 5, 5, 5 + pic_ports_per_pic: 8 + max_serdes_speed: 50 + + num_shared_pics: 2 + + isg [0-4]: + ib: 0 + pic_id: [0-4] + + isg [5-9]: + ib: 5 + pic_id: [0-4] + + isg [10-14]: + ib: 1 + pic_id: [0-4] + + isg [16-20]: + ib: 3 + pic_id: [0-4] + + isg [21-25]: + ib: 4 + pic_id: [0-4] + + isg [26-30]: + ib: 2 + pic_id: [0-4] + + isg 15: + mode: 8:0 + ib: 1 + pic_id: 5 + + isg 31: + mode: 8:0 + ib: 0 + pic_id: 5 + + isg 32: + mode: 1:1 + ib: 1, 2 + pic_id: 6 diff --git a/device/cameo/x86_64-cameo_esc600_128q-r0/esc600-128q/innovium.77700_B b/device/cameo/x86_64-cameo_esc600_128q-r0/esc600-128q/innovium.77700_B new file mode 100644 index 0000000000..27297b3139 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc600_128q-r0/esc600-128q/innovium.77700_B @@ -0,0 +1,59 @@ +sku: innovium.77700_B + +device_id: 0x1b58 + +# Hardware constraint information +hardware: + num_ibs: 6 + + ports_per_ib: 32, 32, 32, 32, 20, 20 + recirc_port_num: 32, 32, 32, 32, 32, 32 + cpu_port_num: 33 + cpu_port_ib: 0 + mgmt_port_num: 33 + mgmt_port_ibs: 1,2 + + pics_per_ib: 6, 7, 7, 6, 5, 5 + pic_ports_per_pic: 8 + max_serdes_speed: 50 + + num_shared_pics: 2 + + isg [0-4]: + ib: 0 + pic_id: [0-4] + + isg [5-9]: + ib: 5 + pic_id: [0-4] + + isg [10-14]: + ib: 1 + pic_id: [0-4] + + isg [16-20]: + ib: 3 + pic_id: [0-4] + + isg [21-25]: + ib: 4 + pic_id: [0-4] + + isg [26-30]: + ib: 2 + pic_id: [0-4] + + isg 15: + mode: 4:4 + ib: 1, 3 + pic_id: 5 + + isg 31: + mode: 4:4 + ib: 0, 2 + pic_id: 5 + + isg 32: + mode: 1:1 + ib: 1, 2 + pic_id: 6 diff --git a/device/cameo/x86_64-cameo_esc600_128q-r0/esc600-128q/ivm.sai.config.yaml b/device/cameo/x86_64-cameo_esc600_128q-r0/esc600-128q/ivm.sai.config.yaml new file mode 100644 index 0000000000..fe9d7013d8 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc600_128q-r0/esc600-128q/ivm.sai.config.yaml @@ -0,0 +1,9 @@ +IFCS_INIT_FILE : "/usr/share/sonic/hwsku/config_128x100G_Cameo-esc600-128q.yaml" +IFCS_SKU_FILE : "/usr/share/sonic/hwsku/innovium.77700_B" +IFCS_INNO_CLI_PORT : "9999" +IFCS_TARGET : "device" +INNOVIUM_DIR : "/innovium" +PYTHONPATH : "$INNOVIUM_DIR:$INNOVIUM_DIR/cmds:$INNOVIUM_DIR/scripts:$INNOVIUM_DIR/test/:$INNOVIUM_DIR/test/utils:$INNOVIUM_DIR/utils:$INNOVIUM_DIR/pyctypes" +IVM_SAI_DATAPATH_CONFIG_FILE: "/usr/share/sonic/hwsku/ivm.sai.datapath.config.yaml" +NRZ_PORTS_SIG_DETECT_MODE_TL7 : "1" +IVM_SAI_PARAM_A0008: "32" diff --git a/device/cameo/x86_64-cameo_esc600_128q-r0/esc600-128q/ivm.sai.datapath.config.yaml b/device/cameo/x86_64-cameo_esc600_128q-r0/esc600-128q/ivm.sai.datapath.config.yaml new file mode 100644 index 0000000000..891b0b3e28 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc600_128q-r0/esc600-128q/ivm.sai.datapath.config.yaml @@ -0,0 +1,9 @@ +ISAI_PARAM_P0_0_LS : "4608 4608 4608 4608 2880 2880" +ISAI_PARAM_P0_1_LS : "2226 1946 1946 1890 1218 1218" +ISAI_PARAM_P0_1_ALS : "434 154 154 98 98 98" +ISAI_PARAM_P1_0_LS : "1536 1536 1536 1536 960 960" +ISAI_PARAM_P1_0_LL : "3072 3072 3072 3072 1920 1920" +ISAI_PARAM_P1_1_LS : "1778 1498 1498 1442 938 938" +ISAI_PARAM_P1_1_LL : "2478 2478 2478 2478 2478 2478" +ISAI_PARAM_P1_1_ALS : "434 154 154 98 98 98" +ISAI_PARAM_P1_1_ALL : "126 126 126 126 126 126" diff --git a/device/cameo/x86_64-cameo_esc600_128q-r0/esc600-128q/pg_profile_lookup.ini b/device/cameo/x86_64-cameo_esc600_128q-r0/esc600-128q/pg_profile_lookup.ini new file mode 100644 index 0000000000..adcb52ab2a --- /dev/null +++ b/device/cameo/x86_64-cameo_esc600_128q-r0/esc600-128q/pg_profile_lookup.ini @@ -0,0 +1,18 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 25000 5m 1518 0 15680 1 13440 + 50000 5m 1518 0 21248 1 13440 + 100000 5m 1518 0 34624 1 13440 + 400000 5m 1518 0 117536 1 13440 + 25000 40m 1518 0 16928 1 13440 + 50000 40m 1518 0 23392 1 13440 + 100000 40m 1518 0 38816 1 13440 + 400000 40m 1518 0 135520 1 13440 + 25000 100m 1518 0 18848 1 13440 + 50000 100m 1518 0 27264 1 13440 + 100000 100m 1518 0 46496 1 13440 + 400000 100m 1518 0 166688 1 13440 + 25000 300m 1518 0 25184 1 13440 + 50000 300m 1518 0 40128 1 13440 + 100000 300m 1518 0 72384 1 13440 + 400000 300m 1518 0 268640 1 13440 diff --git a/device/cameo/x86_64-cameo_esc600_128q-r0/esc600-128q/port_config.ini b/device/cameo/x86_64-cameo_esc600_128q-r0/esc600-128q/port_config.ini new file mode 100644 index 0000000000..de81fe694b --- /dev/null +++ b/device/cameo/x86_64-cameo_esc600_128q-r0/esc600-128q/port_config.ini @@ -0,0 +1,129 @@ +# name lanes alias speed index mtu fec +Ethernet0 57,58 Eth1-1 100000 0 9126 rs +Ethernet2 59,60 Eth1-2 100000 1 9126 rs +Ethernet4 61,62 Eth1-3 100000 2 9126 rs +Ethernet6 63,64 Eth1-4 100000 3 9126 rs +Ethernet8 49,50 Eth1-5 100000 4 9126 rs +Ethernet10 51,52 Eth1-6 100000 5 9126 rs +Ethernet12 53,54 Eth1-7 100000 6 9126 rs +Ethernet14 55,56 Eth1-8 100000 7 9126 rs +Ethernet16 41,42 Eth1-9 100000 8 9126 rs +Ethernet18 43,44 Eth1-10 100000 9 9126 rs +Ethernet20 45,46 Eth1-11 100000 10 9126 rs +Ethernet22 47,48 Eth1-12 100000 11 9126 rs +Ethernet24 33,34 Eth1-13 100000 12 9126 rs +Ethernet26 35,36 Eth1-14 100000 13 9126 rs +Ethernet28 37,38 Eth1-15 100000 14 9126 rs +Ethernet30 39,40 Eth1-16 100000 15 9126 rs +Ethernet32 25,26 Eth2-1 100000 16 9126 rs +Ethernet34 27,28 Eth2-2 100000 17 9126 rs +Ethernet36 29,30 Eth2-3 100000 18 9126 rs +Ethernet38 31,32 Eth2-4 100000 19 9126 rs +Ethernet40 17,18 Eth2-5 100000 20 9126 rs +Ethernet42 19,20 Eth2-6 100000 21 9126 rs +Ethernet44 21,22 Eth2-7 100000 22 9126 rs +Ethernet46 23,24 Eth2-8 100000 23 9126 rs +Ethernet48 9,10 Eth2-9 100000 24 9126 rs +Ethernet50 11,12 Eth2-10 100000 25 9126 rs +Ethernet52 13,14 Eth2-11 100000 26 9126 rs +Ethernet54 15,16 Eth2-12 100000 27 9126 rs +Ethernet56 1,2 Eth2-13 100000 28 9126 rs +Ethernet58 3,4 Eth2-14 100000 29 9126 rs +Ethernet60 5,6 Eth2-15 100000 30 9126 rs +Ethernet62 7,8 Eth2-16 100000 31 9126 rs +Ethernet64 249,250 Eth3-1 100000 32 9126 rs +Ethernet66 251,252 Eth3-2 100000 33 9126 rs +Ethernet68 253,254 Eth3-3 100000 34 9126 rs +Ethernet70 255,256 Eth3-4 100000 35 9126 rs +Ethernet72 241,242 Eth3-5 100000 36 9126 rs +Ethernet74 243,244 Eth3-6 100000 37 9126 rs +Ethernet76 245,246 Eth3-7 100000 38 9126 rs +Ethernet78 247,248 Eth3-8 100000 39 9126 rs +Ethernet80 233,234 Eth3-9 100000 40 9126 rs +Ethernet82 235,236 Eth3-10 100000 41 9126 rs +Ethernet84 237,238 Eth3-11 100000 42 9126 rs +Ethernet86 239,240 Eth3-12 100000 43 9126 rs +Ethernet88 225,226 Eth3-13 100000 44 9126 rs +Ethernet90 227,228 Eth3-14 100000 45 9126 rs +Ethernet92 229,230 Eth3-15 100000 46 9126 rs +Ethernet94 231,232 Eth3-16 100000 47 9126 rs +Ethernet96 217,218 Eth4-1 100000 48 9126 rs +Ethernet98 219,220 Eth4-2 100000 49 9126 rs +Ethernet100 221,222 Eth4-3 100000 50 9126 rs +Ethernet102 223,224 Eth4-4 100000 51 9126 rs +Ethernet104 209,210 Eth4-5 100000 52 9126 rs +Ethernet106 211,212 Eth4-6 100000 53 9126 rs +Ethernet108 213,214 Eth4-7 100000 54 9126 rs +Ethernet110 215,216 Eth4-8 100000 55 9126 rs +Ethernet112 201,202 Eth4-9 100000 56 9126 rs +Ethernet114 203,204 Eth4-10 100000 57 9126 rs +Ethernet116 205,206 Eth4-11 100000 58 9126 rs +Ethernet118 207,208 Eth4-12 100000 59 9126 rs +Ethernet120 193,194 Eth4-13 100000 60 9126 rs +Ethernet122 195,196 Eth4-14 100000 61 9126 rs +Ethernet124 197,198 Eth4-15 100000 62 9126 rs +Ethernet126 199,200 Eth4-16 100000 63 9126 rs +Ethernet128 185,186 Eth5-1 100000 64 9126 rs +Ethernet130 187,188 Eth5-2 100000 65 9126 rs +Ethernet132 189,190 Eth5-3 100000 66 9126 rs +Ethernet134 191,192 Eth5-4 100000 67 9126 rs +Ethernet136 177,178 Eth5-5 100000 68 9126 rs +Ethernet138 179,180 Eth5-6 100000 69 9126 rs +Ethernet140 181,182 Eth5-7 100000 70 9126 rs +Ethernet142 183,184 Eth5-8 100000 71 9126 rs +Ethernet144 169,170 Eth5-9 100000 72 9126 rs +Ethernet146 171,172 Eth5-10 100000 73 9126 rs +Ethernet148 173,174 Eth5-11 100000 74 9126 rs +Ethernet150 175,176 Eth5-12 100000 75 9126 rs +Ethernet152 161,162 Eth5-13 100000 76 9126 rs +Ethernet154 163,164 Eth5-14 100000 77 9126 rs +Ethernet156 165,166 Eth5-15 100000 78 9126 rs +Ethernet158 167,168 Eth5-16 100000 79 9126 rs +Ethernet160 153,154 Eth6-1 100000 80 9126 rs +Ethernet162 155,156 Eth6-2 100000 81 9126 rs +Ethernet164 157,158 Eth6-3 100000 82 9126 rs +Ethernet166 159,160 Eth6-4 100000 83 9126 rs +Ethernet168 145,146 Eth6-5 100000 84 9126 rs +Ethernet170 147,148 Eth6-6 100000 85 9126 rs +Ethernet172 149,150 Eth6-7 100000 86 9126 rs +Ethernet174 151,152 Eth6-8 100000 87 9126 rs +Ethernet176 137,138 Eth6-9 100000 88 9126 rs +Ethernet178 139,140 Eth6-10 100000 89 9126 rs +Ethernet180 141,142 Eth6-11 100000 90 9126 rs +Ethernet182 143,144 Eth6-12 100000 91 9126 rs +Ethernet184 129,130 Eth6-13 100000 92 9126 rs +Ethernet186 131,132 Eth6-14 100000 93 9126 rs +Ethernet188 133,134 Eth6-15 100000 94 9126 rs +Ethernet190 135,136 Eth6-16 100000 95 9126 rs +Ethernet192 121,122 Eth7-1 100000 96 9126 rs +Ethernet194 123,124 Eth7-2 100000 97 9126 rs +Ethernet196 125,126 Eth7-3 100000 98 9126 rs +Ethernet198 127,128 Eth7-4 100000 99 9126 rs +Ethernet200 113,114 Eth7-5 100000 100 9126 rs +Ethernet202 115,116 Eth7-6 100000 101 9126 rs +Ethernet204 117,118 Eth7-7 100000 102 9126 rs +Ethernet206 119,120 Eth7-8 100000 103 9126 rs +Ethernet208 105,106 Eth7-9 100000 104 9126 rs +Ethernet210 107,108 Eth7-10 100000 105 9126 rs +Ethernet212 109,110 Eth7-11 100000 106 9126 rs +Ethernet214 111,112 Eth7-12 100000 107 9126 rs +Ethernet216 97,98 Eth7-13 100000 108 9126 rs +Ethernet218 99,100 Eth7-14 100000 109 9126 rs +Ethernet220 101,102 Eth7-15 100000 110 9126 rs +Ethernet222 103,104 Eth7-16 100000 111 9126 rs +Ethernet224 89,90 Eth8-1 100000 112 9126 rs +Ethernet226 91,92 Eth8-2 100000 113 9126 rs +Ethernet228 93,94 Eth8-3 100000 114 9126 rs +Ethernet230 95,96 Eth8-4 100000 115 9126 rs +Ethernet232 81,82 Eth8-5 100000 116 9126 rs +Ethernet234 83,84 Eth8-6 100000 117 9126 rs +Ethernet236 85,86 Eth8-7 100000 118 9126 rs +Ethernet238 87,88 Eth8-8 100000 119 9126 rs +Ethernet240 73,74 Eth8-9 100000 120 9126 rs +Ethernet242 75,76 Eth8-10 100000 121 9126 rs +Ethernet244 77,78 Eth8-11 100000 122 9126 rs +Ethernet246 79,80 Eth8-12 100000 123 9126 rs +Ethernet248 65,66 Eth8-13 100000 124 9126 rs +Ethernet250 67,68 Eth8-14 100000 125 9126 rs +Ethernet252 69,70 Eth8-15 100000 126 9126 rs +Ethernet254 71,72 Eth8-16 100000 127 9126 rs diff --git a/device/cameo/x86_64-cameo_esc600_128q-r0/esc600-128q/qos.json.j2 b/device/cameo/x86_64-cameo_esc600_128q-r0/esc600-128q/qos.json.j2 new file mode 100644 index 0000000000..4b9748c7b5 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc600_128q-r0/esc600-128q/qos.json.j2 @@ -0,0 +1,114 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "0":"0", + "1":"1", + "2":"2", + "3":"3", + "4":"4", + "5":"5", + "6":"6", + "7":"7" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "red_min_threshold":"50000" + } + } +} diff --git a/device/cameo/x86_64-cameo_esc600_128q-r0/esc600-128q/qos_defaults_def_lossy.j2 b/device/cameo/x86_64-cameo_esc600_128q-r0/esc600-128q/qos_defaults_def_lossy.j2 new file mode 100644 index 0000000000..104d2d78de --- /dev/null +++ b/device/cameo/x86_64-cameo_esc600_128q-r0/esc600-128q/qos_defaults_def_lossy.j2 @@ -0,0 +1,118 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "0":"0", + "1":"1", + "2":"2", + "3":"3", + "4":"4", + "5":"5", + "6":"6", + "7":"7" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"0", + "4":"0", + "5":"0", + "6":"0", + "7":"0", + "8":"0", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]" + } + }, + "SCHEDULER": { + "scheduler.7": { + "type": "STRICT" + } + }, + "QUEUE": { + "{{ port_names }}|7": { + "scheduler": "[SCHEDULER|scheduler.7]" + } + } +} diff --git a/device/cameo/x86_64-cameo_esc600_128q-r0/esc600-128q/qos_defaults_t1.j2 b/device/cameo/x86_64-cameo_esc600_128q-r0/esc600-128q/qos_defaults_t1.j2 new file mode 100644 index 0000000000..4b9748c7b5 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc600_128q-r0/esc600-128q/qos_defaults_t1.j2 @@ -0,0 +1,114 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "0":"0", + "1":"1", + "2":"2", + "3":"3", + "4":"4", + "5":"5", + "6":"6", + "7":"7" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "red_min_threshold":"50000" + } + } +} diff --git a/device/cameo/x86_64-cameo_esc600_128q-r0/esc600-128q/sai.profile b/device/cameo/x86_64-cameo_esc600_128q-r0/esc600-128q/sai.profile new file mode 100644 index 0000000000..aba4fc81fb --- /dev/null +++ b/device/cameo/x86_64-cameo_esc600_128q-r0/esc600-128q/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/ivm.sai.config.yaml diff --git a/device/cameo/x86_64-cameo_esc600_128q-r0/installer.conf b/device/cameo/x86_64-cameo_esc600_128q-r0/installer.conf new file mode 100644 index 0000000000..925a32fc0c --- /dev/null +++ b/device/cameo/x86_64-cameo_esc600_128q-r0/installer.conf @@ -0,0 +1,3 @@ +CONSOLE_PORT=0x3f8 +CONSOLE_DEV=0 +CONSOLE_SPEED=115200 diff --git a/device/cameo/x86_64-cameo_esc600_128q-r0/platform_reboot b/device/cameo/x86_64-cameo_esc600_128q-r0/platform_reboot new file mode 100755 index 0000000000..c54d47e55b --- /dev/null +++ b/device/cameo/x86_64-cameo_esc600_128q-r0/platform_reboot @@ -0,0 +1,18 @@ +#!/bin/sh + +mr_reboot() { + + #echo "mr_reboot" + sudo rmmod x86-64-cameo-esc600-128q + sudo i2cset -y 0 0x30 0xa1 0 + +} + +if [ $# -eq 0 ] || [ $@ = "-f" ] || [ $@ = "--force" ] || [ $@ = "reboot" ]; then + mr_reboot +elif [ $@ = "-p" ] ; then + # echo "sudo halt" + sudo halt +else + echo "unsupported option" +fi diff --git a/device/cameo/x86_64-cameo_esc600_128q-r0/plugins/eeprom.py b/device/cameo/x86_64-cameo_esc600_128q-r0/plugins/eeprom.py new file mode 100755 index 0000000000..f0f19ba393 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc600_128q-r0/plugins/eeprom.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python + +try: + from sonic_eeprom import eeprom_tlvinfo +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +class board(eeprom_tlvinfo.TlvInfoDecoder): + _TLV_INFO_MAX_LEN = 256 + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/bus/i2c/devices/0-0056/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/cameo/x86_64-cameo_esc600_128q-r0/plugins/psuutil.py b/device/cameo/x86_64-cameo_esc600_128q-r0/plugins/psuutil.py new file mode 100755 index 0000000000..0d807ffd9f --- /dev/null +++ b/device/cameo/x86_64-cameo_esc600_128q-r0/plugins/psuutil.py @@ -0,0 +1,102 @@ +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +attr_path = '/sys/class/hwmon/hwmon2/device/' + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + SYSFS_PSU_DIR = ["/sys/bus/i2c/devices/i2c-10/10-0050", + "/sys/bus/i2c/devices/i2c-9/9-0050"] + + def __init__(self): + PsuBase.__init__(self) + + + # Get sysfs attribute + def get_attr_value(self, path): + + retval = 'ERR' + if (not os.path.isfile(path)): + return retval + + try: + with open(path, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", path, " file !") + + retval = retval.rstrip('\r\n') + return retval + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + :return: An integer, the number of PSUs available on the device + """ + MAX_PSUS = 4 + return MAX_PSUS + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is\ + faulty + """ + status = 0 + attr_file = 'psu_status' + status_path = attr_path+'/ESC600_PSU/' + attr_file + try: + reg_file = open(status_path, 'r') + except IOError as e: + print( "Error: unable to open file: %s" % str(e)) + return False + text_lines = reg_file.read() + + search_str = "PSU {} is power good".format(index) + + if search_str in text_lines: + status = 1 + + reg_file.close() + + return status + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + status = 0 + attr_file ='psu_present' + presence_path = attr_path+'ESC600_PSU/' + attr_file + try: + reg_file = open(presence_path, 'r') + except IOError as e: + print( "Error: unable to open file: %s" % str(e)) + return False + text_lines = reg_file.read() + + search_str = "PSU {} is present".format(index) + + if search_str in text_lines: + status = 1 + + reg_file.close() + + return status + diff --git a/device/cameo/x86_64-cameo_esc600_128q-r0/plugins/sfputil.py b/device/cameo/x86_64-cameo_esc600_128q-r0/plugins/sfputil.py new file mode 100755 index 0000000000..92079cb69e --- /dev/null +++ b/device/cameo/x86_64-cameo_esc600_128q-r0/plugins/sfputil.py @@ -0,0 +1,232 @@ +#!/usr/bin/env python + +try: + import os + import time + from sonic_sfp.sfputilbase import SfpUtilBase +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +attr_path = '/sys/class/hwmon/hwmon2/device/' +qsfp_sysfile_path = '/sys/bus/i2c/devices/{}-0032/' +i2c_bus_base = 0 + +class SfpUtil(SfpUtilBase): + """Platform specific SfpUtill class""" + + _port_start = 0 + _port_end = 127 + _port_in_block = 128 + _port_to_eeprom_mapping = {} + _global_port_pres_dict = {} + _port_position_mapping = [] + + def __init__(self): + self.create_port_position_mapping() + eeprom_path = "/sys/bus/i2c/devices/{0}-0050/eeprom" + for x in range(self._port_start, self._port_end + 1): + port_eeprom_path = eeprom_path.format(self._port_position_mapping[x][2]) + self._port_to_eeprom_mapping[x] = port_eeprom_path + + self.init_global_port_presence() + SfpUtilBase.__init__(self) + + def get_attr_value(self,attr_path): + retval = 'ERR' + try: + with open(attr_path, 'r') as fd: + retval = fd.read() + except Exception as error: + print("Unable to open ", attr_path, " file !") + return retval + + retval = retval.rstrip('\r\n') + fd.close() + return retval + + def bmc_is_exist(self): + value = '' + bmc_filePath = '/sys/class/hwmon/hwmon2/device/ESC600_SYS/bmc_present' + if os.path.exists(bmc_filePath): + value = self.get_attr_value(bmc_filePath) + if value.find('not') < 0: + return True + else: + return False + else: + return False + + def get_inserted_slots(self): + """ return list of inserted slots """ + path = attr_path+'ESC600_Module/module_insert' + try: + reg_file = open(path, 'r') + except IOError as e: + print( "Error: unable to open file: %s" % str(e)) + return False + + text_lines = reg_file.readlines() + reg_file.close() + + slots = [] + for line in text_lines: + if "is present" in line: + slots.append(int(filter(str.isdigit, line))) + + return slots + + def create_port_position_mapping(self): + inserted_slots = [] + ports_in_slots = [0]*8 + # record inserted slots + inserted_slots = self.get_inserted_slots() + + # record the numbers of port on each slot + for slot in inserted_slots: + path = qsfp_sysfile_path.format(slot+i2c_bus_base) + 'portnum' + ports_in_slots[slot-1] = int(self.get_attr_value(path)) + + # mapping + nport = 0 + if self.bmc_is_exist(): + PATH_71_BUS_BASE = 9 + else: + PATH_71_BUS_BASE = 33 + + sfp_bus = PATH_71_BUS_BASE + for i in range(0,8): + for x in range(0,ports_in_slots[i]): + self._port_position_mapping.append((i, x+1, sfp_bus+x)) + nport = nport + 1 + + if ports_in_slots[i] == 4: + sfp_bus = sfp_bus + 8 + elif ports_in_slots[i] == 16: + sfp_bus = sfp_bus + 16 + + self._port_end = nport-1 + + + def reset(self, port_num): + # Check for invalid port_num + if port_num < self._port_start or port_num > self._port_end: + return False + + pos = self._port_position_mapping[port_num] + path = qsfp_sysfile_path.format(pos[0]+i2c_bus_base+1)+'QSFP_reset_{}'.format(pos[1]) + try: + reg_file = open(path, 'w') + except IOError as e: + print( "Error: unable to open file: %s" % str(e)) + return False + + #toggle reset + #reg_file.seek(0) + reg_file.write(str(port_num+1)) + #time.sleep(1) + #reg_file.seek(0) + #reg_file.write('0') + reg_file.close() + return True + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + pos = self._port_position_mapping[port_num] + path = qsfp_sysfile_path.format(pos[0]+i2c_bus_base+1)+'QSFP_low_power_{}'.format(pos[1]) + + try: + reg_file = open(path, 'w') + except IOError as e: + print( "Error: unable to open file: %s" % str(e)) + return False + + # the gpio pin is ACTIVE_HIGH + if lpmode is True: + val = "1" + else: + val = "0" + + # write value to gpio + reg_file.seek(0) + reg_file.write(val) + reg_file.close() + + return True + + def get_low_power_mode(self, port_num): + # Check for invalid port_num + if port_num < self._port_start or port_num > self._port_end: + return False + + pos = self._port_position_mapping[port_num] + path = qsfp_sysfile_path.format(pos[0]+i2c_bus_base+1)+'QSFP_low_power_{}'.format(pos[1]) + + res = self.get_attr_value(path) + if res == 'ERR': + return False + + if int(res) == 1: + return True + + return False + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self._port_start or port_num > self._port_end: + return False + + pos = self._port_position_mapping[port_num] + path = qsfp_sysfile_path.format(pos[0]+i2c_bus_base+1)+'QSFP_present_{}'.format(pos[1]) + res = self.get_attr_value(path) + if res == 'ERR': + return False + + if int(res) == 1: + return True + + return False + + def init_global_port_presence(self): + for port_num in range(self.port_start, (self.port_end + 1)): + presence = self.get_presence(port_num) + if(presence): + self._global_port_pres_dict[port_num] = '1' + else: + self._global_port_pres_dict[port_num] = '0' + + def get_transceiver_change_event(self, timeout=0): + port_dict = {} + while True: + for port_num in range(self.port_start, (self.port_end + 1)): + presence = self.get_presence(port_num) + if(presence and self._global_port_pres_dict[port_num] == '0'): + self._global_port_pres_dict[port_num] = '1' + port_dict[port_num] = '1' + elif(not presence and + self._global_port_pres_dict[port_num] == '1'): + self._global_port_pres_dict[port_num] = '0' + port_dict[port_num] = '0' + + if(len(port_dict) > 0): + return True, port_dict + + time.sleep(1) + + @property + def port_start(self): + return self._port_start + + @property + def port_end(self): + return self._port_end + + @property + def qsfp_ports(self): + return range(0, self._port_in_block + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping diff --git a/device/cameo/x86_64-cameo_esc600_128q-r0/pmon_daemon_control.json b/device/cameo/x86_64-cameo_esc600_128q-r0/pmon_daemon_control.json new file mode 100644 index 0000000000..44871c057e --- /dev/null +++ b/device/cameo/x86_64-cameo_esc600_128q-r0/pmon_daemon_control.json @@ -0,0 +1,4 @@ +{ + "skip_ledd": true, + "skip_thermalctld": true +} diff --git a/device/cameo/x86_64-cameo_esc600_128q-r0/sensors.conf b/device/cameo/x86_64-cameo_esc600_128q-r0/sensors.conf new file mode 100644 index 0000000000..4d4615524e --- /dev/null +++ b/device/cameo/x86_64-cameo_esc600_128q-r0/sensors.conf @@ -0,0 +1,22 @@ +bus "i2c-43" "i2c-0-mux (chan_id 2)" +chip "g781-i2c-43-4c" + label temp1 "local temp sensor" + label temp2 "Sensor on left bottom PCB" + +bus "i2c-44" "i2c-0-mux (chan_id 3)" +chip "g781-i2c-44-4c" + label temp1 "local temp sensor" + label temp2 "Sensor on rear bottom PCB" + +bus "i2c-42" "i2c-0-mux (chan_id 1)" +chip "g781-i2c-42-4c" + label temp1 "local temp sensor" + label temp2 "Sensor on rear center PCB" + +bus "i2c-41" "i2c-0-mux (chan_id 0)" +chip "nct7511-i2c-*-2e" + label temp1 "local temp sensor" + label temp2 "Sensor on right bottom PCB" + ignore fan1 + + diff --git a/device/cameo/x86_64-cameo_esc600_128q-r0/topo.conf b/device/cameo/x86_64-cameo_esc600_128q-r0/topo.conf new file mode 100644 index 0000000000..795ea43143 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc600_128q-r0/topo.conf @@ -0,0 +1 @@ +t1 diff --git a/device/cameo/x86_64-cameo_esc601_32q-r0/default_sku b/device/cameo/x86_64-cameo_esc601_32q-r0/default_sku new file mode 100755 index 0000000000..1ef6d57d34 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc601_32q-r0/default_sku @@ -0,0 +1 @@ +esc601-32q t1 diff --git a/device/cameo/x86_64-cameo_esc601_32q-r0/esc601-32q/buffers.json.j2 b/device/cameo/x86_64-cameo_esc601_32q-r0/esc601-32q/buffers.json.j2 new file mode 100644 index 0000000000..93dac6b199 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc601_32q-r0/esc601-32q/buffers.json.j2 @@ -0,0 +1,137 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '40m' %} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) %} + {%- set cable_len = [] %} + {%- for local_port in DEVICE_NEIGHBOR %} + {%- if local_port == port_name %} + {%- if DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor_role = neighbor.type %} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role %} + {%- set roles1 = roles1 | lower %} + {%- set roles2 = roles2 | lower %} + {%- if roles1 in ports2cable %} + {%- if cable_len.append(ports2cable[roles1]) %}{% endif %} + {%- elif roles2 in ports2cable %} + {%- if cable_len.append(ports2cable[roles2]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else %} + {%- if switch_role.lower() == 'torrouter' %} + {%- for local_port in VLAN_MEMBER %} + {%- if local_port[1] == port_name %} + {%- set roles3 = switch_role + '_' + 'server' %} + {%- set roles3 = roles3 | lower %} + {%- if roles3 in ports2cable %} + {%- if cable_len.append(ports2cable[roles3]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- endif %} +{%- endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "47218432", + "type": "ingress", + "mode": "dynamic", + "xoff": "17708800" + }, + "lossy_pool": { + "size": "18874368", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xoff":"38816", + "size":"1518", + "dynamic_th":"1", + "xon_offset":"13440" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"9497600" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"0", + "static_th":"9497600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"1518", + "dynamic_th":"2" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/cameo/x86_64-cameo_esc601_32q-r0/esc601-32q/buffers_defaults_def_lossy.j2 b/device/cameo/x86_64-cameo_esc601_32q-r0/esc601-32q/buffers_defaults_def_lossy.j2 new file mode 100644 index 0000000000..1a31812c26 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc601_32q-r0/esc601-32q/buffers_defaults_def_lossy.j2 @@ -0,0 +1,38 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "BUFFER_POOL": { + "lossy_pool": { + "size": "56985600", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"0", + "static_th":"9497600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"1518", + "dynamic_th":"2" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-7": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|0-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/cameo/x86_64-cameo_esc601_32q-r0/esc601-32q/buffers_defaults_t1.j2 b/device/cameo/x86_64-cameo_esc601_32q-r0/esc601-32q/buffers_defaults_t1.j2 new file mode 100644 index 0000000000..93dac6b199 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc601_32q-r0/esc601-32q/buffers_defaults_t1.j2 @@ -0,0 +1,137 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '40m' %} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) %} + {%- set cable_len = [] %} + {%- for local_port in DEVICE_NEIGHBOR %} + {%- if local_port == port_name %} + {%- if DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor_role = neighbor.type %} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role %} + {%- set roles1 = roles1 | lower %} + {%- set roles2 = roles2 | lower %} + {%- if roles1 in ports2cable %} + {%- if cable_len.append(ports2cable[roles1]) %}{% endif %} + {%- elif roles2 in ports2cable %} + {%- if cable_len.append(ports2cable[roles2]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else %} + {%- if switch_role.lower() == 'torrouter' %} + {%- for local_port in VLAN_MEMBER %} + {%- if local_port[1] == port_name %} + {%- set roles3 = switch_role + '_' + 'server' %} + {%- set roles3 = roles3 | lower %} + {%- if roles3 in ports2cable %} + {%- if cable_len.append(ports2cable[roles3]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- endif %} +{%- endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "47218432", + "type": "ingress", + "mode": "dynamic", + "xoff": "17708800" + }, + "lossy_pool": { + "size": "18874368", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xoff":"38816", + "size":"1518", + "dynamic_th":"1", + "xon_offset":"13440" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"9497600" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"0", + "static_th":"9497600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"1518", + "dynamic_th":"2" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/cameo/x86_64-cameo_esc601_32q-r0/esc601-32q/config_32x100G_Cameo-esc601-32q.yaml b/device/cameo/x86_64-cameo_esc601_32q-r0/esc601-32q/config_32x100G_Cameo-esc601-32q.yaml new file mode 100644 index 0000000000..6ecbfb1a30 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc601_32q-r0/esc601-32q/config_32x100G_Cameo-esc601-32q.yaml @@ -0,0 +1,417 @@ +ifcs: + options: + log_level: "info" +nodes: +- node_id: "0" + options: + sku: "configs/sku/innovium.77700_B" + netdev: + - auto_create: "no" + multi_interface: "yes" + buffer_management_mode: "api_driven" + max_lossless_tc: "2" + wred_cr_ip_proto_list: "17" + ilpm_enable: "1" + forward_profile: "IFCS_FORWARD_PROFILE_ID_PROFILE_E" + txring: + - txring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "3" + desc_count: "1024" + prio: "1" + netdev: "true" + rxring: + - rxring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39" + - rxring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40" + - rxring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "2, 5, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35, 38, 41, 47" + - rxring_id: "3" + desc_count: "1024" + prio: "1" + queues: "42, 43, 44, 45, 46" + sys_clk: "1720" + ifc_clk: "1200" + mac_clk: "1340" + + devports: + - id: "0" + sysport: "1000" + type: "cpu" + - fec: "KRFEC" + id: "33" + lanes: "0:4" + serdes_group: "4" + speed: "100G" + sysport: "33" + type: "eth" + - fec: "KRFEC" + id: "37" + lanes: "4:4" + serdes_group: "4" + speed: "100G" + sysport: "37" + type: "eth" + - fec: "KRFEC" + id: "25" + lanes: "0:4" + serdes_group: "3" + speed: "100G" + sysport: "25" + type: "eth" + - fec: "KRFEC" + id: "29" + lanes: "4:4" + serdes_group: "3" + speed: "100G" + sysport: "29" + type: "eth" + - fec: "KRFEC" + id: "17" + lanes: "0:4" + serdes_group: "2" + speed: "100G" + sysport: "17" + type: "eth" + - fec: "KRFEC" + id: "21" + lanes: "4:4" + serdes_group: "2" + speed: "100G" + sysport: "21" + type: "eth" + - fec: "KRFEC" + id: "1" + lanes: "0:4" + serdes_group: "0" + speed: "100G" + sysport: "1" + type: "eth" + - fec: "KRFEC" + id: "5" + lanes: "4:4" + serdes_group: "0" + speed: "100G" + sysport: "5" + type: "eth" + - fec: "KRFEC" + id: "233" + lanes: "0:4" + serdes_group: "29" + speed: "100G" + sysport: "233" + type: "eth" + - fec: "KRFEC" + id: "237" + lanes: "4:4" + serdes_group: "29" + speed: "100G" + sysport: "237" + type: "eth" + - fec: "KRFEC" + id: "225" + lanes: "0:4" + serdes_group: "28" + speed: "100G" + sysport: "225" + type: "eth" + - fec: "KRFEC" + id: "229" + lanes: "4:4" + serdes_group: "28" + speed: "100G" + sysport: "229" + type: "eth" + - fec: "KRFEC" + id: "217" + lanes: "0:4" + serdes_group: "27" + speed: "100G" + sysport: "217" + type: "eth" + - fec: "KRFEC" + id: "221" + lanes: "4:4" + serdes_group: "27" + speed: "100G" + sysport: "221" + type: "eth" + - fec: "KRFEC" + id: "209" + lanes: "0:4" + serdes_group: "26" + speed: "100G" + sysport: "209" + type: "eth" + - fec: "KRFEC" + id: "213" + lanes: "4:4" + serdes_group: "26" + speed: "100G" + sysport: "213" + type: "eth" + - fec: "KRFEC" + id: "161" + lanes: "0:4" + serdes_group: "20" + speed: "100G" + sysport: "161" + type: "eth" + - fec: "KRFEC" + id: "165" + lanes: "4:4" + serdes_group: "20" + speed: "100G" + sysport: "165" + type: "eth" + - fec: "KRFEC" + id: "153" + lanes: "0:4" + serdes_group: "19" + speed: "100G" + sysport: "153" + type: "eth" + - fec: "KRFEC" + id: "157" + lanes: "4:4" + serdes_group: "19" + speed: "100G" + sysport: "157" + type: "eth" + - fec: "KRFEC" + id: "145" + lanes: "0:4" + serdes_group: "18" + speed: "100G" + sysport: "145" + type: "eth" + - fec: "KRFEC" + id: "149" + lanes: "4:4" + serdes_group: "18" + speed: "100G" + sysport: "149" + type: "eth" + - fec: "KRFEC" + id: "129" + lanes: "0:4" + serdes_group: "16" + speed: "100G" + sysport: "129" + type: "eth" + - fec: "KRFEC" + id: "133" + lanes: "4:4" + serdes_group: "16" + speed: "100G" + sysport: "133" + type: "eth" + - fec: "KRFEC" + id: "113" + lanes: "0:4" + serdes_group: "14" + speed: "100G" + sysport: "113" + type: "eth" + - fec: "KRFEC" + id: "117" + lanes: "4:4" + serdes_group: "14" + speed: "100G" + sysport: "117" + type: "eth" + - fec: "KRFEC" + id: "105" + lanes: "0:4" + serdes_group: "13" + speed: "100G" + sysport: "105" + type: "eth" + - fec: "KRFEC" + id: "109" + lanes: "4:4" + serdes_group: "13" + speed: "100G" + sysport: "109" + type: "eth" + - fec: "KRFEC" + id: "89" + lanes: "0:4" + serdes_group: "11" + speed: "100G" + sysport: "89" + type: "eth" + - fec: "KRFEC" + id: "93" + lanes: "4:4" + serdes_group: "11" + speed: "100G" + sysport: "93" + type: "eth" + - fec: "KRFEC" + id: "81" + lanes: "0:4" + serdes_group: "10" + speed: "100G" + sysport: "81" + type: "eth" + - fec: "KRFEC" + id: "85" + lanes: "4:4" + serdes_group: "10" + speed: "100G" + sysport: "85" + type: "eth" + isg: + - id: "0" + tx_polarity: "11011111" + rx_polarity: "10001000" + lane_swap: "67543210" + - id: "1" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" + - id: "2" + tx_polarity: "11011000" + rx_polarity: "10001110" + lane_swap: "67543210" + - id: "3" + tx_polarity: "11101110" + rx_polarity: "01001000" + lane_swap: "67542310" + - id: "4" + tx_polarity: "11001000" + rx_polarity: "11000110" + lane_swap: "67542310" + - id: "5" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" + - id: "6" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" + - id: "7" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" + - id: "8" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" + - id: "9" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" + - id: "10" + tx_polarity: "10100100" + rx_polarity: "10101100" + lane_swap: "67451320" + - id: "11" + tx_polarity: "10000000" + rx_polarity: "11111011" + lane_swap: "67542310" + - id: "12" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" + - id: "13" + tx_polarity: "11001001" + rx_polarity: "01001110" + lane_swap: "76542310" + - id: "14" + tx_polarity: "01000100" + rx_polarity: "01010110" + lane_swap: "67452301" + - id: "15" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" + - id: "16" + tx_polarity: "00000000" + rx_polarity: "01111101" + lane_swap: "67542310" + - id: "17" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" + - id: "18" + tx_polarity: "11101101" + rx_polarity: "01001101" + lane_swap: "76542310" + - id: "19" + tx_polarity: "00111111" + rx_polarity: "10101100" + lane_swap: "67542310" + - id: "20" + tx_polarity: "11101100" + rx_polarity: "01001000" + lane_swap: "67542310" + - id: "21" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" + - id: "22" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" + - id: "23" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" + - id: "24" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" + - id: "25" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" + - id: "26" + tx_polarity: "10001110" + rx_polarity: "11000100" + lane_swap: "67542310" + - id: "27" + tx_polarity: "11000101" + rx_polarity: "01001010" + lane_swap: "76542310" + - id: "28" + tx_polarity: "11001000" + rx_polarity: "10000111" + lane_swap: "67542310" + - id: "29" + tx_polarity: "11110111" + rx_polarity: "00101110" + lane_swap: "67452310" + - id: "30" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" + - id: "31" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" + - id: "32" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" diff --git a/device/cameo/x86_64-cameo_esc601_32q-r0/esc601-32q/innovium.77700_B b/device/cameo/x86_64-cameo_esc601_32q-r0/esc601-32q/innovium.77700_B new file mode 100644 index 0000000000..27297b3139 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc601_32q-r0/esc601-32q/innovium.77700_B @@ -0,0 +1,59 @@ +sku: innovium.77700_B + +device_id: 0x1b58 + +# Hardware constraint information +hardware: + num_ibs: 6 + + ports_per_ib: 32, 32, 32, 32, 20, 20 + recirc_port_num: 32, 32, 32, 32, 32, 32 + cpu_port_num: 33 + cpu_port_ib: 0 + mgmt_port_num: 33 + mgmt_port_ibs: 1,2 + + pics_per_ib: 6, 7, 7, 6, 5, 5 + pic_ports_per_pic: 8 + max_serdes_speed: 50 + + num_shared_pics: 2 + + isg [0-4]: + ib: 0 + pic_id: [0-4] + + isg [5-9]: + ib: 5 + pic_id: [0-4] + + isg [10-14]: + ib: 1 + pic_id: [0-4] + + isg [16-20]: + ib: 3 + pic_id: [0-4] + + isg [21-25]: + ib: 4 + pic_id: [0-4] + + isg [26-30]: + ib: 2 + pic_id: [0-4] + + isg 15: + mode: 4:4 + ib: 1, 3 + pic_id: 5 + + isg 31: + mode: 4:4 + ib: 0, 2 + pic_id: 5 + + isg 32: + mode: 1:1 + ib: 1, 2 + pic_id: 6 diff --git a/device/cameo/x86_64-cameo_esc601_32q-r0/esc601-32q/ivm.sai.config.yaml b/device/cameo/x86_64-cameo_esc601_32q-r0/esc601-32q/ivm.sai.config.yaml new file mode 100644 index 0000000000..d4bd1028d9 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc601_32q-r0/esc601-32q/ivm.sai.config.yaml @@ -0,0 +1,9 @@ +IFCS_INIT_FILE : "/usr/share/sonic/hwsku/config_32x100G_Cameo-esc601-32q.yaml" +IFCS_SKU_FILE : "/usr/share/sonic/hwsku/innovium.77700_B" +IFCS_INNO_CLI_PORT : "9999" +IFCS_TARGET : "device" +INNOVIUM_DIR : "/innovium" +NRZ_PORTS_SIG_DETECT_MODE_TL7 : "1" +PYTHONPATH : "$INNOVIUM_DIR:$INNOVIUM_DIR/cmds:$INNOVIUM_DIR/scripts:$INNOVIUM_DIR/test/:$INNOVIUM_DIR/test/utils:$INNOVIUM_DIR/utils:$INNOVIUM_DIR/pyctypes" +IVM_SAI_DATAPATH_CONFIG_FILE: "/usr/share/sonic/hwsku/ivm.sai.datapath.config.yaml" +IVM_SAI_PARAM_A0008: "32" diff --git a/device/cameo/x86_64-cameo_esc601_32q-r0/esc601-32q/ivm.sai.datapath.config.yaml b/device/cameo/x86_64-cameo_esc601_32q-r0/esc601-32q/ivm.sai.datapath.config.yaml new file mode 100644 index 0000000000..891b0b3e28 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc601_32q-r0/esc601-32q/ivm.sai.datapath.config.yaml @@ -0,0 +1,9 @@ +ISAI_PARAM_P0_0_LS : "4608 4608 4608 4608 2880 2880" +ISAI_PARAM_P0_1_LS : "2226 1946 1946 1890 1218 1218" +ISAI_PARAM_P0_1_ALS : "434 154 154 98 98 98" +ISAI_PARAM_P1_0_LS : "1536 1536 1536 1536 960 960" +ISAI_PARAM_P1_0_LL : "3072 3072 3072 3072 1920 1920" +ISAI_PARAM_P1_1_LS : "1778 1498 1498 1442 938 938" +ISAI_PARAM_P1_1_LL : "2478 2478 2478 2478 2478 2478" +ISAI_PARAM_P1_1_ALS : "434 154 154 98 98 98" +ISAI_PARAM_P1_1_ALL : "126 126 126 126 126 126" diff --git a/device/cameo/x86_64-cameo_esc601_32q-r0/esc601-32q/pg_profile_lookup.ini b/device/cameo/x86_64-cameo_esc601_32q-r0/esc601-32q/pg_profile_lookup.ini new file mode 100644 index 0000000000..adcb52ab2a --- /dev/null +++ b/device/cameo/x86_64-cameo_esc601_32q-r0/esc601-32q/pg_profile_lookup.ini @@ -0,0 +1,18 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 25000 5m 1518 0 15680 1 13440 + 50000 5m 1518 0 21248 1 13440 + 100000 5m 1518 0 34624 1 13440 + 400000 5m 1518 0 117536 1 13440 + 25000 40m 1518 0 16928 1 13440 + 50000 40m 1518 0 23392 1 13440 + 100000 40m 1518 0 38816 1 13440 + 400000 40m 1518 0 135520 1 13440 + 25000 100m 1518 0 18848 1 13440 + 50000 100m 1518 0 27264 1 13440 + 100000 100m 1518 0 46496 1 13440 + 400000 100m 1518 0 166688 1 13440 + 25000 300m 1518 0 25184 1 13440 + 50000 300m 1518 0 40128 1 13440 + 100000 300m 1518 0 72384 1 13440 + 400000 300m 1518 0 268640 1 13440 diff --git a/device/cameo/x86_64-cameo_esc601_32q-r0/esc601-32q/port_config.ini b/device/cameo/x86_64-cameo_esc601_32q-r0/esc601-32q/port_config.ini new file mode 100644 index 0000000000..2ed67a20b8 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc601_32q-r0/esc601-32q/port_config.ini @@ -0,0 +1,33 @@ +# name lanes alias speed index mtu fec +Ethernet0 33,34,35,36 Eth1 100000 0 9126 rs +Ethernet4 37,38,39,40 Eth2 100000 1 9126 rs +Ethernet8 25,26,27,28 Eth3 100000 2 9126 rs +Ethernet12 29,30,31,32 Eth4 100000 3 9126 rs +Ethernet16 17,18,19,20 Eth5 100000 4 9126 rs +Ethernet20 21,22,23,24 Eth6 100000 5 9126 rs +Ethernet24 1,2,3,4 Eth7 100000 6 9126 rs +Ethernet28 5,6,7,8 Eth8 100000 7 9126 rs +Ethernet32 233,234,235,236 Eth9 100000 8 9126 rs +Ethernet36 237,238,239,240 Eth10 100000 9 9126 rs +Ethernet40 225,226,227,228 Eth11 100000 10 9126 rs +Ethernet44 229,230,231,232 Eth12 100000 11 9126 rs +Ethernet48 217,218,219,220 Eth13 100000 12 9126 rs +Ethernet52 221,222,223,224 Eth14 100000 13 9126 rs +Ethernet56 209,210,211,212 Eth15 100000 14 9126 rs +Ethernet60 213,214,215,216 Eth16 100000 15 9126 rs +Ethernet64 161,162,163,164 Eth17 100000 16 9126 rs +Ethernet68 165,166,167,168 Eth18 100000 17 9126 rs +Ethernet72 153,154,155,156 Eth19 100000 18 9126 rs +Ethernet76 157,158,159,160 Eth20 100000 19 9126 rs +Ethernet80 145,146,147,148 Eth21 100000 20 9126 rs +Ethernet84 149,150,151,152 Eth22 100000 21 9126 rs +Ethernet88 129,130,131,132 Eth23 100000 22 9126 rs +Ethernet92 133,134,135,136 Eth24 100000 23 9126 rs +Ethernet96 113,114,115,116 Eth25 100000 24 9126 rs +Ethernet100 117,118,119,120 Eth26 100000 25 9126 rs +Ethernet104 105,106,107,108 Eth27 100000 26 9126 rs +Ethernet108 109,110,111,112 Eth28 100000 27 9126 rs +Ethernet112 89,90,91,92 Eth29 100000 28 9126 rs +Ethernet116 93,94,95,96 Eth30 100000 29 9126 rs +Ethernet120 81,82,83,84 Eth31 100000 30 9126 rs +Ethernet124 85,86,87,88 Eth32 100000 31 9126 rs diff --git a/device/cameo/x86_64-cameo_esc601_32q-r0/esc601-32q/qos.json.j2 b/device/cameo/x86_64-cameo_esc601_32q-r0/esc601-32q/qos.json.j2 new file mode 100644 index 0000000000..4b9748c7b5 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc601_32q-r0/esc601-32q/qos.json.j2 @@ -0,0 +1,114 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "0":"0", + "1":"1", + "2":"2", + "3":"3", + "4":"4", + "5":"5", + "6":"6", + "7":"7" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "red_min_threshold":"50000" + } + } +} diff --git a/device/cameo/x86_64-cameo_esc601_32q-r0/esc601-32q/qos_defaults_def_lossy.j2 b/device/cameo/x86_64-cameo_esc601_32q-r0/esc601-32q/qos_defaults_def_lossy.j2 new file mode 100644 index 0000000000..104d2d78de --- /dev/null +++ b/device/cameo/x86_64-cameo_esc601_32q-r0/esc601-32q/qos_defaults_def_lossy.j2 @@ -0,0 +1,118 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "0":"0", + "1":"1", + "2":"2", + "3":"3", + "4":"4", + "5":"5", + "6":"6", + "7":"7" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"0", + "4":"0", + "5":"0", + "6":"0", + "7":"0", + "8":"0", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]" + } + }, + "SCHEDULER": { + "scheduler.7": { + "type": "STRICT" + } + }, + "QUEUE": { + "{{ port_names }}|7": { + "scheduler": "[SCHEDULER|scheduler.7]" + } + } +} diff --git a/device/cameo/x86_64-cameo_esc601_32q-r0/esc601-32q/qos_defaults_t1.j2 b/device/cameo/x86_64-cameo_esc601_32q-r0/esc601-32q/qos_defaults_t1.j2 new file mode 100644 index 0000000000..4b9748c7b5 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc601_32q-r0/esc601-32q/qos_defaults_t1.j2 @@ -0,0 +1,114 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "0":"0", + "1":"1", + "2":"2", + "3":"3", + "4":"4", + "5":"5", + "6":"6", + "7":"7" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "red_min_threshold":"50000" + } + } +} diff --git a/device/cameo/x86_64-cameo_esc601_32q-r0/esc601-32q/sai.profile b/device/cameo/x86_64-cameo_esc601_32q-r0/esc601-32q/sai.profile new file mode 100644 index 0000000000..aba4fc81fb --- /dev/null +++ b/device/cameo/x86_64-cameo_esc601_32q-r0/esc601-32q/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/ivm.sai.config.yaml diff --git a/device/cameo/x86_64-cameo_esc601_32q-r0/escc600-32q/buffers.json.j2 b/device/cameo/x86_64-cameo_esc601_32q-r0/escc600-32q/buffers.json.j2 new file mode 100644 index 0000000000..93dac6b199 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc601_32q-r0/escc600-32q/buffers.json.j2 @@ -0,0 +1,137 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '40m' %} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) %} + {%- set cable_len = [] %} + {%- for local_port in DEVICE_NEIGHBOR %} + {%- if local_port == port_name %} + {%- if DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor_role = neighbor.type %} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role %} + {%- set roles1 = roles1 | lower %} + {%- set roles2 = roles2 | lower %} + {%- if roles1 in ports2cable %} + {%- if cable_len.append(ports2cable[roles1]) %}{% endif %} + {%- elif roles2 in ports2cable %} + {%- if cable_len.append(ports2cable[roles2]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else %} + {%- if switch_role.lower() == 'torrouter' %} + {%- for local_port in VLAN_MEMBER %} + {%- if local_port[1] == port_name %} + {%- set roles3 = switch_role + '_' + 'server' %} + {%- set roles3 = roles3 | lower %} + {%- if roles3 in ports2cable %} + {%- if cable_len.append(ports2cable[roles3]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- endif %} +{%- endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "47218432", + "type": "ingress", + "mode": "dynamic", + "xoff": "17708800" + }, + "lossy_pool": { + "size": "18874368", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xoff":"38816", + "size":"1518", + "dynamic_th":"1", + "xon_offset":"13440" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"9497600" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"0", + "static_th":"9497600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"1518", + "dynamic_th":"2" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/cameo/x86_64-cameo_esc601_32q-r0/escc600-32q/buffers_defaults_def_lossy.j2 b/device/cameo/x86_64-cameo_esc601_32q-r0/escc600-32q/buffers_defaults_def_lossy.j2 new file mode 100644 index 0000000000..1a31812c26 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc601_32q-r0/escc600-32q/buffers_defaults_def_lossy.j2 @@ -0,0 +1,38 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "BUFFER_POOL": { + "lossy_pool": { + "size": "56985600", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"0", + "static_th":"9497600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"1518", + "dynamic_th":"2" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-7": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|0-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/cameo/x86_64-cameo_esc601_32q-r0/escc600-32q/buffers_defaults_t1.j2 b/device/cameo/x86_64-cameo_esc601_32q-r0/escc600-32q/buffers_defaults_t1.j2 new file mode 100644 index 0000000000..93dac6b199 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc601_32q-r0/escc600-32q/buffers_defaults_t1.j2 @@ -0,0 +1,137 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '40m' %} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) %} + {%- set cable_len = [] %} + {%- for local_port in DEVICE_NEIGHBOR %} + {%- if local_port == port_name %} + {%- if DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor_role = neighbor.type %} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role %} + {%- set roles1 = roles1 | lower %} + {%- set roles2 = roles2 | lower %} + {%- if roles1 in ports2cable %} + {%- if cable_len.append(ports2cable[roles1]) %}{% endif %} + {%- elif roles2 in ports2cable %} + {%- if cable_len.append(ports2cable[roles2]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else %} + {%- if switch_role.lower() == 'torrouter' %} + {%- for local_port in VLAN_MEMBER %} + {%- if local_port[1] == port_name %} + {%- set roles3 = switch_role + '_' + 'server' %} + {%- set roles3 = roles3 | lower %} + {%- if roles3 in ports2cable %} + {%- if cable_len.append(ports2cable[roles3]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- endif %} +{%- endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "47218432", + "type": "ingress", + "mode": "dynamic", + "xoff": "17708800" + }, + "lossy_pool": { + "size": "18874368", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xoff":"38816", + "size":"1518", + "dynamic_th":"1", + "xon_offset":"13440" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"9497600" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"0", + "static_th":"9497600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"1518", + "dynamic_th":"2" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/cameo/x86_64-cameo_esc601_32q-r0/escc600-32q/config_32x200G_Cameo-esc601-32q.yaml b/device/cameo/x86_64-cameo_esc601_32q-r0/escc600-32q/config_32x200G_Cameo-esc601-32q.yaml new file mode 100644 index 0000000000..5b676f2d18 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc601_32q-r0/escc600-32q/config_32x200G_Cameo-esc601-32q.yaml @@ -0,0 +1,417 @@ +ifcs: + options: + log_level: "info" +nodes: +- node_id: "0" + options: + sku: "configs/sku/innovium.77700_B" + netdev: + - auto_create: "no" + multi_interface: "yes" + buffer_management_mode: "api_driven" + max_lossless_tc: "2" + wred_cr_ip_proto_list: "17" + ilpm_enable: "1" + forward_profile: "IFCS_FORWARD_PROFILE_ID_PROFILE_E" + txring: + - txring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "3" + desc_count: "1024" + prio: "1" + netdev: "true" + rxring: + - rxring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39" + - rxring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40" + - rxring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "2, 5, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35, 38, 41, 47" + - rxring_id: "3" + desc_count: "1024" + prio: "1" + queues: "42, 43, 44, 45, 46" + sys_clk: "1720" + ifc_clk: "1200" + mac_clk: "1340" + + devports: + - id: "0" + sysport: "1000" + type: "cpu" + - fec: "KPFEC" + id: "33" + lanes: "0:4" + serdes_group: "4" + speed: "200G" + sysport: "33" + type: "eth" + - fec: "KPFEC" + id: "37" + lanes: "4:4" + serdes_group: "4" + speed: "200G" + sysport: "37" + type: "eth" + - fec: "KPFEC" + id: "25" + lanes: "0:4" + serdes_group: "3" + speed: "200G" + sysport: "25" + type: "eth" + - fec: "KPFEC" + id: "29" + lanes: "4:4" + serdes_group: "3" + speed: "200G" + sysport: "29" + type: "eth" + - fec: "KPFEC" + id: "17" + lanes: "0:4" + serdes_group: "2" + speed: "200G" + sysport: "17" + type: "eth" + - fec: "KPFEC" + id: "21" + lanes: "4:4" + serdes_group: "2" + speed: "200G" + sysport: "21" + type: "eth" + - fec: "KPFEC" + id: "1" + lanes: "0:4" + serdes_group: "0" + speed: "200G" + sysport: "1" + type: "eth" + - fec: "KPFEC" + id: "5" + lanes: "4:4" + serdes_group: "0" + speed: "200G" + sysport: "5" + type: "eth" + - fec: "KPFEC" + id: "233" + lanes: "0:4" + serdes_group: "29" + speed: "200G" + sysport: "233" + type: "eth" + - fec: "KPFEC" + id: "237" + lanes: "4:4" + serdes_group: "29" + speed: "200G" + sysport: "237" + type: "eth" + - fec: "KPFEC" + id: "225" + lanes: "0:4" + serdes_group: "28" + speed: "200G" + sysport: "225" + type: "eth" + - fec: "KPFEC" + id: "229" + lanes: "4:4" + serdes_group: "28" + speed: "200G" + sysport: "229" + type: "eth" + - fec: "KPFEC" + id: "217" + lanes: "0:4" + serdes_group: "27" + speed: "200G" + sysport: "217" + type: "eth" + - fec: "KPFEC" + id: "221" + lanes: "4:4" + serdes_group: "27" + speed: "200G" + sysport: "221" + type: "eth" + - fec: "KPFEC" + id: "209" + lanes: "0:4" + serdes_group: "26" + speed: "200G" + sysport: "209" + type: "eth" + - fec: "KPFEC" + id: "213" + lanes: "4:4" + serdes_group: "26" + speed: "200G" + sysport: "213" + type: "eth" + - fec: "KPFEC" + id: "161" + lanes: "0:4" + serdes_group: "20" + speed: "200G" + sysport: "161" + type: "eth" + - fec: "KPFEC" + id: "165" + lanes: "4:4" + serdes_group: "20" + speed: "200G" + sysport: "165" + type: "eth" + - fec: "KPFEC" + id: "153" + lanes: "0:4" + serdes_group: "19" + speed: "200G" + sysport: "153" + type: "eth" + - fec: "KPFEC" + id: "157" + lanes: "4:4" + serdes_group: "19" + speed: "200G" + sysport: "157" + type: "eth" + - fec: "KPFEC" + id: "145" + lanes: "0:4" + serdes_group: "18" + speed: "200G" + sysport: "145" + type: "eth" + - fec: "KPFEC" + id: "149" + lanes: "4:4" + serdes_group: "18" + speed: "200G" + sysport: "149" + type: "eth" + - fec: "KPFEC" + id: "129" + lanes: "0:4" + serdes_group: "16" + speed: "200G" + sysport: "129" + type: "eth" + - fec: "KPFEC" + id: "133" + lanes: "4:4" + serdes_group: "16" + speed: "200G" + sysport: "133" + type: "eth" + - fec: "KPFEC" + id: "113" + lanes: "0:4" + serdes_group: "14" + speed: "200G" + sysport: "113" + type: "eth" + - fec: "KPFEC" + id: "117" + lanes: "4:4" + serdes_group: "14" + speed: "200G" + sysport: "117" + type: "eth" + - fec: "KPFEC" + id: "105" + lanes: "0:4" + serdes_group: "13" + speed: "200G" + sysport: "105" + type: "eth" + - fec: "KPFEC" + id: "109" + lanes: "4:4" + serdes_group: "13" + speed: "200G" + sysport: "109" + type: "eth" + - fec: "KPFEC" + id: "89" + lanes: "0:4" + serdes_group: "11" + speed: "200G" + sysport: "89" + type: "eth" + - fec: "KPFEC" + id: "93" + lanes: "4:4" + serdes_group: "11" + speed: "200G" + sysport: "93" + type: "eth" + - fec: "KPFEC" + id: "81" + lanes: "0:4" + serdes_group: "10" + speed: "200G" + sysport: "81" + type: "eth" + - fec: "KPFEC" + id: "85" + lanes: "4:4" + serdes_group: "10" + speed: "200G" + sysport: "85" + type: "eth" + isg: + - id: "0" + tx_polarity: "11011111" + rx_polarity: "10001000" + lane_swap: "67543210" + - id: "1" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" + - id: "2" + tx_polarity: "11011000" + rx_polarity: "10001110" + lane_swap: "67543210" + - id: "3" + tx_polarity: "11101110" + rx_polarity: "01001000" + lane_swap: "67542310" + - id: "4" + tx_polarity: "11001000" + rx_polarity: "11000110" + lane_swap: "67542310" + - id: "5" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" + - id: "6" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" + - id: "7" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" + - id: "8" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" + - id: "9" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" + - id: "10" + tx_polarity: "10100100" + rx_polarity: "10101100" + lane_swap: "67451320" + - id: "11" + tx_polarity: "10000000" + rx_polarity: "11111011" + lane_swap: "67542310" + - id: "12" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" + - id: "13" + tx_polarity: "11001001" + rx_polarity: "01001110" + lane_swap: "76542310" + - id: "14" + tx_polarity: "01000100" + rx_polarity: "01010110" + lane_swap: "67452301" + - id: "15" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" + - id: "16" + tx_polarity: "00000000" + rx_polarity: "01111101" + lane_swap: "67542310" + - id: "17" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" + - id: "18" + tx_polarity: "11101101" + rx_polarity: "01001101" + lane_swap: "76542310" + - id: "19" + tx_polarity: "00111111" + rx_polarity: "10101100" + lane_swap: "67542310" + - id: "20" + tx_polarity: "11101100" + rx_polarity: "01001000" + lane_swap: "67542310" + - id: "21" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" + - id: "22" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" + - id: "23" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" + - id: "24" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" + - id: "25" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" + - id: "26" + tx_polarity: "10001110" + rx_polarity: "11000100" + lane_swap: "67542310" + - id: "27" + tx_polarity: "11000101" + rx_polarity: "01001010" + lane_swap: "76542310" + - id: "28" + tx_polarity: "11001000" + rx_polarity: "10000111" + lane_swap: "67542310" + - id: "29" + tx_polarity: "11110111" + rx_polarity: "00101110" + lane_swap: "67452310" + - id: "30" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" + - id: "31" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" + - id: "32" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" diff --git a/device/cameo/x86_64-cameo_esc601_32q-r0/escc600-32q/innovium.77700_B b/device/cameo/x86_64-cameo_esc601_32q-r0/escc600-32q/innovium.77700_B new file mode 100644 index 0000000000..27297b3139 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc601_32q-r0/escc600-32q/innovium.77700_B @@ -0,0 +1,59 @@ +sku: innovium.77700_B + +device_id: 0x1b58 + +# Hardware constraint information +hardware: + num_ibs: 6 + + ports_per_ib: 32, 32, 32, 32, 20, 20 + recirc_port_num: 32, 32, 32, 32, 32, 32 + cpu_port_num: 33 + cpu_port_ib: 0 + mgmt_port_num: 33 + mgmt_port_ibs: 1,2 + + pics_per_ib: 6, 7, 7, 6, 5, 5 + pic_ports_per_pic: 8 + max_serdes_speed: 50 + + num_shared_pics: 2 + + isg [0-4]: + ib: 0 + pic_id: [0-4] + + isg [5-9]: + ib: 5 + pic_id: [0-4] + + isg [10-14]: + ib: 1 + pic_id: [0-4] + + isg [16-20]: + ib: 3 + pic_id: [0-4] + + isg [21-25]: + ib: 4 + pic_id: [0-4] + + isg [26-30]: + ib: 2 + pic_id: [0-4] + + isg 15: + mode: 4:4 + ib: 1, 3 + pic_id: 5 + + isg 31: + mode: 4:4 + ib: 0, 2 + pic_id: 5 + + isg 32: + mode: 1:1 + ib: 1, 2 + pic_id: 6 diff --git a/device/cameo/x86_64-cameo_esc601_32q-r0/escc600-32q/ivm.sai.config.yaml b/device/cameo/x86_64-cameo_esc601_32q-r0/escc600-32q/ivm.sai.config.yaml new file mode 100644 index 0000000000..8b54535123 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc601_32q-r0/escc600-32q/ivm.sai.config.yaml @@ -0,0 +1,9 @@ +IFCS_INIT_FILE : "/usr/share/sonic/hwsku/config_32x200G_Cameo-esc601-32q.yaml" +IFCS_SKU_FILE : "/usr/share/sonic/hwsku/innovium.77700_B" +IFCS_INNO_CLI_PORT : "9999" +IFCS_TARGET : "device" +INNOVIUM_DIR : "/innovium" +NRZ_PORTS_SIG_DETECT_MODE_TL7 : "1" +PYTHONPATH : "$INNOVIUM_DIR:$INNOVIUM_DIR/cmds:$INNOVIUM_DIR/scripts:$INNOVIUM_DIR/test/:$INNOVIUM_DIR/test/utils:$INNOVIUM_DIR/utils:$INNOVIUM_DIR/pyctypes" +IVM_SAI_DATAPATH_CONFIG_FILE: "/usr/share/sonic/hwsku/ivm.sai.datapath.config.yaml" +IVM_SAI_PARAM_A0008: "32" diff --git a/device/cameo/x86_64-cameo_esc601_32q-r0/escc600-32q/ivm.sai.datapath.config.yaml b/device/cameo/x86_64-cameo_esc601_32q-r0/escc600-32q/ivm.sai.datapath.config.yaml new file mode 100644 index 0000000000..891b0b3e28 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc601_32q-r0/escc600-32q/ivm.sai.datapath.config.yaml @@ -0,0 +1,9 @@ +ISAI_PARAM_P0_0_LS : "4608 4608 4608 4608 2880 2880" +ISAI_PARAM_P0_1_LS : "2226 1946 1946 1890 1218 1218" +ISAI_PARAM_P0_1_ALS : "434 154 154 98 98 98" +ISAI_PARAM_P1_0_LS : "1536 1536 1536 1536 960 960" +ISAI_PARAM_P1_0_LL : "3072 3072 3072 3072 1920 1920" +ISAI_PARAM_P1_1_LS : "1778 1498 1498 1442 938 938" +ISAI_PARAM_P1_1_LL : "2478 2478 2478 2478 2478 2478" +ISAI_PARAM_P1_1_ALS : "434 154 154 98 98 98" +ISAI_PARAM_P1_1_ALL : "126 126 126 126 126 126" diff --git a/device/cameo/x86_64-cameo_esc601_32q-r0/escc600-32q/pg_profile_lookup.ini b/device/cameo/x86_64-cameo_esc601_32q-r0/escc600-32q/pg_profile_lookup.ini new file mode 100644 index 0000000000..adcb52ab2a --- /dev/null +++ b/device/cameo/x86_64-cameo_esc601_32q-r0/escc600-32q/pg_profile_lookup.ini @@ -0,0 +1,18 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 25000 5m 1518 0 15680 1 13440 + 50000 5m 1518 0 21248 1 13440 + 100000 5m 1518 0 34624 1 13440 + 400000 5m 1518 0 117536 1 13440 + 25000 40m 1518 0 16928 1 13440 + 50000 40m 1518 0 23392 1 13440 + 100000 40m 1518 0 38816 1 13440 + 400000 40m 1518 0 135520 1 13440 + 25000 100m 1518 0 18848 1 13440 + 50000 100m 1518 0 27264 1 13440 + 100000 100m 1518 0 46496 1 13440 + 400000 100m 1518 0 166688 1 13440 + 25000 300m 1518 0 25184 1 13440 + 50000 300m 1518 0 40128 1 13440 + 100000 300m 1518 0 72384 1 13440 + 400000 300m 1518 0 268640 1 13440 diff --git a/device/cameo/x86_64-cameo_esc601_32q-r0/escc600-32q/port_config.ini b/device/cameo/x86_64-cameo_esc601_32q-r0/escc600-32q/port_config.ini new file mode 100644 index 0000000000..7ce5bbd458 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc601_32q-r0/escc600-32q/port_config.ini @@ -0,0 +1,33 @@ +# name lanes speed index mtu fec +Ethernet0 33,34,35,36 200000 0 9126 rs +Ethernet4 37,38,39,40 200000 1 9126 rs +Ethernet8 25,26,27,28 200000 2 9126 rs +Ethernet12 29,30,31,32 200000 3 9126 rs +Ethernet16 17,18,19,20 200000 4 9126 rs +Ethernet20 21,22,23,24 200000 5 9126 rs +Ethernet24 1,2,3,4 200000 6 9126 rs +Ethernet28 5,6,7,8 200000 7 9126 rs +Ethernet32 233,234,235,236 200000 8 9126 rs +Ethernet36 237,238,239,240 200000 9 9126 rs +Ethernet40 225,226,227,228 200000 10 9126 rs +Ethernet44 229,230,231,232 200000 11 9126 rs +Ethernet48 217,218,219,220 200000 12 9126 rs +Ethernet52 221,222,223,224 200000 13 9126 rs +Ethernet56 209,210,211,212 200000 14 9126 rs +Ethernet60 213,214,215,216 200000 15 9126 rs +Ethernet64 161,162,163,164 200000 16 9126 rs +Ethernet68 165,166,167,168 200000 17 9126 rs +Ethernet72 153,154,155,156 200000 18 9126 rs +Ethernet76 157,158,159,160 200000 19 9126 rs +Ethernet80 145,146,147,148 200000 20 9126 rs +Ethernet84 149,150,151,152 200000 21 9126 rs +Ethernet88 129,130,131,132 200000 22 9126 rs +Ethernet92 133,134,135,136 200000 23 9126 rs +Ethernet96 113,114,115,116 200000 24 9126 rs +Ethernet100 117,118,119,120 200000 25 9126 rs +Ethernet104 105,106,107,108 200000 26 9126 rs +Ethernet108 109,110,111,112 200000 27 9126 rs +Ethernet112 89,90,91,92 200000 28 9126 rs +Ethernet116 93,94,95,96 200000 29 9126 rs +Ethernet120 81,82,83,84 200000 30 9126 rs +Ethernet124 85,86,87,88 200000 31 9126 rs diff --git a/device/cameo/x86_64-cameo_esc601_32q-r0/escc600-32q/qos.json.j2 b/device/cameo/x86_64-cameo_esc601_32q-r0/escc600-32q/qos.json.j2 new file mode 100644 index 0000000000..4b9748c7b5 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc601_32q-r0/escc600-32q/qos.json.j2 @@ -0,0 +1,114 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "0":"0", + "1":"1", + "2":"2", + "3":"3", + "4":"4", + "5":"5", + "6":"6", + "7":"7" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "red_min_threshold":"50000" + } + } +} diff --git a/device/cameo/x86_64-cameo_esc601_32q-r0/escc600-32q/qos_defaults_def_lossy.j2 b/device/cameo/x86_64-cameo_esc601_32q-r0/escc600-32q/qos_defaults_def_lossy.j2 new file mode 100644 index 0000000000..104d2d78de --- /dev/null +++ b/device/cameo/x86_64-cameo_esc601_32q-r0/escc600-32q/qos_defaults_def_lossy.j2 @@ -0,0 +1,118 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "0":"0", + "1":"1", + "2":"2", + "3":"3", + "4":"4", + "5":"5", + "6":"6", + "7":"7" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"0", + "4":"0", + "5":"0", + "6":"0", + "7":"0", + "8":"0", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]" + } + }, + "SCHEDULER": { + "scheduler.7": { + "type": "STRICT" + } + }, + "QUEUE": { + "{{ port_names }}|7": { + "scheduler": "[SCHEDULER|scheduler.7]" + } + } +} diff --git a/device/cameo/x86_64-cameo_esc601_32q-r0/escc600-32q/qos_defaults_t1.j2 b/device/cameo/x86_64-cameo_esc601_32q-r0/escc600-32q/qos_defaults_t1.j2 new file mode 100644 index 0000000000..4b9748c7b5 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc601_32q-r0/escc600-32q/qos_defaults_t1.j2 @@ -0,0 +1,114 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "0":"0", + "1":"1", + "2":"2", + "3":"3", + "4":"4", + "5":"5", + "6":"6", + "7":"7" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "red_min_threshold":"50000" + } + } +} diff --git a/device/cameo/x86_64-cameo_esc601_32q-r0/escc600-32q/sai.profile b/device/cameo/x86_64-cameo_esc601_32q-r0/escc600-32q/sai.profile new file mode 100644 index 0000000000..aba4fc81fb --- /dev/null +++ b/device/cameo/x86_64-cameo_esc601_32q-r0/escc600-32q/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/ivm.sai.config.yaml diff --git a/device/cameo/x86_64-cameo_esc601_32q-r0/installer.conf b/device/cameo/x86_64-cameo_esc601_32q-r0/installer.conf new file mode 100644 index 0000000000..925a32fc0c --- /dev/null +++ b/device/cameo/x86_64-cameo_esc601_32q-r0/installer.conf @@ -0,0 +1,3 @@ +CONSOLE_PORT=0x3f8 +CONSOLE_DEV=0 +CONSOLE_SPEED=115200 diff --git a/device/cameo/x86_64-cameo_esc601_32q-r0/platform_reboot b/device/cameo/x86_64-cameo_esc601_32q-r0/platform_reboot new file mode 100755 index 0000000000..d6699b743d --- /dev/null +++ b/device/cameo/x86_64-cameo_esc601_32q-r0/platform_reboot @@ -0,0 +1,18 @@ +#!/bin/sh + +mr_reboot() { + + #echo "mr_reboot" + sudo rmmod x86-64-cameo-esc601-32q + sudo i2cset -y 0 0x30 0xa4 0 + +} + +if [ $# -eq 0 ] || [ $@ = "-f" ] || [ $@ = "--force" ] || [ $@ = "reboot" ]; then + mr_reboot +elif [ $@ = "-p" ] ; then + # echo "sudo halt" + sudo halt +else + echo "unsupported option" +fi diff --git a/device/cameo/x86_64-cameo_esc601_32q-r0/plugins/eeprom.py b/device/cameo/x86_64-cameo_esc601_32q-r0/plugins/eeprom.py new file mode 100644 index 0000000000..f0f19ba393 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc601_32q-r0/plugins/eeprom.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python + +try: + from sonic_eeprom import eeprom_tlvinfo +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +class board(eeprom_tlvinfo.TlvInfoDecoder): + _TLV_INFO_MAX_LEN = 256 + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/bus/i2c/devices/0-0056/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/cameo/x86_64-cameo_esc601_32q-r0/plugins/psuutil.py b/device/cameo/x86_64-cameo_esc601_32q-r0/plugins/psuutil.py new file mode 100644 index 0000000000..ef8d36b60a --- /dev/null +++ b/device/cameo/x86_64-cameo_esc601_32q-r0/plugins/psuutil.py @@ -0,0 +1,102 @@ +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +attr_path = '/sys/class/hwmon/hwmon2/device/' + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + SYSFS_PSU_DIR = ["/sys/bus/i2c/devices/i2c-10/10-0050", + "/sys/bus/i2c/devices/i2c-9/9-0050"] + + def __init__(self): + PsuBase.__init__(self) + + + # Get sysfs attribute + def get_attr_value(self, path): + + retval = 'ERR' + if (not os.path.isfile(path)): + return retval + + try: + with open(path, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", path, " file !") + + retval = retval.rstrip('\r\n') + return retval + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + :return: An integer, the number of PSUs available on the device + """ + MAX_PSUS = 2 + return MAX_PSUS + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is\ + faulty + """ + status = 0 + attr_file = 'psu_status' + status_path = attr_path+'/ESC601_PSU/' + attr_file + try: + reg_file = open(status_path, 'r') + except IOError as e: + print( "Error: unable to open file: %s" % str(e)) + return False + text_lines = reg_file.read() + + search_str = "PSU {} is power Good".format(index) + + if search_str in text_lines: + status = 1 + + reg_file.close() + + return status + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + status = 0 + attr_file ='psu_present' + presence_path = attr_path+'ESC601_PSU/' + attr_file + try: + reg_file = open(presence_path, 'r') + except IOError as e: + print( "Error: unable to open file: %s" % str(e)) + return False + text_lines = reg_file.read() + + search_str = "PSU {} is present".format(index) + + if search_str in text_lines: + status = 1 + + reg_file.close() + + return status + diff --git a/device/cameo/x86_64-cameo_esc601_32q-r0/plugins/sfputil.py b/device/cameo/x86_64-cameo_esc601_32q-r0/plugins/sfputil.py new file mode 100644 index 0000000000..da280f79e7 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc601_32q-r0/plugins/sfputil.py @@ -0,0 +1,165 @@ +#!/usr/bin/env python + +try: + import time + import json + from sonic_sfp.sfputilbase import SfpUtilBase +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +attr_path = '/sys/class/hwmon/hwmon2/device/' +PLATFORM_INSTALL_INFO_FILE="/etc/sonic/platform_install.json" +PLATFORM_SFP_GROUPS = ['SFP-G01','SFP-G02','SFP-G03','SFP-G04'] + +class SfpUtil(SfpUtilBase): + """Platform specific SfpUtill class""" + + _port_start = 0 + _port_end = 31 + _port_in_block =32 + _port_to_eeprom_mapping = {} + _global_port_pres_dict = {} + + def __init__(self): + eeprom_path = "{}/eeprom" + path_list = self.get_sfp_path() + for x in range(self._port_start, self._port_end + 1): + port_eeprom_path = eeprom_path.format(path_list[x]) + self._port_to_eeprom_mapping[x] = port_eeprom_path + + self.init_global_port_presence() + SfpUtilBase.__init__(self) + + def get_sfp_path(self): + map = [] + with open(PLATFORM_INSTALL_INFO_FILE) as fd: + install_info = json.load(fd) + for sfp_group_name in PLATFORM_SFP_GROUPS: + sfp_group = install_info[2][sfp_group_name] + map = map + sfp_group['paths'] + return map + + def reset(self, port_num): + # Check for invalid port_num + if port_num < self._port_start or port_num > self._port_end: + return False + + path = attr_path+'ESC601_QSFP/QSFP_reset' + try: + reg_file = open(path, 'w') + except IOError as e: + print( "Error: unable to open file: %s" % str(e)) + return False + + #toggle reset + #reg_file.seek(0) + reg_file.write(str(port_num+1)) + #time.sleep(1) + #reg_file.seek(0) + #reg_file.write('0') + reg_file.close() + return True + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + path = attr_path+'ESC601_QSFP/QSFP_low_power_'+str(port_num+1) + try: + reg_file = open(path, 'w') + except IOError as e: + print( "Error: unable to open file: %s" % str(e)) + return False + + # the gpio pin is ACTIVE_HIGH + if lpmode is True: + val = "1" + else: + val = "0" + + # write value to gpio + reg_file.seek(0) + reg_file.write(val) + reg_file.close() + + return True + + def get_low_power_mode(self, port_num): + # Check for invalid port_num + if port_num < self._port_start or port_num > self._port_end: + return False + + path = attr_path+'ESC601_QSFP/QSFP_low_power_'+str(port_num+1) + try: + reg_file = open(path, 'r') + except IOError as e: + print( "Error: unable to open file: %s" % str(e)) + return False + + text_lines = reg_file.readline() + reg_file.close() + if text_lines.find('OFF') < 0: + return True + + return False + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self._port_start or port_num > self._port_end: + return False + + path = attr_path+'ESC601_QSFP/QSFP_present' + try: + reg_file = open(path, 'r') + except IOError as e: + print( "Error: unable to open file: %s" % str(e)) + return False + text_lines = reg_file.readlines() + reg_file.close() + if text_lines[port_num].find('not') < 0: + return True + + return False + + def init_global_port_presence(self): + for port_num in range(self.port_start, (self.port_end + 1)): + presence = self.get_presence(port_num) + if(presence): + self._global_port_pres_dict[port_num] = '1' + else: + self._global_port_pres_dict[port_num] = '0' + + def get_transceiver_change_event(self, timeout=0): + port_dict = {} + while True: + for port_num in range(self.port_start, (self.port_end + 1)): + presence = self.get_presence(port_num) + if(presence and self._global_port_pres_dict[port_num] == '0'): + self._global_port_pres_dict[port_num] = '1' + port_dict[port_num] = '1' + elif(not presence and + self._global_port_pres_dict[port_num] == '1'): + self._global_port_pres_dict[port_num] = '0' + port_dict[port_num] = '0' + + if(len(port_dict) > 0): + return True, port_dict + + time.sleep(1) + + @property + def port_start(self): + return self._port_start + + @property + def port_end(self): + return self._port_end + + @property + def qsfp_ports(self): + return range(0, self._port_in_block + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping diff --git a/device/cameo/x86_64-cameo_esc601_32q-r0/pmon_daemon_control.json b/device/cameo/x86_64-cameo_esc601_32q-r0/pmon_daemon_control.json new file mode 100644 index 0000000000..44871c057e --- /dev/null +++ b/device/cameo/x86_64-cameo_esc601_32q-r0/pmon_daemon_control.json @@ -0,0 +1,4 @@ +{ + "skip_ledd": true, + "skip_thermalctld": true +} diff --git a/device/cameo/x86_64-cameo_esc601_32q-r0/sensors.conf b/device/cameo/x86_64-cameo_esc601_32q-r0/sensors.conf new file mode 100644 index 0000000000..4d4615524e --- /dev/null +++ b/device/cameo/x86_64-cameo_esc601_32q-r0/sensors.conf @@ -0,0 +1,22 @@ +bus "i2c-43" "i2c-0-mux (chan_id 2)" +chip "g781-i2c-43-4c" + label temp1 "local temp sensor" + label temp2 "Sensor on left bottom PCB" + +bus "i2c-44" "i2c-0-mux (chan_id 3)" +chip "g781-i2c-44-4c" + label temp1 "local temp sensor" + label temp2 "Sensor on rear bottom PCB" + +bus "i2c-42" "i2c-0-mux (chan_id 1)" +chip "g781-i2c-42-4c" + label temp1 "local temp sensor" + label temp2 "Sensor on rear center PCB" + +bus "i2c-41" "i2c-0-mux (chan_id 0)" +chip "nct7511-i2c-*-2e" + label temp1 "local temp sensor" + label temp2 "Sensor on right bottom PCB" + ignore fan1 + + diff --git a/device/cameo/x86_64-cameo_esc601_32q-r0/topo.conf b/device/cameo/x86_64-cameo_esc601_32q-r0/topo.conf new file mode 100644 index 0000000000..795ea43143 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc601_32q-r0/topo.conf @@ -0,0 +1 @@ +t1 diff --git a/device/cameo/x86_64-cameo_esc602_32q-r0/default_sku b/device/cameo/x86_64-cameo_esc602_32q-r0/default_sku new file mode 100644 index 0000000000..8824c5d7c4 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc602_32q-r0/default_sku @@ -0,0 +1 @@ +esc602-32q t1 diff --git a/device/cameo/x86_64-cameo_esc602_32q-r0/esc602-32q/buffers.json.j2 b/device/cameo/x86_64-cameo_esc602_32q-r0/esc602-32q/buffers.json.j2 new file mode 100644 index 0000000000..6f9ed3c7f6 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc602_32q-r0/esc602-32q/buffers.json.j2 @@ -0,0 +1,137 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '40m' %} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) %} + {%- set cable_len = [] %} + {%- for local_port in DEVICE_NEIGHBOR %} + {%- if local_port == port_name %} + {%- if DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor_role = neighbor.type %} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role %} + {%- set roles1 = roles1 | lower %} + {%- set roles2 = roles2 | lower %} + {%- if roles1 in ports2cable %} + {%- if cable_len.append(ports2cable[roles1]) %}{% endif %} + {%- elif roles2 in ports2cable %} + {%- if cable_len.append(ports2cable[roles2]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else %} + {%- if switch_role.lower() == 'torrouter' %} + {%- for local_port in VLAN_MEMBER %} + {%- if local_port[1] == port_name %} + {%- set roles3 = switch_role + '_' + 'server' %} + {%- set roles3 = roles3 | lower %} + {%- if roles3 in ports2cable %} + {%- if cable_len.append(ports2cable[roles3]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- endif %} +{%- endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "34056960", + "type": "ingress", + "mode": "dynamic", + "xoff": "4185600" + }, + "lossy_pool": { + "size": "14595840", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xoff":"38816", + "size":"1518", + "dynamic_th":"1", + "xon_offset":"13440" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"23001600" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"0", + "static_th":"23001600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"1518", + "dynamic_th":"2" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/cameo/x86_64-cameo_esc602_32q-r0/esc602-32q/buffers_defaults_def_lossy.j2 b/device/cameo/x86_64-cameo_esc602_32q-r0/esc602-32q/buffers_defaults_def_lossy.j2 new file mode 100644 index 0000000000..72a618f07f --- /dev/null +++ b/device/cameo/x86_64-cameo_esc602_32q-r0/esc602-32q/buffers_defaults_def_lossy.j2 @@ -0,0 +1,38 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "BUFFER_POOL": { + "lossy_pool": { + "size": "46003200", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"0", + "static_th":"23001600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"1518", + "dynamic_th":"2" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-7": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|0-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/cameo/x86_64-cameo_esc602_32q-r0/esc602-32q/buffers_defaults_t1.j2 b/device/cameo/x86_64-cameo_esc602_32q-r0/esc602-32q/buffers_defaults_t1.j2 new file mode 100644 index 0000000000..6f9ed3c7f6 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc602_32q-r0/esc602-32q/buffers_defaults_t1.j2 @@ -0,0 +1,137 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '40m' %} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) %} + {%- set cable_len = [] %} + {%- for local_port in DEVICE_NEIGHBOR %} + {%- if local_port == port_name %} + {%- if DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor_role = neighbor.type %} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role %} + {%- set roles1 = roles1 | lower %} + {%- set roles2 = roles2 | lower %} + {%- if roles1 in ports2cable %} + {%- if cable_len.append(ports2cable[roles1]) %}{% endif %} + {%- elif roles2 in ports2cable %} + {%- if cable_len.append(ports2cable[roles2]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else %} + {%- if switch_role.lower() == 'torrouter' %} + {%- for local_port in VLAN_MEMBER %} + {%- if local_port[1] == port_name %} + {%- set roles3 = switch_role + '_' + 'server' %} + {%- set roles3 = roles3 | lower %} + {%- if roles3 in ports2cable %} + {%- if cable_len.append(ports2cable[roles3]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- endif %} +{%- endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "34056960", + "type": "ingress", + "mode": "dynamic", + "xoff": "4185600" + }, + "lossy_pool": { + "size": "14595840", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xoff":"38816", + "size":"1518", + "dynamic_th":"1", + "xon_offset":"13440" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"23001600" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"0", + "static_th":"23001600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"1518", + "dynamic_th":"2" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/cameo/x86_64-cameo_esc602_32q-r0/esc602-32q/config_32x100G_Cameo-esc602-32q.yaml b/device/cameo/x86_64-cameo_esc602_32q-r0/esc602-32q/config_32x100G_Cameo-esc602-32q.yaml new file mode 100644 index 0000000000..346c61d828 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc602_32q-r0/esc602-32q/config_32x100G_Cameo-esc602-32q.yaml @@ -0,0 +1,397 @@ +ifcs: + options: + log_level: "info" +nodes: +- node_id: "0" + options: + sku: "configs/sku/innovium.55300" + netdev: + - auto_create: "no" + multi_interface: "yes" + buffer_management_mode: "api_driven" + max_lossless_tc: "2" + skip_pll_check: "false" + ilpm_enable: "1" + forward_profile: "IFCS_FORWARD_PROFILE_ID_PROFILE_E" + mac_clk: "750" + sys_clk: "1300" + ifc_clk: "675" + txring: + - txring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "3" + desc_count: "1024" + prio: "1" + netdev: "true" + rxring: + - rxring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39" + - rxring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40" + - rxring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "2, 5, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35, 38, 41, 47" + - rxring_id: "3" + desc_count: "1024" + prio: "1" + queues: "42, 43, 44, 45, 46" + devports: + - id: "0" + sysport: "129" + type: "cpu" + - fec: "KRFEC" + id: "121" + lanes: "0:4" + serdes_group: "15" + speed: "100G" + sysport: "121" + type: "eth" + - fec: "KRFEC" + id: "125" + lanes: "4:4" + serdes_group: "15" + speed: "100G" + sysport: "125" + type: "eth" + - fec: "KRFEC" + id: "113" + lanes: "0:4" + serdes_group: "14" + speed: "100G" + sysport: "113" + type: "eth" + - fec: "KRFEC" + id: "117" + lanes: "4:4" + serdes_group: "14" + speed: "100G" + sysport: "117" + type: "eth" + - fec: "KRFEC" + id: "105" + lanes: "0:4" + serdes_group: "13" + speed: "100G" + sysport: "105" + type: "eth" + - fec: "KRFEC" + id: "109" + lanes: "4:4" + serdes_group: "13" + speed: "100G" + sysport: "109" + type: "eth" + - fec: "KRFEC" + id: "97" + lanes: "0:4" + serdes_group: "12" + speed: "100G" + sysport: "97" + type: "eth" + - fec: "KRFEC" + id: "101" + lanes: "4:4" + serdes_group: "12" + speed: "100G" + sysport: "101" + type: "eth" + - fec: "KRFEC" + id: "89" + lanes: "0:4" + serdes_group: "11" + speed: "100G" + sysport: "89" + type: "eth" + - fec: "KRFEC" + id: "93" + lanes: "4:4" + serdes_group: "11" + speed: "100G" + sysport: "93" + type: "eth" + - fec: "KRFEC" + id: "81" + lanes: "0:4" + serdes_group: "10" + speed: "100G" + sysport: "81" + type: "eth" + - fec: "KRFEC" + id: "85" + lanes: "4:4" + serdes_group: "10" + speed: "100G" + sysport: "85" + type: "eth" + - fec: "KRFEC" + id: "73" + lanes: "0:4" + serdes_group: "9" + speed: "100G" + sysport: "73" + type: "eth" + - fec: "KRFEC" + id: "77" + lanes: "4:4" + serdes_group: "9" + speed: "100G" + sysport: "77" + type: "eth" + - fec: "KRFEC" + id: "65" + lanes: "0:4" + serdes_group: "8" + speed: "100G" + sysport: "65" + type: "eth" + - fec: "KRFEC" + id: "69" + lanes: "4:4" + serdes_group: "8" + speed: "100G" + sysport: "69" + type: "eth" + - fec: "KRFEC" + id: "57" + lanes: "0:4" + serdes_group: "7" + speed: "100G" + sysport: "57" + type: "eth" + - fec: "KRFEC" + id: "61" + lanes: "4:4" + serdes_group: "7" + speed: "100G" + sysport: "61" + type: "eth" + - fec: "KRFEC" + id: "49" + lanes: "0:4" + serdes_group: "6" + speed: "100G" + sysport: "49" + type: "eth" + - fec: "KRFEC" + id: "53" + lanes: "4:4" + serdes_group: "6" + speed: "100G" + sysport: "53" + type: "eth" + - fec: "KRFEC" + id: "41" + lanes: "0:4" + serdes_group: "5" + speed: "100G" + sysport: "41" + type: "eth" + - fec: "KRFEC" + id: "45" + lanes: "4:4" + serdes_group: "5" + speed: "100G" + sysport: "45" + type: "eth" + - fec: "KRFEC" + id: "33" + lanes: "0:4" + serdes_group: "4" + speed: "100G" + sysport: "33" + type: "eth" + - fec: "KRFEC" + id: "37" + lanes: "4:4" + serdes_group: "4" + speed: "100G" + sysport: "37" + type: "eth" + - fec: "KRFEC" + id: "25" + lanes: "0:4" + serdes_group: "3" + speed: "100G" + sysport: "25" + type: "eth" + - fec: "KRFEC" + id: "29" + lanes: "4:4" + serdes_group: "3" + speed: "100G" + sysport: "29" + type: "eth" + - fec: "KRFEC" + id: "17" + lanes: "0:4" + serdes_group: "2" + speed: "100G" + sysport: "17" + type: "eth" + - fec: "KRFEC" + id: "21" + lanes: "4:4" + serdes_group: "2" + speed: "100G" + sysport: "21" + type: "eth" + - fec: "KRFEC" + id: "9" + lanes: "0:4" + serdes_group: "1" + speed: "100G" + sysport: "9" + type: "eth" + - fec: "KRFEC" + id: "13" + lanes: "4:4" + serdes_group: "1" + speed: "100G" + sysport: "13" + type: "eth" + - fec: "KRFEC" + id: "1" + lanes: "0:4" + serdes_group: "0" + speed: "100G" + sysport: "1" + type: "eth" + - fec: "KRFEC" + id: "5" + lanes: "4:4" + serdes_group: "0" + speed: "100G" + sysport: "5" + type: "eth" +# Aux ports to be enabled later +# - id: "33" +# fec: "NONE" +# lanes: "0:1" +# serdes_group: "16" +# speed: "10G" +# sysport: "33" +# type: "mgmt 0" +# - id: "34" +# fec: "NONE" +# lanes: "1:1" +# serdes_group: "16" +# speed: "10G" +# sysport: "34" +# type: "mgmt 1" + isg: + - id: "0" + tx_polarity: "00001010" + rx_polarity: "01001001" + lane_swap: "46750132" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "1" + tx_polarity: "00011111" + rx_polarity: "01101001" + lane_swap: "46752130" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "2" + tx_polarity: "00101000" + rx_polarity: "11110111" + lane_swap: "57462301" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "3" + tx_polarity: "00111101" + rx_polarity: "00101101" + lane_swap: "67542301" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "4" + tx_polarity: "01110110" + rx_polarity: "01111101" + lane_swap: "76543021" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "5" + tx_polarity: "00100100" + rx_polarity: "01101010" + lane_swap: "76542103" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "6" + tx_polarity: "11000011" + rx_polarity: "11110101" + lane_swap: "45672013" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "7" + tx_polarity: "10011101" + rx_polarity: "11111010" + lane_swap: "74562103" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "8" + tx_polarity: "01001000" + rx_polarity: "00100011" + lane_swap: "54672301" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "9" + tx_polarity: "11111111" + rx_polarity: "01110111" + lane_swap: "46750321" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "10" + tx_polarity: "10011110" + rx_polarity: "10110000" + lane_swap: "67542310" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "11" + tx_polarity: "01010010" + rx_polarity: "10101011" + lane_swap: "65741302" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "12" + tx_polarity: "11010110" + rx_polarity: "01101001" + lane_swap: "45760321" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "13" + tx_polarity: "01110111" + rx_polarity: "00101000" + lane_swap: "45670123" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "14" + tx_polarity: "11110110" + rx_polarity: "10111100" + lane_swap: "67542013" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "15" + tx_polarity: "01011011" + rx_polarity: "01101000" + lane_swap: "64572103" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + + diff --git a/device/cameo/x86_64-cameo_esc602_32q-r0/esc602-32q/innovium.55300 b/device/cameo/x86_64-cameo_esc602_32q-r0/esc602-32q/innovium.55300 new file mode 100644 index 0000000000..59383ec30e --- /dev/null +++ b/device/cameo/x86_64-cameo_esc602_32q-r0/esc602-32q/innovium.55300 @@ -0,0 +1,62 @@ +sku: innovium.55300 + +device_id: 0x1b59 + +# Hardware constraint information +hardware: + num_ibs: 2 + ib_active: 0, 1 + + ports_per_ib: 64, 64 + recirc_port_num: 64, 64 + cpu_port_num: 65 + cpu_port_ib: 0 + mgmt_port_num: 65, 66 + mgmt_port_ibs: 1, 1 + + pics_per_ib: 9, 9 + pic_ports_per_pic: 8 + max_serdes_speed: 25 + + num_shared_pics: 0 + + isg [0-7]: + ib: 0 + pic_id: [0-7] + + isg 8: + ib: 1 + pic_id: 7 + + isg 9: + ib: 1 + pic_id: 6 + + isg 10: + ib: 1 + pic_id: 5 + + isg 11: + ib: 1 + pic_id: 4 + + isg 12: + ib: 1 + pic_id: 3 + + isg 13: + ib: 1 + pic_id: 2 + + isg 14: + ib: 1 + pic_id: 1 + + isg 15: + ib: 1 + pic_id: 0 + + isg 16: + mode: 0:2 + ib: 1 + pic_id: 8 diff --git a/device/cameo/x86_64-cameo_esc602_32q-r0/esc602-32q/ivm.sai.config.yaml b/device/cameo/x86_64-cameo_esc602_32q-r0/esc602-32q/ivm.sai.config.yaml new file mode 100644 index 0000000000..685578a878 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc602_32q-r0/esc602-32q/ivm.sai.config.yaml @@ -0,0 +1,8 @@ +IFCS_INIT_FILE : "/usr/share/sonic/hwsku/config_32x100G_Cameo-esc602-32q.yaml" +IFCS_SKU_FILE : "/usr/share/sonic/hwsku/innovium.55300" +IFCS_INNO_CLI_PORT : "9999" +IFCS_TARGET : "device" +INNOVIUM_DIR : "/innovium" +PYTHONPATH : "$INNOVIUM_DIR:$INNOVIUM_DIR/cmds:$INNOVIUM_DIR/scripts:$INNOVIUM_DIR/test/:$INNOVIUM_DIR/test/utils:$INNOVIUM_DIR/utils:$INNOVIUM_DIR/pyctypes" +IVM_SAI_DATAPATH_CONFIG_FILE: "/usr/share/sonic/hwsku/ivm.sai.datapath.config.yaml" +IVM_SAI_PARAM_A0008: "64" diff --git a/device/cameo/x86_64-cameo_esc602_32q-r0/esc602-32q/ivm.sai.datapath.config.yaml b/device/cameo/x86_64-cameo_esc602_32q-r0/esc602-32q/ivm.sai.datapath.config.yaml new file mode 100644 index 0000000000..ef4bc6d129 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc602_32q-r0/esc602-32q/ivm.sai.datapath.config.yaml @@ -0,0 +1,9 @@ +ISAI_PARAM_P0_0_LS : "9216 9216" +ISAI_PARAM_P0_1_LS : "2850 2650" +ISAI_PARAM_P0_1_ALS : "290 90" +ISAI_PARAM_P1_0_LS : "3072 3072" +ISAI_PARAM_P1_0_LL : "6144 6144" +ISAI_PARAM_P1_1_LS : "2210 2010" +ISAI_PARAM_P1_1_LL : "1330 1330" +ISAI_PARAM_P1_1_ALS : "290 90" +ISAI_PARAM_P1_1_ALL : "50 50" diff --git a/device/cameo/x86_64-cameo_esc602_32q-r0/esc602-32q/pg_profile_lookup.ini b/device/cameo/x86_64-cameo_esc602_32q-r0/esc602-32q/pg_profile_lookup.ini new file mode 100644 index 0000000000..adcb52ab2a --- /dev/null +++ b/device/cameo/x86_64-cameo_esc602_32q-r0/esc602-32q/pg_profile_lookup.ini @@ -0,0 +1,18 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 25000 5m 1518 0 15680 1 13440 + 50000 5m 1518 0 21248 1 13440 + 100000 5m 1518 0 34624 1 13440 + 400000 5m 1518 0 117536 1 13440 + 25000 40m 1518 0 16928 1 13440 + 50000 40m 1518 0 23392 1 13440 + 100000 40m 1518 0 38816 1 13440 + 400000 40m 1518 0 135520 1 13440 + 25000 100m 1518 0 18848 1 13440 + 50000 100m 1518 0 27264 1 13440 + 100000 100m 1518 0 46496 1 13440 + 400000 100m 1518 0 166688 1 13440 + 25000 300m 1518 0 25184 1 13440 + 50000 300m 1518 0 40128 1 13440 + 100000 300m 1518 0 72384 1 13440 + 400000 300m 1518 0 268640 1 13440 diff --git a/device/cameo/x86_64-cameo_esc602_32q-r0/esc602-32q/port_config.ini b/device/cameo/x86_64-cameo_esc602_32q-r0/esc602-32q/port_config.ini new file mode 100644 index 0000000000..7cb58b4120 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc602_32q-r0/esc602-32q/port_config.ini @@ -0,0 +1,33 @@ +# name lanes speed index mtu fec +Ethernet0 121,122,123,124 100000 0 9126 rs +Ethernet4 125,126,127,128 100000 1 9126 rs +Ethernet8 113,114,115,116 100000 2 9126 rs +Ethernet12 117,118,119,120 100000 3 9126 rs +Ethernet16 105,106,107,108 100000 4 9126 rs +Ethernet20 109,110,111,112 100000 5 9126 rs +Ethernet24 97,98,99,100 100000 6 9126 rs +Ethernet28 101,102,103,104 100000 7 9126 rs +Ethernet32 89,90,91,92 100000 8 9126 rs +Ethernet36 93,94,95,96 100000 9 9126 rs +Ethernet40 81,82,83,84 100000 10 9126 rs +Ethernet44 85,86,87,88 100000 11 9126 rs +Ethernet48 73,74,75,76 100000 12 9126 rs +Ethernet52 77,78,79,80 100000 13 9126 rs +Ethernet56 65,66,67,68 100000 14 9126 rs +Ethernet60 69,70,71,72 100000 15 9126 rs +Ethernet64 57,58,59,60 100000 16 9126 rs +Ethernet68 61,62,63,64 100000 17 9126 rs +Ethernet72 49,50,51,52 100000 18 9126 rs +Ethernet76 53,54,55,56 100000 19 9126 rs +Ethernet80 41,42,43,44 100000 20 9126 rs +Ethernet84 45,46,47,48 100000 21 9126 rs +Ethernet88 33,34,35,36 100000 22 9126 rs +Ethernet92 37,38,39,40 100000 23 9126 rs +Ethernet96 25,26,27,28 100000 24 9126 rs +Ethernet100 29,30,31,32 100000 25 9126 rs +Ethernet104 17,18,19,20 100000 26 9126 rs +Ethernet108 21,22,23,24 100000 27 9126 rs +Ethernet112 9,10,11,12 100000 28 9126 rs +Ethernet116 13,14,15,16 100000 29 9126 rs +Ethernet120 1,2,3,4 100000 30 9126 rs +Ethernet124 5,6,7,8 100000 31 9126 rs diff --git a/device/cameo/x86_64-cameo_esc602_32q-r0/esc602-32q/qos.json.j2 b/device/cameo/x86_64-cameo_esc602_32q-r0/esc602-32q/qos.json.j2 new file mode 100644 index 0000000000..4b9748c7b5 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc602_32q-r0/esc602-32q/qos.json.j2 @@ -0,0 +1,114 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "0":"0", + "1":"1", + "2":"2", + "3":"3", + "4":"4", + "5":"5", + "6":"6", + "7":"7" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "red_min_threshold":"50000" + } + } +} diff --git a/device/cameo/x86_64-cameo_esc602_32q-r0/esc602-32q/qos_defaults_def_lossy.j2 b/device/cameo/x86_64-cameo_esc602_32q-r0/esc602-32q/qos_defaults_def_lossy.j2 new file mode 100644 index 0000000000..104d2d78de --- /dev/null +++ b/device/cameo/x86_64-cameo_esc602_32q-r0/esc602-32q/qos_defaults_def_lossy.j2 @@ -0,0 +1,118 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "0":"0", + "1":"1", + "2":"2", + "3":"3", + "4":"4", + "5":"5", + "6":"6", + "7":"7" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"0", + "4":"0", + "5":"0", + "6":"0", + "7":"0", + "8":"0", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]" + } + }, + "SCHEDULER": { + "scheduler.7": { + "type": "STRICT" + } + }, + "QUEUE": { + "{{ port_names }}|7": { + "scheduler": "[SCHEDULER|scheduler.7]" + } + } +} diff --git a/device/cameo/x86_64-cameo_esc602_32q-r0/esc602-32q/qos_defaults_t1.j2 b/device/cameo/x86_64-cameo_esc602_32q-r0/esc602-32q/qos_defaults_t1.j2 new file mode 100644 index 0000000000..4b9748c7b5 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc602_32q-r0/esc602-32q/qos_defaults_t1.j2 @@ -0,0 +1,114 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "0":"0", + "1":"1", + "2":"2", + "3":"3", + "4":"4", + "5":"5", + "6":"6", + "7":"7" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "red_min_threshold":"50000" + } + } +} diff --git a/device/cameo/x86_64-cameo_esc602_32q-r0/esc602-32q/sai.profile b/device/cameo/x86_64-cameo_esc602_32q-r0/esc602-32q/sai.profile new file mode 100644 index 0000000000..aba4fc81fb --- /dev/null +++ b/device/cameo/x86_64-cameo_esc602_32q-r0/esc602-32q/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/ivm.sai.config.yaml diff --git a/device/cameo/x86_64-cameo_esc602_32q-r0/installer.conf b/device/cameo/x86_64-cameo_esc602_32q-r0/installer.conf new file mode 100644 index 0000000000..925a32fc0c --- /dev/null +++ b/device/cameo/x86_64-cameo_esc602_32q-r0/installer.conf @@ -0,0 +1,3 @@ +CONSOLE_PORT=0x3f8 +CONSOLE_DEV=0 +CONSOLE_SPEED=115200 diff --git a/device/cameo/x86_64-cameo_esc602_32q-r0/platform_reboot b/device/cameo/x86_64-cameo_esc602_32q-r0/platform_reboot new file mode 100755 index 0000000000..07a68d4f6f --- /dev/null +++ b/device/cameo/x86_64-cameo_esc602_32q-r0/platform_reboot @@ -0,0 +1,16 @@ +#!/bin/sh + +mr_reboot() { + + sudo rmmod x86-64-cameo-esc602-32q + sudo i2cset -y 0 0x30 0xa1 0 + +} + +if [ $# -eq 0 ] || [ $@ = "-f" ] || [ $@ = "--force" ] || [ $@ = "reboot" ]; then + mr_reboot +elif [ $@ = "-p" ] ; then + sudo halt +else + echo "unsupported option" +fi diff --git a/device/cameo/x86_64-cameo_esc602_32q-r0/plugins/eeprom.py b/device/cameo/x86_64-cameo_esc602_32q-r0/plugins/eeprom.py new file mode 100755 index 0000000000..f0f19ba393 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc602_32q-r0/plugins/eeprom.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python + +try: + from sonic_eeprom import eeprom_tlvinfo +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +class board(eeprom_tlvinfo.TlvInfoDecoder): + _TLV_INFO_MAX_LEN = 256 + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/bus/i2c/devices/0-0056/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/cameo/x86_64-cameo_esc602_32q-r0/plugins/psuutil.py b/device/cameo/x86_64-cameo_esc602_32q-r0/plugins/psuutil.py new file mode 100755 index 0000000000..6c2f35565b --- /dev/null +++ b/device/cameo/x86_64-cameo_esc602_32q-r0/plugins/psuutil.py @@ -0,0 +1,95 @@ +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +attr_path = '/sys/class/hwmon/hwmon2/device/ESC602_POWER/' + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + + # Get sysfs attribute + def get_attr_value(self, path): + + retval = 'ERR' + if (not os.path.isfile(path)): + return retval + + try: + with open(path, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", path, " file !") + + retval = retval.rstrip('\r\n') + return retval + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + :return: An integer, the number of PSUs available on the device + """ + MAX_PSUS = 2 + return MAX_PSUS + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is\ + faulty + """ + status = 0 + attr_file = 'psu{}_good'.format(index) + status_path = attr_path + attr_file + try: + reg_file = open(status_path, 'r') + except IOError as e: + print( "Error: unable to open file: %s" % str(e)) + return False + text = reg_file.read() + + if int(text) == 1: + status = 1 + + reg_file.close() + + return status + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + status = 0 + attr_file ='psu{}_prnt'.format(index) + presence_path = attr_path + attr_file + try: + reg_file = open(presence_path, 'r') + except IOError as e: + print( "Error: unable to open file: %s" % str(e)) + return False + text = reg_file.read() + + if int(text) == 1: + status = 1 + + reg_file.close() + + return status + diff --git a/device/cameo/x86_64-cameo_esc602_32q-r0/plugins/sfputil.py b/device/cameo/x86_64-cameo_esc602_32q-r0/plugins/sfputil.py new file mode 100755 index 0000000000..4719155efc --- /dev/null +++ b/device/cameo/x86_64-cameo_esc602_32q-r0/plugins/sfputil.py @@ -0,0 +1,166 @@ +#!/usr/bin/env python + +try: + import time + import json + from sonic_sfp.sfputilbase import SfpUtilBase +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +attr_path = '/sys/class/hwmon/hwmon2/device/' +PLATFORM_INSTALL_INFO_FILE="/etc/sonic/platform_install.json" +PLATFORM_SFP_GROUPS = ['SFP-G01','SFP-G02','SFP-G03','SFP-G04'] + +QSFP_RESET_FILE = 'ESC602_QSFP/qsfp{}_reset' +QSFP_LOWPOWER_FILE = 'ESC602_QSFP/qsfp{}_low_power' +QSFP_PRESENT_FILE = 'ESC602_QSFP/qsfp{}_present' + +class SfpUtil(SfpUtilBase): + """Platform specific SfpUtill class""" + + _port_start = 0 + _port_end = 31 + _port_in_block =32 + _port_to_eeprom_mapping = {} + _global_port_pres_dict = {} + + def __init__(self): + eeprom_path = "{}/eeprom" + path_list = self.get_sfp_path() + for x in range(self._port_start, self._port_end + 1): + port_eeprom_path = eeprom_path.format(path_list[x]) + self._port_to_eeprom_mapping[x] = port_eeprom_path + + self.init_global_port_presence() + SfpUtilBase.__init__(self) + + def get_sfp_path(self): + map = [] + with open(PLATFORM_INSTALL_INFO_FILE) as fd: + install_info = json.load(fd) + for sfp_group_name in PLATFORM_SFP_GROUPS: + sfp_group = install_info[2][sfp_group_name] + map = map + sfp_group['paths'] + return map + + def reset(self, port_num): + # Check for invalid port_num + if port_num < self._port_start or port_num > self._port_end: + return False + + path = attr_path+QSFP_RESET_FILE.format(port_num+1) + try: + reg_file = open(path, 'w') + except IOError as e: + print( "Error: unable to open file: %s" % str(e)) + return False + + reg_file.seek(0) + reg_file.write('1') + + reg_file.close() + return True + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + path = attr_path+QSFP_LOWPOWER_FILE.format(port_num+1) + try: + reg_file = open(path, 'w') + except IOError as e: + print( "Error: unable to open file: %s" % str(e)) + return False + + # the gpio pin is ACTIVE_HIGH + if lpmode is True: + val = "1" + else: + val = "0" + + # write value to gpio + reg_file.seek(0) + reg_file.write(val) + reg_file.close() + + return True + + def get_low_power_mode(self, port_num): + # Check for invalid port_num + if port_num < self._port_start or port_num > self._port_end: + return False + + path = attr_path+QSFP_LOWPOWER_FILE.format(port_num+1) + try: + reg_file = open(path, 'r') + except IOError as e: + print( "Error: unable to open file: %s" % str(e)) + return False + + text = reg_file.read() + reg_file.close() + if int(text) == 1: + return True + + return False + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self._port_start or port_num > self._port_end: + return False + + path = attr_path+QSFP_PRESENT_FILE.format(port_num+1) + try: + reg_file = open(path, 'r') + except IOError as e: + print( "Error: unable to open file: %s" % str(e)) + return False + text = reg_file.read() + reg_file.close() + if int(text) == 1: + return True + + return False + + def init_global_port_presence(self): + for port_num in range(self.port_start, (self.port_end + 1)): + presence = self.get_presence(port_num) + if(presence): + self._global_port_pres_dict[port_num] = '1' + else: + self._global_port_pres_dict[port_num] = '0' + + def get_transceiver_change_event(self, timeout=0): + port_dict = {} + while True: + for port_num in range(self.port_start, (self.port_end + 1)): + presence = self.get_presence(port_num) + if(presence and self._global_port_pres_dict[port_num] == '0'): + self._global_port_pres_dict[port_num] = '1' + port_dict[port_num] = '1' + elif(not presence and + self._global_port_pres_dict[port_num] == '1'): + self._global_port_pres_dict[port_num] = '0' + port_dict[port_num] = '0' + + if(len(port_dict) > 0): + return True, port_dict + + time.sleep(1) + + @property + def port_start(self): + return self._port_start + + @property + def port_end(self): + return self._port_end + + @property + def qsfp_ports(self): + return range(0, self._port_in_block + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping diff --git a/device/cameo/x86_64-cameo_esc602_32q-r0/pmon_daemon_control.json b/device/cameo/x86_64-cameo_esc602_32q-r0/pmon_daemon_control.json new file mode 100644 index 0000000000..44871c057e --- /dev/null +++ b/device/cameo/x86_64-cameo_esc602_32q-r0/pmon_daemon_control.json @@ -0,0 +1,4 @@ +{ + "skip_ledd": true, + "skip_thermalctld": true +} diff --git a/device/cameo/x86_64-cameo_esc602_32q-r0/sensors.conf b/device/cameo/x86_64-cameo_esc602_32q-r0/sensors.conf new file mode 100644 index 0000000000..b28b04f643 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc602_32q-r0/sensors.conf @@ -0,0 +1,3 @@ + + + diff --git a/device/cameo/x86_64-cameo_esc602_32q-r0/topo.conf b/device/cameo/x86_64-cameo_esc602_32q-r0/topo.conf new file mode 100644 index 0000000000..795ea43143 --- /dev/null +++ b/device/cameo/x86_64-cameo_esc602_32q-r0/topo.conf @@ -0,0 +1 @@ +t1 diff --git a/device/cameo/x86_64-cameo_esqc610_56sq-r0/default_sku b/device/cameo/x86_64-cameo_esqc610_56sq-r0/default_sku new file mode 100644 index 0000000000..b07f8e4ed9 --- /dev/null +++ b/device/cameo/x86_64-cameo_esqc610_56sq-r0/default_sku @@ -0,0 +1 @@ +esqc610-56sq t1 diff --git a/device/cameo/x86_64-cameo_esqc610_56sq-r0/esqc610-56sq/buffers.json.j2 b/device/cameo/x86_64-cameo_esqc610_56sq-r0/esqc610-56sq/buffers.json.j2 new file mode 100644 index 0000000000..6f9ed3c7f6 --- /dev/null +++ b/device/cameo/x86_64-cameo_esqc610_56sq-r0/esqc610-56sq/buffers.json.j2 @@ -0,0 +1,137 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '40m' %} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) %} + {%- set cable_len = [] %} + {%- for local_port in DEVICE_NEIGHBOR %} + {%- if local_port == port_name %} + {%- if DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor_role = neighbor.type %} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role %} + {%- set roles1 = roles1 | lower %} + {%- set roles2 = roles2 | lower %} + {%- if roles1 in ports2cable %} + {%- if cable_len.append(ports2cable[roles1]) %}{% endif %} + {%- elif roles2 in ports2cable %} + {%- if cable_len.append(ports2cable[roles2]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else %} + {%- if switch_role.lower() == 'torrouter' %} + {%- for local_port in VLAN_MEMBER %} + {%- if local_port[1] == port_name %} + {%- set roles3 = switch_role + '_' + 'server' %} + {%- set roles3 = roles3 | lower %} + {%- if roles3 in ports2cable %} + {%- if cable_len.append(ports2cable[roles3]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- endif %} +{%- endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "34056960", + "type": "ingress", + "mode": "dynamic", + "xoff": "4185600" + }, + "lossy_pool": { + "size": "14595840", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xoff":"38816", + "size":"1518", + "dynamic_th":"1", + "xon_offset":"13440" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"23001600" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"0", + "static_th":"23001600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"1518", + "dynamic_th":"2" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/cameo/x86_64-cameo_esqc610_56sq-r0/esqc610-56sq/buffers_defaults_def_lossy.j2 b/device/cameo/x86_64-cameo_esqc610_56sq-r0/esqc610-56sq/buffers_defaults_def_lossy.j2 new file mode 100644 index 0000000000..72a618f07f --- /dev/null +++ b/device/cameo/x86_64-cameo_esqc610_56sq-r0/esqc610-56sq/buffers_defaults_def_lossy.j2 @@ -0,0 +1,38 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "BUFFER_POOL": { + "lossy_pool": { + "size": "46003200", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"0", + "static_th":"23001600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"1518", + "dynamic_th":"2" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-7": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|0-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/cameo/x86_64-cameo_esqc610_56sq-r0/esqc610-56sq/buffers_defaults_t1.j2 b/device/cameo/x86_64-cameo_esqc610_56sq-r0/esqc610-56sq/buffers_defaults_t1.j2 new file mode 100644 index 0000000000..6f9ed3c7f6 --- /dev/null +++ b/device/cameo/x86_64-cameo_esqc610_56sq-r0/esqc610-56sq/buffers_defaults_t1.j2 @@ -0,0 +1,137 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '40m' %} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) %} + {%- set cable_len = [] %} + {%- for local_port in DEVICE_NEIGHBOR %} + {%- if local_port == port_name %} + {%- if DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor_role = neighbor.type %} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role %} + {%- set roles1 = roles1 | lower %} + {%- set roles2 = roles2 | lower %} + {%- if roles1 in ports2cable %} + {%- if cable_len.append(ports2cable[roles1]) %}{% endif %} + {%- elif roles2 in ports2cable %} + {%- if cable_len.append(ports2cable[roles2]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else %} + {%- if switch_role.lower() == 'torrouter' %} + {%- for local_port in VLAN_MEMBER %} + {%- if local_port[1] == port_name %} + {%- set roles3 = switch_role + '_' + 'server' %} + {%- set roles3 = roles3 | lower %} + {%- if roles3 in ports2cable %} + {%- if cable_len.append(ports2cable[roles3]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- endif %} +{%- endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "34056960", + "type": "ingress", + "mode": "dynamic", + "xoff": "4185600" + }, + "lossy_pool": { + "size": "14595840", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xoff":"38816", + "size":"1518", + "dynamic_th":"1", + "xon_offset":"13440" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"23001600" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"0", + "static_th":"23001600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"1518", + "dynamic_th":"2" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/cameo/x86_64-cameo_esqc610_56sq-r0/esqc610-56sq/config_48x25G_8x100G_Cameo-esqc610-56sq.yaml b/device/cameo/x86_64-cameo_esqc610_56sq-r0/esqc610-56sq/config_48x25G_8x100G_Cameo-esqc610-56sq.yaml new file mode 100644 index 0000000000..1a8f583364 --- /dev/null +++ b/device/cameo/x86_64-cameo_esqc610_56sq-r0/esqc610-56sq/config_48x25G_8x100G_Cameo-esqc610-56sq.yaml @@ -0,0 +1,563 @@ +ifcs: + options: + log_level: "info" +nodes: +- node_id: "0" + options: + sku: "configs/sku/innovium.55200" + netdev: + - auto_create: "no" + multi_interface: "yes" + buffer_management_mode: "api_driven" + max_lossless_tc: "2" + skip_pll_check: "false" + ilpm_enable: "1" + forward_profile: "IFCS_FORWARD_PROFILE_ID_PROFILE_E" + mac_clk: "750" + sys_clk: "975" + ifc_clk: "525" + txring: + - txring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "3" + desc_count: "1024" + prio: "1" + netdev: "true" + rxring: + - rxring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39" + - rxring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40" + - rxring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "2, 5, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35, 38, 41, 47" + - rxring_id: "3" + desc_count: "1024" + prio: "1" + queues: "42, 43, 44, 45, 46" + devports: + - id: "0" + sysport: "129" + type: "cpu" + - id: "113" + fec: "KRFEC" + lanes: "0:1" + serdes_group: "14" + speed: "25G" + sysport: "113" + type: "eth" + - id: "114" + fec: "KRFEC" + lanes: "1:1" + serdes_group: "14" + speed: "25G" + sysport: "114" + type: "eth" + - id: "115" + fec: "KRFEC" + lanes: "2:1" + serdes_group: "14" + speed: "25G" + sysport: "115" + type: "eth" + - id: "116" + fec: "KRFEC" + lanes: "3:1" + serdes_group: "14" + speed: "25G" + sysport: "116" + type: "eth" + - id: "117" + fec: "KRFEC" + lanes: "4:1" + serdes_group: "14" + speed: "25G" + sysport: "117" + type: "eth" + - id: "105" + fec: "KRFEC" + lanes: "0:1" + serdes_group: "13" + speed: "25G" + sysport: "105" + type: "eth" + - id: "106" + fec: "KRFEC" + lanes: "1:1" + serdes_group: "13" + speed: "25G" + sysport: "106" + type: "eth" + - id: "107" + fec: "KRFEC" + lanes: "2:1" + serdes_group: "13" + speed: "25G" + sysport: "107" + type: "eth" + - id: "108" + fec: "KRFEC" + lanes: "3:1" + serdes_group: "13" + speed: "25G" + sysport: "108" + type: "eth" + - id: "109" + fec: "KRFEC" + lanes: "4:1" + serdes_group: "13" + speed: "25G" + sysport: "109" + type: "eth" + - id: "110" + fec: "KRFEC" + lanes: "5:1" + serdes_group: "13" + speed: "25G" + sysport: "110" + type: "eth" + - id: "111" + fec: "KRFEC" + lanes: "6:1" + serdes_group: "13" + speed: "25G" + sysport: "111" + type: "eth" + - id: "112" + fec: "KRFEC" + lanes: "7:1" + serdes_group: "13" + speed: "25G" + sysport: "112" + type: "eth" + - id: "89" + fec: "KRFEC" + lanes: "0:1" + serdes_group: "11" + speed: "25G" + sysport: "89" + type: "eth" + - id: "90" + fec: "KRFEC" + lanes: "1:1" + serdes_group: "11" + speed: "25G" + sysport: "90" + type: "eth" + - id: "91" + fec: "KRFEC" + lanes: "2:1" + serdes_group: "11" + speed: "25G" + sysport: "91" + type: "eth" + - id: "92" + fec: "KRFEC" + lanes: "3:1" + serdes_group: "11" + speed: "25G" + sysport: "92" + type: "eth" + - id: "93" + fec: "KRFEC" + lanes: "4:1" + serdes_group: "11" + speed: "25G" + sysport: "93" + type: "eth" + - id: "94" + fec: "KRFEC" + lanes: "5:1" + serdes_group: "11" + speed: "25G" + sysport: "94" + type: "eth" + - id: "95" + fec: "KRFEC" + lanes: "6:1" + serdes_group: "11" + speed: "25G" + sysport: "95" + type: "eth" + - id: "96" + fec: "KRFEC" + lanes: "7:1" + serdes_group: "11" + speed: "25G" + sysport: "96" + type: "eth" + - id: "118" + fec: "KRFEC" + lanes: "5:1" + serdes_group: "14" + speed: "25G" + sysport: "118" + type: "eth" + - id: "119" + fec: "KRFEC" + lanes: "6:1" + serdes_group: "14" + speed: "25G" + sysport: "119" + type: "eth" + - id: "120" + fec: "KRFEC" + lanes: "7:1" + serdes_group: "14" + speed: "25G" + sysport: "120" + type: "eth" + - id: "41" + fec: "KRFEC" + lanes: "0:1" + serdes_group: "5" + speed: "25G" + sysport: "41" + type: "eth" + - id: "42" + fec: "KRFEC" + lanes: "1:1" + serdes_group: "5" + speed: "25G" + sysport: "42" + type: "eth" + - id: "43" + fec: "KRFEC" + lanes: "2:1" + serdes_group: "5" + speed: "25G" + sysport: "43" + type: "eth" + - id: "44" + fec: "KRFEC" + lanes: "3:1" + serdes_group: "5" + speed: "25G" + sysport: "44" + type: "eth" + - id: "45" + fec: "KRFEC" + lanes: "4:1" + serdes_group: "5" + speed: "25G" + sysport: "45" + type: "eth" + - id: "46" + fec: "KRFEC" + lanes: "5:1" + serdes_group: "5" + speed: "25G" + sysport: "46" + type: "eth" + - id: "47" + fec: "KRFEC" + lanes: "6:1" + serdes_group: "5" + speed: "25G" + sysport: "47" + type: "eth" + - id: "48" + fec: "KRFEC" + lanes: "7:1" + serdes_group: "5" + speed: "25G" + sysport: "48" + type: "eth" + - id: "25" + fec: "KRFEC" + lanes: "0:1" + serdes_group: "3" + speed: "25G" + sysport: "25" + type: "eth" + - id: "26" + fec: "KRFEC" + lanes: "1:1" + serdes_group: "3" + speed: "25G" + sysport: "26" + type: "eth" + - id: "27" + fec: "KRFEC" + lanes: "2:1" + serdes_group: "3" + speed: "25G" + sysport: "27" + type: "eth" + - id: "28" + fec: "KRFEC" + lanes: "3:1" + serdes_group: "3" + speed: "25G" + sysport: "28" + type: "eth" + - id: "29" + fec: "KRFEC" + lanes: "4:1" + serdes_group: "3" + speed: "25G" + sysport: "29" + type: "eth" + - id: "30" + fec: "KRFEC" + lanes: "5:1" + serdes_group: "3" + speed: "25G" + sysport: "30" + type: "eth" + - id: "31" + fec: "KRFEC" + lanes: "6:1" + serdes_group: "3" + speed: "25G" + sysport: "31" + type: "eth" + - id: "32" + fec: "KRFEC" + lanes: "7:1" + serdes_group: "3" + speed: "25G" + sysport: "32" + type: "eth" + - id: "17" + fec: "KRFEC" + lanes: "0:1" + serdes_group: "2" + speed: "25G" + sysport: "17" + type: "eth" + - id: "18" + fec: "KRFEC" + lanes: "1:1" + serdes_group: "2" + speed: "25G" + sysport: "18" + type: "eth" + - id: "19" + fec: "KRFEC" + lanes: "2:1" + serdes_group: "2" + speed: "25G" + sysport: "19" + type: "eth" + - id: "20" + fec: "KRFEC" + lanes: "3:1" + serdes_group: "2" + speed: "25G" + sysport: "20" + type: "eth" + - id: "21" + fec: "KRFEC" + lanes: "4:1" + serdes_group: "2" + speed: "25G" + sysport: "21" + type: "eth" + - id: "22" + fec: "KRFEC" + lanes: "5:1" + serdes_group: "2" + speed: "25G" + sysport: "22" + type: "eth" + - id: "23" + fec: "KRFEC" + lanes: "6:1" + serdes_group: "2" + speed: "25G" + sysport: "23" + type: "eth" + - id: "24" + fec: "KRFEC" + lanes: "7:1" + serdes_group: "2" + speed: "25G" + sysport: "24" + type: "eth" + - id: "73" + fec: "KRFEC" + lanes: "0:4" + serdes_group: "9" + speed: "100G" + sysport: "73" + type: "eth" + - id: "77" + fec: "KRFEC" + lanes: "4:4" + serdes_group: "9" + speed: "100G" + sysport: "77" + type: "eth" + - id: "65" + fec: "KRFEC" + lanes: "0:4" + serdes_group: "8" + speed: "100G" + sysport: "65" + type: "eth" + - id: "69" + fec: "KRFEC" + lanes: "4:4" + serdes_group: "8" + speed: "100G" + sysport: "69" + type: "eth" + - id: "9" + fec: "KRFEC" + lanes: "0:4" + serdes_group: "1" + speed: "100G" + sysport: "9" + type: "eth" + - id: "13" + fec: "KRFEC" + lanes: "4:4" + serdes_group: "1" + speed: "100G" + sysport: "13" + type: "eth" + - id: "1" + fec: "KRFEC" + lanes: "0:4" + serdes_group: "0" + speed: "100G" + sysport: "1" + type: "eth" + - id: "5" + fec: "KRFEC" + lanes: "4:4" + serdes_group: "0" + speed: "100G" + sysport: "5" + type: "eth" +# Aux ports to be enabled later +# - id: "33" +# fec: "NONE" +# lanes: "0:1" +# serdes_group: "16" +# speed: "10G" +# sysport: "33" +# type: "mgmt 0" +# - id: "34" +# fec: "NONE" +# lanes: "1:1" +# serdes_group: "16" +# speed: "10G" +# sysport: "34" +# type: "mgmt 1" + isg: + - id: "0" + lane_swap: "10325674" + rx_polarity: "00000110" + tx_polarity: "00010001" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "1" + lane_swap: "12305476" + rx_polarity: "01111110" + tx_polarity: "10111101" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "2" + lane_swap: "20416375" + rx_polarity: "00101011" + tx_polarity: "01100011" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "3" + lane_swap: "01234576" + rx_polarity: "01010111" + tx_polarity: "10001110" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "4" + lane_swap: "01234567" + rx_polarity: "00000000" + tx_polarity: "10100000" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "5" + lane_swap: "13250467" + rx_polarity: "10100110" + tx_polarity: "10101001" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "6" + lane_swap: "01234567" + rx_polarity: "00000000" + tx_polarity: "10100000" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "7" + lane_swap: "01234567" + rx_polarity: "00000000" + tx_polarity: "10100000" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "8" + lane_swap: "03214576" + rx_polarity: "01110010" + tx_polarity: "01101010" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "9" + lane_swap: "30217456" + rx_polarity: "00000111" + tx_polarity: "01010001" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "10" + lane_swap: "01234567" + rx_polarity: "00000000" + tx_polarity: "10100000" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "11" + lane_swap: "76543201" + rx_polarity: "10010100" + tx_polarity: "11010010" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "12" + lane_swap: "01234567" + rx_polarity: "00000000" + tx_polarity: "10100000" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "13" + lane_swap: "75614320" + rx_polarity: "01101111" + tx_polarity: "11010111" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "14" + lane_swap: "52476013" + rx_polarity: "01011011" + tx_polarity: "00011000" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "15" + lane_swap: "01234567" + rx_polarity: "00000000" + tx_polarity: "10100000" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" diff --git a/device/cameo/x86_64-cameo_esqc610_56sq-r0/esqc610-56sq/innovium.55200 b/device/cameo/x86_64-cameo_esqc610_56sq-r0/esqc610-56sq/innovium.55200 new file mode 100644 index 0000000000..1ceb2ed4a5 --- /dev/null +++ b/device/cameo/x86_64-cameo_esqc610_56sq-r0/esqc610-56sq/innovium.55200 @@ -0,0 +1,62 @@ +sku: innovium.55200 + +device_id: 0x1b59 + +# Hardware constraint information +hardware: + num_ibs: 2 + ib_active: 0, 1 + + ports_per_ib: 64, 64 + recirc_port_num: 64, 64 + cpu_port_num: 65 + cpu_port_ib: 0 + mgmt_port_num: 65, 66 + mgmt_port_ibs: 1, 1 + + pics_per_ib: 9, 9 + pic_ports_per_pic: 8 + max_serdes_speed: 25 + + num_shared_pics: 0 + + isg [0-7]: + ib: 0 + pic_id: [0-7] + + isg 8: + ib: 1 + pic_id: 7 + + isg 9: + ib: 1 + pic_id: 6 + + isg 10: + ib: 1 + pic_id: 5 + + isg 11: + ib: 1 + pic_id: 4 + + isg 12: + ib: 1 + pic_id: 3 + + isg 13: + ib: 1 + pic_id: 2 + + isg 14: + ib: 1 + pic_id: 1 + + isg 15: + ib: 1 + pic_id: 0 + + isg 16: + mode: 0:2 + ib: 1 + pic_id: 8 diff --git a/device/cameo/x86_64-cameo_esqc610_56sq-r0/esqc610-56sq/ivm.sai.config.yaml b/device/cameo/x86_64-cameo_esqc610_56sq-r0/esqc610-56sq/ivm.sai.config.yaml new file mode 100644 index 0000000000..5ee2bbc89b --- /dev/null +++ b/device/cameo/x86_64-cameo_esqc610_56sq-r0/esqc610-56sq/ivm.sai.config.yaml @@ -0,0 +1,8 @@ +IFCS_INIT_FILE : "/usr/share/sonic/hwsku/config_48x25G_8x100G_Cameo-esqc610-56sq.yaml" +IFCS_SKU_FILE : "/usr/share/sonic/hwsku/innovium.55200" +IFCS_INNO_CLI_PORT : "9999" +IFCS_TARGET : "device" +INNOVIUM_DIR : "/innovium" +PYTHONPATH : "$INNOVIUM_DIR:$INNOVIUM_DIR/cmds:$INNOVIUM_DIR/scripts:$INNOVIUM_DIR/test/:$INNOVIUM_DIR/test/utils:$INNOVIUM_DIR/utils:$INNOVIUM_DIR/pyctypes" +IVM_SAI_DATAPATH_CONFIG_FILE: "/usr/share/sonic/hwsku/ivm.sai.datapath.config.yaml" +IVM_SAI_PARAM_A0008: "64" diff --git a/device/cameo/x86_64-cameo_esqc610_56sq-r0/esqc610-56sq/ivm.sai.datapath.config.yaml b/device/cameo/x86_64-cameo_esqc610_56sq-r0/esqc610-56sq/ivm.sai.datapath.config.yaml new file mode 100644 index 0000000000..ef4bc6d129 --- /dev/null +++ b/device/cameo/x86_64-cameo_esqc610_56sq-r0/esqc610-56sq/ivm.sai.datapath.config.yaml @@ -0,0 +1,9 @@ +ISAI_PARAM_P0_0_LS : "9216 9216" +ISAI_PARAM_P0_1_LS : "2850 2650" +ISAI_PARAM_P0_1_ALS : "290 90" +ISAI_PARAM_P1_0_LS : "3072 3072" +ISAI_PARAM_P1_0_LL : "6144 6144" +ISAI_PARAM_P1_1_LS : "2210 2010" +ISAI_PARAM_P1_1_LL : "1330 1330" +ISAI_PARAM_P1_1_ALS : "290 90" +ISAI_PARAM_P1_1_ALL : "50 50" diff --git a/device/cameo/x86_64-cameo_esqc610_56sq-r0/esqc610-56sq/pg_profile_lookup.ini b/device/cameo/x86_64-cameo_esqc610_56sq-r0/esqc610-56sq/pg_profile_lookup.ini new file mode 100644 index 0000000000..adcb52ab2a --- /dev/null +++ b/device/cameo/x86_64-cameo_esqc610_56sq-r0/esqc610-56sq/pg_profile_lookup.ini @@ -0,0 +1,18 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 25000 5m 1518 0 15680 1 13440 + 50000 5m 1518 0 21248 1 13440 + 100000 5m 1518 0 34624 1 13440 + 400000 5m 1518 0 117536 1 13440 + 25000 40m 1518 0 16928 1 13440 + 50000 40m 1518 0 23392 1 13440 + 100000 40m 1518 0 38816 1 13440 + 400000 40m 1518 0 135520 1 13440 + 25000 100m 1518 0 18848 1 13440 + 50000 100m 1518 0 27264 1 13440 + 100000 100m 1518 0 46496 1 13440 + 400000 100m 1518 0 166688 1 13440 + 25000 300m 1518 0 25184 1 13440 + 50000 300m 1518 0 40128 1 13440 + 100000 300m 1518 0 72384 1 13440 + 400000 300m 1518 0 268640 1 13440 diff --git a/device/cameo/x86_64-cameo_esqc610_56sq-r0/esqc610-56sq/port_config.ini b/device/cameo/x86_64-cameo_esqc610_56sq-r0/esqc610-56sq/port_config.ini new file mode 100644 index 0000000000..cd7fc50924 --- /dev/null +++ b/device/cameo/x86_64-cameo_esqc610_56sq-r0/esqc610-56sq/port_config.ini @@ -0,0 +1,57 @@ +# name lanes speed index mtu fec +Ethernet0 113 25000 0 9126 rs +Ethernet1 114 25000 1 9126 rs +Ethernet2 115 25000 2 9126 rs +Ethernet3 116 25000 3 9126 rs +Ethernet4 117 25000 4 9126 rs +Ethernet5 105 25000 5 9126 rs +Ethernet6 106 25000 6 9126 rs +Ethernet7 107 25000 7 9126 rs +Ethernet8 108 25000 8 9126 rs +Ethernet9 109 25000 9 9126 rs +Ethernet10 110 25000 10 9126 rs +Ethernet11 111 25000 11 9126 rs +Ethernet12 112 25000 12 9126 rs +Ethernet13 89 25000 13 9126 rs +Ethernet14 90 25000 14 9126 rs +Ethernet15 91 25000 15 9126 rs +Ethernet16 92 25000 16 9126 rs +Ethernet17 93 25000 17 9126 rs +Ethernet18 94 25000 18 9126 rs +Ethernet19 95 25000 19 9126 rs +Ethernet20 96 25000 20 9126 rs +Ethernet21 118 25000 21 9126 rs +Ethernet22 119 25000 22 9126 rs +Ethernet23 120 25000 23 9126 rs +Ethernet24 41 25000 24 9126 rs +Ethernet25 42 25000 25 9126 rs +Ethernet26 43 25000 26 9126 rs +Ethernet27 44 25000 27 9126 rs +Ethernet28 45 25000 28 9126 rs +Ethernet29 46 25000 29 9126 rs +Ethernet30 47 25000 30 9126 rs +Ethernet31 48 25000 31 9126 rs +Ethernet32 25 25000 32 9126 rs +Ethernet33 26 25000 33 9126 rs +Ethernet34 27 25000 34 9126 rs +Ethernet35 28 25000 35 9126 rs +Ethernet36 29 25000 36 9126 rs +Ethernet37 30 25000 37 9126 rs +Ethernet38 31 25000 38 9126 rs +Ethernet39 32 25000 39 9126 rs +Ethernet40 17 25000 40 9126 rs +Ethernet41 18 25000 41 9126 rs +Ethernet42 19 25000 42 9126 rs +Ethernet43 20 25000 43 9126 rs +Ethernet44 21 25000 44 9126 rs +Ethernet45 22 25000 45 9126 rs +Ethernet46 23 25000 46 9126 rs +Ethernet47 24 25000 47 9126 rs +Ethernet48 73,74,75,76 100000 48 9126 rs +Ethernet52 77,78,79,80 100000 49 9126 rs +Ethernet56 65,66,67,68 100000 50 9126 rs +Ethernet60 69,70,71,72 100000 51 9126 rs +Ethernet64 9,10,11,12 100000 52 9126 rs +Ethernet68 13,14,15,16 100000 53 9126 rs +Ethernet72 1,2,3,4 100000 54 9126 rs +Ethernet76 5,6,7,8 100000 55 9126 rs diff --git a/device/cameo/x86_64-cameo_esqc610_56sq-r0/esqc610-56sq/qos.json.j2 b/device/cameo/x86_64-cameo_esqc610_56sq-r0/esqc610-56sq/qos.json.j2 new file mode 100644 index 0000000000..4b9748c7b5 --- /dev/null +++ b/device/cameo/x86_64-cameo_esqc610_56sq-r0/esqc610-56sq/qos.json.j2 @@ -0,0 +1,114 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "0":"0", + "1":"1", + "2":"2", + "3":"3", + "4":"4", + "5":"5", + "6":"6", + "7":"7" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "red_min_threshold":"50000" + } + } +} diff --git a/device/cameo/x86_64-cameo_esqc610_56sq-r0/esqc610-56sq/qos_defaults_def_lossy.j2 b/device/cameo/x86_64-cameo_esqc610_56sq-r0/esqc610-56sq/qos_defaults_def_lossy.j2 new file mode 100644 index 0000000000..104d2d78de --- /dev/null +++ b/device/cameo/x86_64-cameo_esqc610_56sq-r0/esqc610-56sq/qos_defaults_def_lossy.j2 @@ -0,0 +1,118 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "0":"0", + "1":"1", + "2":"2", + "3":"3", + "4":"4", + "5":"5", + "6":"6", + "7":"7" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"0", + "4":"0", + "5":"0", + "6":"0", + "7":"0", + "8":"0", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]" + } + }, + "SCHEDULER": { + "scheduler.7": { + "type": "STRICT" + } + }, + "QUEUE": { + "{{ port_names }}|7": { + "scheduler": "[SCHEDULER|scheduler.7]" + } + } +} diff --git a/device/cameo/x86_64-cameo_esqc610_56sq-r0/esqc610-56sq/qos_defaults_t1.j2 b/device/cameo/x86_64-cameo_esqc610_56sq-r0/esqc610-56sq/qos_defaults_t1.j2 new file mode 100644 index 0000000000..4b9748c7b5 --- /dev/null +++ b/device/cameo/x86_64-cameo_esqc610_56sq-r0/esqc610-56sq/qos_defaults_t1.j2 @@ -0,0 +1,114 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "0":"0", + "1":"1", + "2":"2", + "3":"3", + "4":"4", + "5":"5", + "6":"6", + "7":"7" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "red_min_threshold":"50000" + } + } +} diff --git a/device/cameo/x86_64-cameo_esqc610_56sq-r0/esqc610-56sq/sai.profile b/device/cameo/x86_64-cameo_esqc610_56sq-r0/esqc610-56sq/sai.profile new file mode 100644 index 0000000000..aba4fc81fb --- /dev/null +++ b/device/cameo/x86_64-cameo_esqc610_56sq-r0/esqc610-56sq/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/ivm.sai.config.yaml diff --git a/device/cameo/x86_64-cameo_esqc610_56sq-r0/installer.conf b/device/cameo/x86_64-cameo_esqc610_56sq-r0/installer.conf new file mode 100644 index 0000000000..6375612d6c --- /dev/null +++ b/device/cameo/x86_64-cameo_esqc610_56sq-r0/installer.conf @@ -0,0 +1,3 @@ +CONSOLE_PORT=0x3f8 +CONSOLE_DEV=0 +CONSOLE_SPEED=115200 \ No newline at end of file diff --git a/device/cameo/x86_64-cameo_esqc610_56sq-r0/platform_reboot b/device/cameo/x86_64-cameo_esqc610_56sq-r0/platform_reboot new file mode 100755 index 0000000000..0d45ca026b --- /dev/null +++ b/device/cameo/x86_64-cameo_esqc610_56sq-r0/platform_reboot @@ -0,0 +1,16 @@ +#!/bin/sh + +mr_reboot() { + + sudo rmmod x86-64-cameo-esqc610-56sq + sudo i2cset -y 0 0x30 0xa1 0 + +} + +if [ $# -eq 0 ] || [ $@ = "-f" ] || [ $@ = "--force" ] || [ $@ = "reboot" ]; then + mr_reboot +elif [ $@ = "-p" ] ; then + sudo halt +else + echo "unsupported option" +fi diff --git a/device/cameo/x86_64-cameo_esqc610_56sq-r0/plugins/eeprom.py b/device/cameo/x86_64-cameo_esqc610_56sq-r0/plugins/eeprom.py new file mode 100755 index 0000000000..f0f19ba393 --- /dev/null +++ b/device/cameo/x86_64-cameo_esqc610_56sq-r0/plugins/eeprom.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python + +try: + from sonic_eeprom import eeprom_tlvinfo +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +class board(eeprom_tlvinfo.TlvInfoDecoder): + _TLV_INFO_MAX_LEN = 256 + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/bus/i2c/devices/0-0056/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/cameo/x86_64-cameo_esqc610_56sq-r0/plugins/psuutil.py b/device/cameo/x86_64-cameo_esqc610_56sq-r0/plugins/psuutil.py new file mode 100755 index 0000000000..ce9e9acbf6 --- /dev/null +++ b/device/cameo/x86_64-cameo_esqc610_56sq-r0/plugins/psuutil.py @@ -0,0 +1,99 @@ +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +attr_path = '/sys/class/hwmon/hwmon2/device/' + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + + # Get sysfs attribute + def get_attr_value(self, path): + + retval = 'ERR' + if (not os.path.isfile(path)): + return retval + + try: + with open(path, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", path, " file !") + + retval = retval.rstrip('\r\n') + return retval + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + :return: An integer, the number of PSUs available on the device + """ + MAX_PSUS = 2 + return MAX_PSUS + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is\ + faulty + """ + status = 0 + attr_file = 'psu_status' + status_path = attr_path+'/ESQC610_PSU/' + attr_file + try: + reg_file = open(status_path, 'r') + except IOError as e: + print( "Error: unable to open file: %s" % str(e)) + return False + text_lines = reg_file.read() + + search_str = "PSU {} is power Good".format(index) + + if search_str in text_lines: + status = 1 + + reg_file.close() + + return status + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + status = 0 + attr_file ='psu_present' + presence_path = attr_path+'ESQC610_PSU/' + attr_file + try: + reg_file = open(presence_path, 'r') + except IOError as e: + print( "Error: unable to open file: %s" % str(e)) + return False + text_lines = reg_file.read() + + search_str = "PSU {} is present".format(index) + + if search_str in text_lines: + status = 1 + + reg_file.close() + + return status + diff --git a/device/cameo/x86_64-cameo_esqc610_56sq-r0/plugins/sfputil.py b/device/cameo/x86_64-cameo_esqc610_56sq-r0/plugins/sfputil.py new file mode 100755 index 0000000000..e4d19b318f --- /dev/null +++ b/device/cameo/x86_64-cameo_esqc610_56sq-r0/plugins/sfputil.py @@ -0,0 +1,172 @@ +#!/usr/bin/env python + +try: + import time + import json + from sonic_sfp.sfputilbase import SfpUtilBase +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +attr_path = '/sys/class/hwmon/hwmon2/device/' +PLATFORM_INSTALL_INFO_FILE="/etc/sonic/platform_install.json" +PLATFORM_SFP_GROUPS = ['SFP-G01','SFP-G02','SFP-G03','SFP-G04','SFP-G05', 'SFP-G06', 'SFP-G07'] + +class SfpUtil(SfpUtilBase): + """Platform specific SfpUtill class""" + + _port_start = 0 + _port_end = 55 + _qsfp_port_start = 48 + _port_in_block =56 + _port_to_eeprom_mapping = {} + _global_port_pres_dict = {} + + def __init__(self): + eeprom_path = "{}/eeprom" + path_list = self.get_sfp_path() + for x in range(self._port_start, self._port_end + 1): + port_eeprom_path = eeprom_path.format(path_list[x]) + self._port_to_eeprom_mapping[x] = port_eeprom_path + + self.init_global_port_presence() + SfpUtilBase.__init__(self) + + def get_sfp_path(self): + map = [] + with open(PLATFORM_INSTALL_INFO_FILE) as fd: + install_info = json.load(fd) + for sfp_group_name in PLATFORM_SFP_GROUPS: + sfp_group = install_info[2][sfp_group_name] + map = map + sfp_group['paths'] + return map + + def reset(self, port_num): + # Check for invalid port_num + if port_num < self._qsfp_port_start or port_num > self._port_end: + return False + + path = attr_path+'ESQC610_QSFP/QSFP_reset' + try: + reg_file = open(path, 'w') + except IOError as e: + print( "Error: unable to open file: %s" % str(e)) + return False + + #toggle reset + #reg_file.seek(0) + reg_file.write(str(port_num-self._qsfp_port_start+1)) + #time.sleep(1) + #reg_file.seek(0) + #reg_file.write('0') + reg_file.close() + return True + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num < self._qsfp_port_start or port_num > self.port_end: + return False + + path = attr_path+'ESQC610_QSFP/QSFP_low_power_'+str(port_num-self._qsfp_port_start+1) + try: + reg_file = open(path, 'w') + except IOError as e: + print( "Error: unable to open file: %s" % str(e)) + return False + + # the gpio pin is ACTIVE_HIGH + if lpmode is True: + val = "1" + else: + val = "0" + + # write value to gpio + reg_file.seek(0) + reg_file.write(val) + reg_file.close() + + return True + + def get_low_power_mode(self, port_num): + # Check for invalid port_num + if port_num < self._qsfp_port_start or port_num > self._port_end: + return False + + path = attr_path+'ESQC610_QSFP/QSFP_low_power_'+str(port_num-self._qsfp_port_start+1) + try: + reg_file = open(path, 'r') + except IOError as e: + print( "Error: unable to open file: %s" % str(e)) + return False + + text_lines = reg_file.readline() + reg_file.close() + if text_lines.find('OFF') < 0: + return True + + return False + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self._port_start or port_num > self._port_end: + return False + + if port_num >= self._qsfp_port_start: + path = attr_path+'ESQC610_QSFP/QSFP_present' + line = port_num - self._qsfp_port_start + else: + path = attr_path+'ESQC610_SFP/SFP_present' + line = port_num + + try: + reg_file = open(path, 'r') + except IOError as e: + print( "Error: unable to open file: %s" % str(e)) + return False + text_lines = reg_file.readlines() + reg_file.close() + if text_lines[line].find('not') < 0: + return True + + return False + + def init_global_port_presence(self): + for port_num in range(self.port_start, (self.port_end + 1)): + presence = self.get_presence(port_num) + if(presence): + self._global_port_pres_dict[port_num] = '1' + else: + self._global_port_pres_dict[port_num] = '0' + + def get_transceiver_change_event(self, timeout=0): + port_dict = {} + while True: + for port_num in range(self.port_start, (self.port_end + 1)): + presence = self.get_presence(port_num) + if(presence and self._global_port_pres_dict[port_num] == '0'): + self._global_port_pres_dict[port_num] = '1' + port_dict[port_num] = '1' + elif(not presence and + self._global_port_pres_dict[port_num] == '1'): + self._global_port_pres_dict[port_num] = '0' + port_dict[port_num] = '0' + + if(len(port_dict) > 0): + return True, port_dict + + time.sleep(1) + + @property + def port_start(self): + return self._port_start + + @property + def port_end(self): + return self._port_end + + @property + def qsfp_ports(self): + return range(self._qsfp_port_start, self._port_in_block + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping diff --git a/device/cameo/x86_64-cameo_esqc610_56sq-r0/pmon_daemon_control.json b/device/cameo/x86_64-cameo_esqc610_56sq-r0/pmon_daemon_control.json new file mode 100644 index 0000000000..44871c057e --- /dev/null +++ b/device/cameo/x86_64-cameo_esqc610_56sq-r0/pmon_daemon_control.json @@ -0,0 +1,4 @@ +{ + "skip_ledd": true, + "skip_thermalctld": true +} diff --git a/device/cameo/x86_64-cameo_esqc610_56sq-r0/sensors.conf b/device/cameo/x86_64-cameo_esqc610_56sq-r0/sensors.conf new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/device/cameo/x86_64-cameo_esqc610_56sq-r0/sensors.conf @@ -0,0 +1 @@ + diff --git a/device/cameo/x86_64-cameo_esqc610_56sq-r0/topo.conf b/device/cameo/x86_64-cameo_esqc610_56sq-r0/topo.conf new file mode 100644 index 0000000000..795ea43143 --- /dev/null +++ b/device/cameo/x86_64-cameo_esqc610_56sq-r0/topo.conf @@ -0,0 +1 @@ +t1 diff --git a/device/cameo/x86_64-fabric_1208i-r0/default_sku b/device/cameo/x86_64-fabric_1208i-r0/default_sku new file mode 100644 index 0000000000..d361cdfd59 --- /dev/null +++ b/device/cameo/x86_64-fabric_1208i-r0/default_sku @@ -0,0 +1 @@ +fabric-1208i t1 diff --git a/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/buffers.json.j2 b/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/buffers.json.j2 new file mode 100644 index 0000000000..93dac6b199 --- /dev/null +++ b/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/buffers.json.j2 @@ -0,0 +1,137 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '40m' %} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) %} + {%- set cable_len = [] %} + {%- for local_port in DEVICE_NEIGHBOR %} + {%- if local_port == port_name %} + {%- if DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor_role = neighbor.type %} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role %} + {%- set roles1 = roles1 | lower %} + {%- set roles2 = roles2 | lower %} + {%- if roles1 in ports2cable %} + {%- if cable_len.append(ports2cable[roles1]) %}{% endif %} + {%- elif roles2 in ports2cable %} + {%- if cable_len.append(ports2cable[roles2]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else %} + {%- if switch_role.lower() == 'torrouter' %} + {%- for local_port in VLAN_MEMBER %} + {%- if local_port[1] == port_name %} + {%- set roles3 = switch_role + '_' + 'server' %} + {%- set roles3 = roles3 | lower %} + {%- if roles3 in ports2cable %} + {%- if cable_len.append(ports2cable[roles3]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- endif %} +{%- endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "47218432", + "type": "ingress", + "mode": "dynamic", + "xoff": "17708800" + }, + "lossy_pool": { + "size": "18874368", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xoff":"38816", + "size":"1518", + "dynamic_th":"1", + "xon_offset":"13440" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"9497600" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"0", + "static_th":"9497600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"1518", + "dynamic_th":"2" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/buffers_defaults_def_lossy.j2 b/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/buffers_defaults_def_lossy.j2 new file mode 100644 index 0000000000..1a31812c26 --- /dev/null +++ b/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/buffers_defaults_def_lossy.j2 @@ -0,0 +1,38 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "BUFFER_POOL": { + "lossy_pool": { + "size": "56985600", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"0", + "static_th":"9497600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"1518", + "dynamic_th":"2" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-7": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|0-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/buffers_defaults_t1.j2 b/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/buffers_defaults_t1.j2 new file mode 100644 index 0000000000..93dac6b199 --- /dev/null +++ b/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/buffers_defaults_t1.j2 @@ -0,0 +1,137 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '40m' %} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) %} + {%- set cable_len = [] %} + {%- for local_port in DEVICE_NEIGHBOR %} + {%- if local_port == port_name %} + {%- if DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor_role = neighbor.type %} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role %} + {%- set roles1 = roles1 | lower %} + {%- set roles2 = roles2 | lower %} + {%- if roles1 in ports2cable %} + {%- if cable_len.append(ports2cable[roles1]) %}{% endif %} + {%- elif roles2 in ports2cable %} + {%- if cable_len.append(ports2cable[roles2]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else %} + {%- if switch_role.lower() == 'torrouter' %} + {%- for local_port in VLAN_MEMBER %} + {%- if local_port[1] == port_name %} + {%- set roles3 = switch_role + '_' + 'server' %} + {%- set roles3 = roles3 | lower %} + {%- if roles3 in ports2cable %} + {%- if cable_len.append(ports2cable[roles3]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- endif %} +{%- endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "47218432", + "type": "ingress", + "mode": "dynamic", + "xoff": "17708800" + }, + "lossy_pool": { + "size": "18874368", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xoff":"38816", + "size":"1518", + "dynamic_th":"1", + "xon_offset":"13440" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"9497600" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"0", + "static_th":"9497600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"1518", + "dynamic_th":"2" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/alt_cfg/config_32x400G_Delta-et-c032if_aux.yaml b/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/config_32x400G_fab128.yaml old mode 100755 new mode 100644 similarity index 59% rename from device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/alt_cfg/config_32x400G_Delta-et-c032if_aux.yaml rename to device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/config_32x400G_fab128.yaml index 2ba23d2a5a..66bd195e7f --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/alt_cfg/config_32x400G_Delta-et-c032if_aux.yaml +++ b/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/config_32x400G_fab128.yaml @@ -1,6 +1,6 @@ ifcs: options: - log_level: "info" + log_level: "off" nodes: - node_id: "0" options: @@ -10,6 +10,10 @@ nodes: multi_interface: "yes" buffer_management_mode: "api_driven" max_lossless_tc: "2" + skip_pll_check: "false" + mbist_on_init: "true" + ilpm_enable: "1" + forward_profile: "IFCS_FORWARD_PROFILE_ID_PROFILE_E" txring: - txring_id: "0" desc_count: "1024" @@ -28,401 +32,385 @@ nodes: prio: "1" netdev: "true" rxring: - - rxring_id: "0" - desc_count: "1024" + - rxring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39" + - rxring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40" + - rxring_id: "2" + desc_count: "1024" prio: "1" - netdev: "true" - queues: "0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44" - - rxring_id: "1" - desc_count: "1024" - prio: "1" - netdev: "true" - queues: "1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45" - - rxring_id: "2" - desc_count: "1024" - prio: "1" - netdev: "true" - queues: "2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46" - - rxring_id: "3" - desc_count: "1024" - prio: "1" - netdev: "true" - queues: "3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47" + netdev: "true" + queues: "2, 5, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35, 38, 41, 47" + - rxring_id: "3" + desc_count: "1024" + prio: "1" + queues: "42, 43, 44, 45, 46" sys_clk: "1720" ifc_clk: "1200" mac_clk: "1340" - devports: - id: "0" sysport: "1000" type: "cpu" - - fec: "KPFEC" - id: "249" - lanes: "0:8" - serdes_group: "31" - speed: "400G" - sysport: "249" - type: "eth" - - fec: "KPFEC" - id: "241" - lanes: "0:8" - serdes_group: "30" - speed: "400G" - sysport: "241" - type: "eth" - - fec: "KPFEC" - id: "233" - lanes: "0:8" - serdes_group: "29" - speed: "400G" - sysport: "233" - type: "eth" - - fec: "KPFEC" - id: "225" - lanes: "0:8" - serdes_group: "28" - speed: "400G" - sysport: "225" - type: "eth" - - fec: "KPFEC" - id: "217" - lanes: "0:8" - serdes_group: "27" - speed: "400G" - sysport: "217" - type: "eth" - - fec: "KPFEC" - id: "209" - lanes: "0:8" - serdes_group: "26" - speed: "400G" - sysport: "209" - type: "eth" - - fec: "KPFEC" - id: "201" - lanes: "0:8" - serdes_group: "25" - speed: "400G" - sysport: "201" - type: "eth" - - fec: "KPFEC" - id: "193" - lanes: "0:8" - serdes_group: "24" - speed: "400G" - sysport: "193" - type: "eth" - - fec: "KPFEC" - id: "185" - lanes: "0:8" - serdes_group: "23" - speed: "400G" - sysport: "185" - type: "eth" - - fec: "KPFEC" - id: "177" - lanes: "0:8" - serdes_group: "22" - speed: "400G" - sysport: "177" - type: "eth" - - fec: "KPFEC" - id: "169" - lanes: "0:8" - serdes_group: "21" - speed: "400G" - sysport: "169" - type: "eth" - - fec: "KPFEC" - id: "161" - lanes: "0:8" - serdes_group: "20" - speed: "400G" - sysport: "161" - type: "eth" - - fec: "KPFEC" - id: "153" - lanes: "0:8" - serdes_group: "19" - speed: "400G" - sysport: "153" - type: "eth" - - fec: "KPFEC" - id: "145" - lanes: "0:8" - serdes_group: "18" - speed: "400G" - sysport: "145" - type: "eth" - - fec: "KPFEC" - id: "137" - lanes: "0:8" - serdes_group: "17" - speed: "400G" - sysport: "137" - type: "eth" - - fec: "KPFEC" - id: "129" - lanes: "0:8" - serdes_group: "16" - speed: "400G" - sysport: "129" - type: "eth" - - fec: "KPFEC" - id: "121" - lanes: "0:8" - serdes_group: "15" - speed: "400G" - sysport: "121" - type: "eth" - - fec: "KPFEC" - id: "113" - lanes: "0:8" - serdes_group: "14" - speed: "400G" - sysport: "113" - type: "eth" - - fec: "KPFEC" - id: "97" - lanes: "0:8" - serdes_group: "12" - speed: "400G" - sysport: "97" - type: "eth" - - fec: "KPFEC" - id: "105" - lanes: "0:8" - serdes_group: "13" - speed: "400G" - sysport: "105" - type: "eth" - - fec: "KPFEC" - id: "81" - lanes: "0:8" - serdes_group: "10" - speed: "400G" - sysport: "81" - type: "eth" - - fec: "KPFEC" - id: "89" - lanes: "0:8" - serdes_group: "11" - speed: "400G" - sysport: "89" - type: "eth" - - fec: "KPFEC" - id: "65" - lanes: "0:8" - serdes_group: "8" - speed: "400G" - sysport: "65" - type: "eth" - - fec: "KPFEC" - id: "73" - lanes: "0:8" - serdes_group: "9" - speed: "400G" - sysport: "73" - type: "eth" - - fec: "KPFEC" - id: "49" - lanes: "0:8" - serdes_group: "6" - speed: "400G" - sysport: "49" - type: "eth" - - fec: "KPFEC" - id: "57" - lanes: "0:8" - serdes_group: "7" - speed: "400G" - sysport: "57" - type: "eth" - - fec: "KPFEC" - id: "33" - lanes: "0:8" - serdes_group: "4" - speed: "400G" - sysport: "33" - type: "eth" - - fec: "KPFEC" - id: "41" - lanes: "0:8" - serdes_group: "5" - speed: "400G" - sysport: "41" - type: "eth" - - fec: "KPFEC" - id: "17" - lanes: "0:8" - serdes_group: "2" - speed: "400G" - sysport: "17" - type: "eth" - - fec: "KPFEC" - id: "25" - lanes: "0:8" - serdes_group: "3" - speed: "400G" - sysport: "25" - type: "eth" - fec: "KPFEC" id: "1" lanes: "0:8" - serdes_group: "0" + serdes_group: "4" speed: "400G" sysport: "1" type: "eth" - fec: "KPFEC" id: "9" lanes: "0:8" - serdes_group: "1" + serdes_group: "5" speed: "400G" sysport: "9" type: "eth" - - fec: "NONE" - id: "257" - lanes: "0:1" - serdes_group: "32" - speed: "10G" - sysport: "257" - type: "mgmt 0" - - fec: "NONE" - id: "258" - lanes: "1:1" - serdes_group: "32" - speed: "10G" - sysport: "258" - type: "mgmt 1" + - fec: "KPFEC" + id: "17" + lanes: "0:8" + serdes_group: "6" + speed: "400G" + sysport: "17" + type: "eth" + - fec: "KPFEC" + id: "25" + lanes: "0:8" + serdes_group: "7" + speed: "400G" + sysport: "25" + type: "eth" + - fec: "KPFEC" + id: "33" + lanes: "0:8" + serdes_group: "0" + speed: "400G" + sysport: "33" + type: "eth" + - fec: "KPFEC" + id: "41" + lanes: "0:8" + serdes_group: "1" + speed: "400G" + sysport: "41" + type: "eth" + - fec: "KPFEC" + id: "49" + lanes: "0:8" + serdes_group: "2" + speed: "400G" + sysport: "49" + type: "eth" + - fec: "KPFEC" + id: "57" + lanes: "0:8" + serdes_group: "3" + speed: "400G" + sysport: "57" + type: "eth" + - fec: "KPFEC" + id: "65" + lanes: "0:8" + serdes_group: "28" + speed: "400G" + sysport: "65" + type: "eth" + - fec: "KPFEC" + id: "73" + lanes: "0:8" + serdes_group: "29" + speed: "400G" + sysport: "73" + type: "eth" + - fec: "KPFEC" + id: "81" + lanes: "0:8" + serdes_group: "30" + speed: "400G" + sysport: "81" + type: "eth" + - fec: "KPFEC" + id: "89" + lanes: "0:8" + serdes_group: "31" + speed: "400G" + sysport: "89" + type: "eth" + - fec: "KPFEC" + id: "97" + lanes: "0:8" + serdes_group: "24" + speed: "400G" + sysport: "97" + type: "eth" + - fec: "KPFEC" + id: "105" + lanes: "0:8" + serdes_group: "25" + speed: "400G" + sysport: "105" + type: "eth" + - fec: "KPFEC" + id: "113" + lanes: "0:8" + serdes_group: "26" + speed: "400G" + sysport: "113" + type: "eth" + - fec: "KPFEC" + id: "121" + lanes: "0:8" + serdes_group: "27" + speed: "400G" + sysport: "121" + type: "eth" + - fec: "KPFEC" + id: "129" + lanes: "0:8" + serdes_group: "20" + speed: "400G" + sysport: "129" + type: "eth" + - fec: "KPFEC" + id: "137" + lanes: "0:8" + serdes_group: "21" + speed: "400G" + sysport: "137" + type: "eth" + - fec: "KPFEC" + id: "145" + lanes: "0:8" + serdes_group: "22" + speed: "400G" + sysport: "145" + type: "eth" + - fec: "KPFEC" + id: "153" + lanes: "0:8" + serdes_group: "23" + speed: "400G" + sysport: "153" + type: "eth" + - fec: "KPFEC" + id: "161" + lanes: "0:8" + serdes_group: "16" + speed: "400G" + sysport: "161" + type: "eth" + - fec: "KPFEC" + id: "169" + lanes: "0:8" + serdes_group: "17" + speed: "400G" + sysport: "169" + type: "eth" + - fec: "KPFEC" + id: "177" + lanes: "0:8" + serdes_group: "18" + speed: "400G" + sysport: "177" + type: "eth" + - fec: "KPFEC" + id: "185" + lanes: "0:8" + serdes_group: "19" + speed: "400G" + sysport: "185" + type: "eth" + - fec: "KPFEC" + id: "193" + lanes: "0:8" + serdes_group: "12" + speed: "400G" + sysport: "193" + type: "eth" + - fec: "KPFEC" + id: "201" + lanes: "0:8" + serdes_group: "13" + speed: "400G" + sysport: "201" + type: "eth" + - fec: "KPFEC" + id: "209" + lanes: "0:8" + serdes_group: "14" + speed: "400G" + sysport: "209" + type: "eth" + - fec: "KPFEC" + id: "217" + lanes: "0:8" + serdes_group: "15" + speed: "400G" + sysport: "217" + type: "eth" + - fec: "KPFEC" + id: "225" + lanes: "0:8" + serdes_group: "8" + speed: "400G" + sysport: "225" + type: "eth" + - fec: "KPFEC" + id: "233" + lanes: "0:8" + serdes_group: "9" + speed: "400G" + sysport: "233" + type: "eth" + - fec: "KPFEC" + id: "241" + lanes: "0:8" + serdes_group: "10" + speed: "400G" + sysport: "241" + type: "eth" + - fec: "KPFEC" + id: "249" + lanes: "0:8" + serdes_group: "11" + speed: "400G" + sysport: "249" + type: "eth" isg: - id: "0" - tx_polarity: "01010101" - rx_polarity: "01100000" - lane_swap: "23641075" - - id: "1" - tx_polarity: "10110000" - rx_polarity: "11111111" - lane_swap: "64317520" - - id: "2" - tx_polarity: "00000000" - rx_polarity: "00000011" - lane_swap: "63147520" - - id: "3" - tx_polarity: "01101000" - rx_polarity: "00001110" - lane_swap: "31572046" - - id: "4" - tx_polarity: "00111000" - rx_polarity: "00001000" - lane_swap: "46105732" - - id: "5" - tx_polarity: "10111111" - rx_polarity: "11101000" - lane_swap: "27153604" - - id: "6" - tx_polarity: "01101110" - rx_polarity: "00001101" - lane_swap: "46503721" - - id: "7" - tx_polarity: "01000100" - rx_polarity: "10000101" - lane_swap: "03671245" - - id: "8" - tx_polarity: "01110101" - rx_polarity: "00010000" - lane_swap: "12640375" - - id: "9" - tx_polarity: "01011100" + tx_polarity: "01011011" rx_polarity: "11001111" - lane_swap: "02561347" + lane_swap: "01235467" + - id: "1" + tx_polarity: "01011011" + rx_polarity: "01001111" + lane_swap: "01234567" + - id: "2" + tx_polarity: "10110100" + rx_polarity: "10001110" + lane_swap: "73215460" + - id: "3" + tx_polarity: "11111110" + rx_polarity: "10011111" + lane_swap: "71234560" + - id: "4" + tx_polarity: "01001011" + rx_polarity: "11011010" + lane_swap: "01235467" + - id: "5" + tx_polarity: "01001011" + rx_polarity: "01001111" + lane_swap: "01234567" + - id: "6" + tx_polarity: "11110100" + rx_polarity: "10010110" + lane_swap: "73215460" + - id: "7" + tx_polarity: "11111101" + rx_polarity: "11110011" + lane_swap: "53164720" + - id: "8" + tx_polarity: "00101001" + rx_polarity: "01101001" + lane_swap: "01234567" + - id: "9" + tx_polarity: "00101001" + rx_polarity: "01101001" + lane_swap: "01234567" - id: "10" - tx_polarity: "01110110" - rx_polarity: "11000000" - lane_swap: "12740365" + tx_polarity: "10010110" + rx_polarity: "10110100" + lane_swap: "73215460" - id: "11" - tx_polarity: "00111000" - rx_polarity: "00010111" - lane_swap: "01572436" - - id: "12" - tx_polarity: "00001111" - rx_polarity: "10111001" - lane_swap: "54320176" - - id: "13" - tx_polarity: "10011101" - rx_polarity: "00111011" - lane_swap: "26153704" - - id: "14" - tx_polarity: "00110000" - rx_polarity: "11010000" - lane_swap: "37452601" - - id: "15" - tx_polarity: "11100010" - rx_polarity: "01110011" - lane_swap: "51370462" - - id: "16" - tx_polarity: "10111010" - rx_polarity: "11010011" - lane_swap: "36152704" - - id: "17" - tx_polarity: "01011101" - rx_polarity: "00110001" - lane_swap: "45621073" - - id: "18" - tx_polarity: "11011111" - rx_polarity: "11001011" - lane_swap: "26143705" - - id: "19" - tx_polarity: "00100110" - rx_polarity: "00001001" - lane_swap: "42730165" - - id: "20" - tx_polarity: "10011011" - rx_polarity: "01101101" - lane_swap: "54217603" - - id: "21" - tx_polarity: "00101110" - rx_polarity: "10111111" - lane_swap: "26031745" - - id: "22" - tx_polarity: "01001110" - rx_polarity: "00111001" - lane_swap: "36024715" - - id: "23" - tx_polarity: "10101101" - rx_polarity: "01010011" - lane_swap: "45621370" - - id: "24" - tx_polarity: "11001110" - rx_polarity: "00011111" - lane_swap: "65234701" - - id: "25" - tx_polarity: "01110001" - rx_polarity: "01010111" - lane_swap: "37601452" - - id: "26" - tx_polarity: "01000100" - rx_polarity: "00001111" - lane_swap: "65034721" - - id: "27" - tx_polarity: "10111101" - rx_polarity: "11000101" - lane_swap: "34501672" - - id: "28" - tx_polarity: "01111000" - rx_polarity: "01110110" - lane_swap: "43061275" - - id: "29" - tx_polarity: "11110111" - rx_polarity: "11100111" - lane_swap: "57304621" - - id: "30" tx_polarity: "10000100" - rx_polarity: "00101111" - lane_swap: "47125603" + rx_polarity: "00010100" + lane_swap: "71635420" + - id: "12" + tx_polarity: "00101001" + rx_polarity: "10001001" + lane_swap: "01234567" + - id: "13" + tx_polarity: "01101001" + rx_polarity: "00001011" + lane_swap: "01235467" + - id: "14" + tx_polarity: "10000110" + rx_polarity: "10000010" + lane_swap: "73215460" + - id: "15" + tx_polarity: "10000100" + rx_polarity: "10010100" + lane_swap: "73615420" + - id: "16" + tx_polarity: "00101001" + rx_polarity: "00001011" + lane_swap: "01234567" + - id: "17" + tx_polarity: "00101001" + rx_polarity: "00001011" + lane_swap: "01235467" + - id: "18" + tx_polarity: "00010110" + rx_polarity: "10010110" + lane_swap: "73215460" + - id: "19" + tx_polarity: "11101110" + rx_polarity: "10100100" + lane_swap: "73615420" + - id: "20" + tx_polarity: "01001101" + rx_polarity: "11101011" + lane_swap: "01234567" + - id: "21" + tx_polarity: "11011011" + rx_polarity: "10001011" + lane_swap: "01234567" + - id: "22" + tx_polarity: "11110100" + rx_polarity: "10001111" + lane_swap: "73215460" + - id: "23" + tx_polarity: "11110110" + rx_polarity: "01011100" + lane_swap: "73615420" + - id: "24" + tx_polarity: "01011011" + rx_polarity: "01101101" + lane_swap: "01234567" + - id: "25" + tx_polarity: "01001011" + rx_polarity: "01101101" + lane_swap: "01234567" + - id: "26" + tx_polarity: "11110100" + rx_polarity: "10111100" + lane_swap: "73215460" + - id: "27" + tx_polarity: "10111100" + rx_polarity: "00010100" + lane_swap: "73615420" + - id: "28" + tx_polarity: "01001011" + rx_polarity: "01010101" + lane_swap: "01235467" + - id: "29" + tx_polarity: "01011011" + rx_polarity: "11001010" + lane_swap: "01234567" + - id: "30" + tx_polarity: "11110100" + rx_polarity: "00010111" + lane_swap: "73215460" - id: "31" - tx_polarity: "11111111" - rx_polarity: "11100010" - lane_swap: "13460275" + tx_polarity: "11110100" + rx_polarity: "00110111" + lane_swap: "73615420" - id: "32" tx_polarity: "00000000" rx_polarity: "00000000" diff --git a/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/config_64x100G_fab128.yaml b/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/config_64x100G_fab128.yaml new file mode 100644 index 0000000000..efb8fc73aa --- /dev/null +++ b/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/config_64x100G_fab128.yaml @@ -0,0 +1,833 @@ +ifcs: + options: + log_level: "fatal" +nodes: +- node_id: "0" + options: + sku: "configs/sku/innovium.77700_B" + netdev: + - auto_create: "no" + multi_interface: "yes" + buffer_management_mode: "api_driven" + max_lossless_tc: "2" + skip_pll_check: "false" + mbist_on_init: "true" + ilpm_enable: "1" + forward_profile: "IFCS_FORWARD_PROFILE_ID_PROFILE_E" + txring: + - txring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "3" + desc_count: "1024" + prio: "1" + netdev: "true" + rxring: + - rxring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39" + - rxring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40" + - rxring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "2, 5, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35, 38, 41, 47" + - rxring_id: "3" + desc_count: "1024" + prio: "1" + queues: "42, 43, 44, 45, 46" + sys_clk: "1720" + ifc_clk: "1200" + mac_clk: "1340" + devports: + - id: "0" + sysport: "1000" + type: "cpu" + - fec: "KRFEC" + id: "1" + lanes: "0:4" + serdes_group: "4" + speed: "100G" + sysport: "1" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "5" + lanes: "4:4" + serdes_group: "4" + speed: "100G" + sysport: "5" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "9" + lanes: "0:4" + serdes_group: "5" + speed: "100G" + sysport: "9" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "13" + lanes: "4:4" + serdes_group: "5" + speed: "100G" + sysport: "13" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "17" + lanes: "0:4" + serdes_group: "6" + speed: "100G" + sysport: "17" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "21" + lanes: "4:4" + serdes_group: "6" + speed: "100G" + sysport: "21" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "25" + lanes: "0:4" + serdes_group: "7" + speed: "100G" + sysport: "25" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "29" + lanes: "4:4" + serdes_group: "7" + speed: "100G" + sysport: "29" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "33" + lanes: "0:4" + serdes_group: "0" + speed: "100G" + sysport: "33" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "37" + lanes: "4:4" + serdes_group: "0" + speed: "100G" + sysport: "37" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "41" + lanes: "0:4" + serdes_group: "1" + speed: "100G" + sysport: "41" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "45" + lanes: "4:4" + serdes_group: "1" + speed: "100G" + sysport: "45" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "49" + lanes: "0:4" + serdes_group: "2" + speed: "100G" + sysport: "49" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "53" + lanes: "4:4" + serdes_group: "2" + speed: "100G" + sysport: "53" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "57" + lanes: "0:4" + serdes_group: "3" + speed: "100G" + sysport: "57" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "61" + lanes: "4:4" + serdes_group: "3" + speed: "100G" + sysport: "61" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "65" + lanes: "0:4" + serdes_group: "28" + speed: "100G" + sysport: "65" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "69" + lanes: "4:4" + serdes_group: "28" + speed: "100G" + sysport: "69" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "73" + lanes: "0:4" + serdes_group: "29" + speed: "100G" + sysport: "73" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "77" + lanes: "4:4" + serdes_group: "29" + speed: "100G" + sysport: "77" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "81" + lanes: "0:4" + serdes_group: "30" + speed: "100G" + sysport: "81" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "85" + lanes: "4:4" + serdes_group: "30" + speed: "100G" + sysport: "85" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "89" + lanes: "0:4" + serdes_group: "31" + speed: "100G" + sysport: "89" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "93" + lanes: "4:4" + serdes_group: "31" + speed: "100G" + sysport: "93" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "97" + lanes: "0:4" + serdes_group: "24" + speed: "100G" + sysport: "97" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "101" + lanes: "4:4" + serdes_group: "24" + speed: "100G" + sysport: "101" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "105" + lanes: "0:4" + serdes_group: "25" + speed: "100G" + sysport: "105" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "109" + lanes: "4:4" + serdes_group: "25" + speed: "100G" + sysport: "109" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "113" + lanes: "0:4" + serdes_group: "26" + speed: "100G" + sysport: "113" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "117" + lanes: "4:4" + serdes_group: "26" + speed: "100G" + sysport: "117" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "121" + lanes: "0:4" + serdes_group: "27" + speed: "100G" + sysport: "121" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "125" + lanes: "4:4" + serdes_group: "27" + speed: "100G" + sysport: "125" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "129" + lanes: "0:4" + serdes_group: "20" + speed: "100G" + sysport: "129" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "133" + lanes: "4:4" + serdes_group: "20" + speed: "100G" + sysport: "133" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "137" + lanes: "0:4" + serdes_group: "21" + speed: "100G" + sysport: "137" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "141" + lanes: "4:4" + serdes_group: "21" + speed: "100G" + sysport: "141" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "145" + lanes: "0:4" + serdes_group: "22" + speed: "100G" + sysport: "145" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "149" + lanes: "4:4" + serdes_group: "22" + speed: "100G" + sysport: "149" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "153" + lanes: "0:4" + serdes_group: "23" + speed: "100G" + sysport: "153" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "157" + lanes: "4:4" + serdes_group: "23" + speed: "100G" + sysport: "157" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "161" + lanes: "0:4" + serdes_group: "16" + speed: "100G" + sysport: "161" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "165" + lanes: "4:4" + serdes_group: "16" + speed: "100G" + sysport: "165" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "169" + lanes: "0:4" + serdes_group: "17" + speed: "100G" + sysport: "169" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "173" + lanes: "4:4" + serdes_group: "17" + speed: "100G" + sysport: "173" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "177" + lanes: "0:4" + serdes_group: "18" + speed: "100G" + sysport: "177" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "181" + lanes: "4:4" + serdes_group: "18" + speed: "100G" + sysport: "181" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "185" + lanes: "0:4" + serdes_group: "19" + speed: "100G" + sysport: "185" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "189" + lanes: "4:4" + serdes_group: "19" + speed: "100G" + sysport: "189" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "193" + lanes: "0:4" + serdes_group: "12" + speed: "100G" + sysport: "193" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "197" + lanes: "4:4" + serdes_group: "12" + speed: "100G" + sysport: "197" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "201" + lanes: "0:4" + serdes_group: "13" + speed: "100G" + sysport: "201" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "205" + lanes: "4:4" + serdes_group: "13" + speed: "100G" + sysport: "205" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "209" + lanes: "0:4" + serdes_group: "14" + speed: "100G" + sysport: "209" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "213" + lanes: "4:4" + serdes_group: "14" + speed: "100G" + sysport: "213" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "217" + lanes: "0:4" + serdes_group: "15" + speed: "100G" + sysport: "217" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "221" + lanes: "4:4" + serdes_group: "15" + speed: "100G" + sysport: "221" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "225" + lanes: "0:4" + serdes_group: "8" + speed: "100G" + sysport: "225" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "229" + lanes: "4:4" + serdes_group: "8" + speed: "100G" + sysport: "229" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "233" + lanes: "0:4" + serdes_group: "9" + speed: "100G" + sysport: "233" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "237" + lanes: "4:4" + serdes_group: "9" + speed: "100G" + sysport: "237" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "241" + lanes: "0:4" + serdes_group: "10" + speed: "100G" + sysport: "241" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "245" + lanes: "4:4" + serdes_group: "10" + speed: "100G" + sysport: "245" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "249" + lanes: "0:4" + serdes_group: "11" + speed: "100G" + sysport: "249" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + - fec: "KRFEC" + id: "253" + lanes: "4:4" + serdes_group: "11" + speed: "100G" + sysport: "253" + type: "eth" + link_training: "true" + bp_tech_ability: "100GBASE_KR4,100GBASE_CR4,100GBASE_KR2_CR2" + auto_neg: "true" + isg: + - id: "0" + tx_polarity: "01011011" + rx_polarity: "11001111" + lane_swap: "01234567" + - id: "1" + tx_polarity: "01011011" + rx_polarity: "01001111" + lane_swap: "01234567" + - id: "2" + tx_polarity: "01101001" + rx_polarity: "00001111" + lane_swap: "73215460" + - id: "3" + tx_polarity: "01111111" + rx_polarity: "10011111" + lane_swap: "71234560" + - id: "4" + tx_polarity: "01000111" + rx_polarity: "11010110" + lane_swap: "01235467" + - id: "5" + tx_polarity: "01001011" + rx_polarity: "01001111" + lane_swap: "01234567" + - id: "6" + tx_polarity: "01111001" + rx_polarity: "01001011" + lane_swap: "73215460" + - id: "7" + tx_polarity: "11101111" + rx_polarity: "01110111" + lane_swap: "72614035" + - id: "8" + tx_polarity: "00101001" + rx_polarity: "01101001" + lane_swap: "01234567" + - id: "9" + tx_polarity: "00101001" + rx_polarity: "01101001" + lane_swap: "01234567" + - id: "10" + tx_polarity: "01001011" + rx_polarity: "01101001" + lane_swap: "73215460" + - id: "11" + tx_polarity: "00001001" + rx_polarity: "00011000" + lane_swap: "71635420" + - id: "12" + tx_polarity: "00101001" + rx_polarity: "10001001" + lane_swap: "01234567" + - id: "13" + tx_polarity: "01100101" + rx_polarity: "00000111" + lane_swap: "01235467" + - id: "14" + tx_polarity: "00001011" + rx_polarity: "00000011" + lane_swap: "73215460" + - id: "15" + tx_polarity: "00001001" + rx_polarity: "01001001" + lane_swap: "73615420" + - id: "16" + tx_polarity: "00101001" + rx_polarity: "00001011" + lane_swap: "01234567" + - id: "17" + tx_polarity: "00100101" + rx_polarity: "00000111" + lane_swap: "01235467" + - id: "18" + tx_polarity: "01001010" + rx_polarity: "01001011" + lane_swap: "73215460" + - id: "19" + tx_polarity: "00111111" + rx_polarity: "00001011" + lane_swap: "73615420" + - id: "20" + tx_polarity: "01001101" + rx_polarity: "11101011" + lane_swap: "01234567" + - id: "21" + tx_polarity: "11011011" + rx_polarity: "10001011" + lane_swap: "01234567" + - id: "22" + tx_polarity: "01111001" + rx_polarity: "10001111" + lane_swap: "73215460" + - id: "23" + tx_polarity: "01111011" + rx_polarity: "01011100" + lane_swap: "73615420" + - id: "24" + tx_polarity: "01011011" + rx_polarity: "01101101" + lane_swap: "01234567" + - id: "25" + tx_polarity: "01001011" + rx_polarity: "01101101" + lane_swap: "01234567" + - id: "26" + tx_polarity: "01111001" + rx_polarity: "01101101" + lane_swap: "73215460" + - id: "27" + tx_polarity: "01001111" + rx_polarity: "01001000" + lane_swap: "73615420" + - id: "28" + tx_polarity: "01000111" + rx_polarity: "01011001" + lane_swap: "01235467" + - id: "29" + tx_polarity: "01011011" + rx_polarity: "11001010" + lane_swap: "01234567" + - id: "30" + tx_polarity: "01111001" + rx_polarity: "11001010" + lane_swap: "73215460" + - id: "31" + tx_polarity: "01011011" + rx_polarity: "11101010" + lane_swap: "73615420" + - id: "32" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" diff --git a/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/innovium.77700_A b/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/innovium.77700_A new file mode 100644 index 0000000000..84aa419836 --- /dev/null +++ b/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/innovium.77700_A @@ -0,0 +1,59 @@ +sku: innovium.77700_A + +device_id: 0x1b58 + +# Hardware constraint information +hardware: + num_ibs: 6 + + ports_per_ib: 32, 32, 32, 32, 20, 20 + recirc_port_num: 32, 32, 32, 32, 32, 32 + cpu_port_num: 33 + cpu_port_ib: 0 + mgmt_port_num: 33 + mgmt_port_ibs: 1,2 + + pics_per_ib: 6, 7, 6, 5, 5, 5 + pic_ports_per_pic: 8 + max_serdes_speed: 50 + + num_shared_pics: 2 + + isg [0-4]: + ib: 0 + pic_id: [0-4] + + isg [5-9]: + ib: 5 + pic_id: [0-4] + + isg [10-14]: + ib: 1 + pic_id: [0-4] + + isg [16-20]: + ib: 3 + pic_id: [0-4] + + isg [21-25]: + ib: 4 + pic_id: [0-4] + + isg [26-30]: + ib: 2 + pic_id: [0-4] + + isg 15: + mode: 8:0 + ib: 1 + pic_id: 5 + + isg 31: + mode: 8:0 + ib: 0 + pic_id: 5 + + isg 32: + mode: 1:1 + ib: 1, 2 + pic_id: 6 diff --git a/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/innovium.77700_B b/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/innovium.77700_B new file mode 100644 index 0000000000..27297b3139 --- /dev/null +++ b/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/innovium.77700_B @@ -0,0 +1,59 @@ +sku: innovium.77700_B + +device_id: 0x1b58 + +# Hardware constraint information +hardware: + num_ibs: 6 + + ports_per_ib: 32, 32, 32, 32, 20, 20 + recirc_port_num: 32, 32, 32, 32, 32, 32 + cpu_port_num: 33 + cpu_port_ib: 0 + mgmt_port_num: 33 + mgmt_port_ibs: 1,2 + + pics_per_ib: 6, 7, 7, 6, 5, 5 + pic_ports_per_pic: 8 + max_serdes_speed: 50 + + num_shared_pics: 2 + + isg [0-4]: + ib: 0 + pic_id: [0-4] + + isg [5-9]: + ib: 5 + pic_id: [0-4] + + isg [10-14]: + ib: 1 + pic_id: [0-4] + + isg [16-20]: + ib: 3 + pic_id: [0-4] + + isg [21-25]: + ib: 4 + pic_id: [0-4] + + isg [26-30]: + ib: 2 + pic_id: [0-4] + + isg 15: + mode: 4:4 + ib: 1, 3 + pic_id: 5 + + isg 31: + mode: 4:4 + ib: 0, 2 + pic_id: 5 + + isg 32: + mode: 1:1 + ib: 1, 2 + pic_id: 6 diff --git a/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/ivm.sai.config.yaml b/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/ivm.sai.config.yaml new file mode 100755 index 0000000000..dc8e200ec1 --- /dev/null +++ b/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/ivm.sai.config.yaml @@ -0,0 +1,8 @@ +IFCS_INIT_FILE : "/usr/share/sonic/hwsku/config_64x100G_fab128.yaml" +IFCS_SKU_FILE : "/usr/share/sonic/hwsku/innovium.77700_B" +IFCS_INNO_CLI_PORT : "9999" +IFCS_TARGET : "device" +INNOVIUM_DIR : "/innovium" +PYTHONPATH : "$INNOVIUM_DIR:$INNOVIUM_DIR/cmds:$INNOVIUM_DIR/scripts:$INNOVIUM_DIR/test/:$INNOVIUM_DIR/test/utils:$INNOVIUM_DIR/utils:$INNOVIUM_DIR/pyctypes" +IVM_SAI_DATAPATH_CONFIG_FILE: "/usr/share/sonic/hwsku/ivm.sai.datapath.config.yaml" +IVM_SAI_PARAM_A0008: "32" diff --git a/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/ivm.sai.datapath.config.yaml b/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/ivm.sai.datapath.config.yaml new file mode 100644 index 0000000000..891b0b3e28 --- /dev/null +++ b/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/ivm.sai.datapath.config.yaml @@ -0,0 +1,9 @@ +ISAI_PARAM_P0_0_LS : "4608 4608 4608 4608 2880 2880" +ISAI_PARAM_P0_1_LS : "2226 1946 1946 1890 1218 1218" +ISAI_PARAM_P0_1_ALS : "434 154 154 98 98 98" +ISAI_PARAM_P1_0_LS : "1536 1536 1536 1536 960 960" +ISAI_PARAM_P1_0_LL : "3072 3072 3072 3072 1920 1920" +ISAI_PARAM_P1_1_LS : "1778 1498 1498 1442 938 938" +ISAI_PARAM_P1_1_LL : "2478 2478 2478 2478 2478 2478" +ISAI_PARAM_P1_1_ALS : "434 154 154 98 98 98" +ISAI_PARAM_P1_1_ALL : "126 126 126 126 126 126" diff --git a/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/pg_profile_lookup.ini b/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/pg_profile_lookup.ini new file mode 100644 index 0000000000..adcb52ab2a --- /dev/null +++ b/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/pg_profile_lookup.ini @@ -0,0 +1,18 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 25000 5m 1518 0 15680 1 13440 + 50000 5m 1518 0 21248 1 13440 + 100000 5m 1518 0 34624 1 13440 + 400000 5m 1518 0 117536 1 13440 + 25000 40m 1518 0 16928 1 13440 + 50000 40m 1518 0 23392 1 13440 + 100000 40m 1518 0 38816 1 13440 + 400000 40m 1518 0 135520 1 13440 + 25000 100m 1518 0 18848 1 13440 + 50000 100m 1518 0 27264 1 13440 + 100000 100m 1518 0 46496 1 13440 + 400000 100m 1518 0 166688 1 13440 + 25000 300m 1518 0 25184 1 13440 + 50000 300m 1518 0 40128 1 13440 + 100000 300m 1518 0 72384 1 13440 + 400000 300m 1518 0 268640 1 13440 diff --git a/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/port_config.ini b/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/port_config.ini new file mode 100644 index 0000000000..112be08612 --- /dev/null +++ b/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/port_config.ini @@ -0,0 +1,65 @@ +# name lanes alias speed index mtu fec +Ethernet0 33,34,35,36 C1 100000 0 9126 rs +Ethernet4 37,38,39,40 C2 100000 1 9126 rs +Ethernet8 41,42,43,44 C3 100000 2 9126 rs +Ethernet12 45,46,47,48 C4 100000 3 9126 rs +Ethernet16 49,50,51,52 C5 100000 4 9126 rs +Ethernet20 53,54,55,56 C6 100000 5 9126 rs +Ethernet24 57,58,59,60 C7 100000 6 9126 rs +Ethernet28 61,62,63,64 C8 100000 7 9126 rs +Ethernet32 1,2,3,4 C9 100000 8 9126 rs +Ethernet36 5,6,7,8 C10 100000 9 9126 rs +Ethernet40 9,10,11,12 C11 100000 10 9126 rs +Ethernet44 13,14,15,16 C12 100000 11 9126 rs +Ethernet48 17,18,19,20 C13 100000 12 9126 rs +Ethernet52 21,22,23,24 C14 100000 13 9126 rs +Ethernet56 25,26,27,28 C15 100000 14 9126 rs +Ethernet60 29,30,31,32 C16 100000 15 9126 rs +Ethernet64 225,226,227,228 C17 100000 16 9126 rs +Ethernet68 229,230,231,232 C18 100000 17 9126 rs +Ethernet72 233,234,235,236 C19 100000 18 9126 rs +Ethernet76 237,238,239,240 C20 100000 19 9126 rs +Ethernet80 241,242,243,244 C21 100000 20 9126 rs +Ethernet84 245,246,247,248 C22 100000 21 9126 rs +Ethernet88 249,250,251,252 C23 100000 22 9126 rs +Ethernet92 253,254,255,256 C24 100000 23 9126 rs +Ethernet96 193,194,195,196 C25 100000 24 9126 rs +Ethernet100 197,198,199,200 C26 100000 25 9126 rs +Ethernet104 201,202,203,204 C27 100000 26 9126 rs +Ethernet108 205,206,207,208 C28 100000 27 9126 rs +Ethernet112 209,210,211,212 C29 100000 28 9126 rs +Ethernet116 213,214,215,216 C30 100000 29 9126 rs +Ethernet120 217,218,219,220 C31 100000 30 9126 rs +Ethernet124 221,222,223,224 C32 100000 31 9126 rs +Ethernet128 161,162,163,164 C33 100000 32 9126 rs +Ethernet132 165,166,167,168 C34 100000 33 9126 rs +Ethernet136 169,170,171,172 C35 100000 34 9126 rs +Ethernet140 173,174,175,176 C36 100000 35 9126 rs +Ethernet144 177,178,179,180 C37 100000 36 9126 rs +Ethernet148 181,182,183,184 C38 100000 37 9126 rs +Ethernet152 185,186,187,188 C39 100000 38 9126 rs +Ethernet156 189,190,191,192 C40 100000 39 9126 rs +Ethernet160 129,130,131,132 C41 100000 40 9126 rs +Ethernet164 133,134,135,136 C42 100000 41 9126 rs +Ethernet168 137,138,139,140 C43 100000 42 9126 rs +Ethernet172 141,142,143,144 C44 100000 43 9126 rs +Ethernet176 145,146,147,148 C45 100000 44 9126 rs +Ethernet180 149,150,151,152 C46 100000 45 9126 rs +Ethernet184 153,154,155,156 C47 100000 46 9126 rs +Ethernet188 157,158,159,160 C48 100000 47 9126 rs +Ethernet192 97,98,99,100 C49 100000 48 9126 rs +Ethernet196 101,102,103,104 C50 100000 49 9126 rs +Ethernet200 105,106,107,108 C51 100000 50 9126 rs +Ethernet204 109,110,111,112 C52 100000 51 9126 rs +Ethernet208 113,114,115,116 C53 100000 52 9126 rs +Ethernet212 117,118,119,120 C54 100000 53 9126 rs +Ethernet216 121,122,123,124 C55 100000 54 9126 rs +Ethernet220 125,126,127,128 C56 100000 55 9126 rs +Ethernet224 65,66,67,68 C57 100000 56 9126 rs +Ethernet228 69,70,71,72 C58 100000 57 9126 rs +Ethernet232 73,74,75,76 C59 100000 58 9126 rs +Ethernet236 77,78,79,80 C60 100000 59 9126 rs +Ethernet240 81,82,83,84 C61 100000 60 9126 rs +Ethernet244 85,86,87,88 C62 100000 61 9126 rs +Ethernet248 89,90,91,92 C63 100000 62 9126 rs +Ethernet252 93,94,95,96 C64 100000 63 9126 rs diff --git a/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/qos.json.j2 b/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/qos.json.j2 new file mode 100644 index 0000000000..4b9748c7b5 --- /dev/null +++ b/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/qos.json.j2 @@ -0,0 +1,114 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "0":"0", + "1":"1", + "2":"2", + "3":"3", + "4":"4", + "5":"5", + "6":"6", + "7":"7" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "red_min_threshold":"50000" + } + } +} diff --git a/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/qos_defaults_def_lossy.j2 b/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/qos_defaults_def_lossy.j2 new file mode 100755 index 0000000000..104d2d78de --- /dev/null +++ b/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/qos_defaults_def_lossy.j2 @@ -0,0 +1,118 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "0":"0", + "1":"1", + "2":"2", + "3":"3", + "4":"4", + "5":"5", + "6":"6", + "7":"7" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"0", + "4":"0", + "5":"0", + "6":"0", + "7":"0", + "8":"0", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]" + } + }, + "SCHEDULER": { + "scheduler.7": { + "type": "STRICT" + } + }, + "QUEUE": { + "{{ port_names }}|7": { + "scheduler": "[SCHEDULER|scheduler.7]" + } + } +} diff --git a/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/qos_defaults_t1.j2 b/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/qos_defaults_t1.j2 new file mode 100755 index 0000000000..4b9748c7b5 --- /dev/null +++ b/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/qos_defaults_t1.j2 @@ -0,0 +1,114 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "0":"0", + "1":"1", + "2":"2", + "3":"3", + "4":"4", + "5":"5", + "6":"6", + "7":"7" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "red_min_threshold":"50000" + } + } +} diff --git a/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/sai.profile b/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/sai.profile new file mode 100644 index 0000000000..aba4fc81fb --- /dev/null +++ b/device/cameo/x86_64-fabric_1208i-r0/fabric-1208i/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/ivm.sai.config.yaml diff --git a/device/cameo/x86_64-fabric_1208i-r0/topo.conf b/device/cameo/x86_64-fabric_1208i-r0/topo.conf new file mode 100644 index 0000000000..795ea43143 --- /dev/null +++ b/device/cameo/x86_64-fabric_1208i-r0/topo.conf @@ -0,0 +1 @@ +t1 diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/buffers.json.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/buffers.json.j2 index ada7dca895..93dac6b199 100644 --- a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/buffers.json.j2 +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/buffers.json.j2 @@ -93,7 +93,7 @@ "pool":"[BUFFER_POOL|ingress_lossless_pool]", "xoff":"38816", "size":"1518", - "dynamic_th":"3", + "dynamic_th":"1", "xon_offset":"13440" }, "egress_lossless_profile": { @@ -109,7 +109,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/buffers_defaults_def_lossy.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/buffers_defaults_def_lossy.j2 index fa2b49e634..1a31812c26 100644 --- a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/buffers_defaults_def_lossy.j2 +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/buffers_defaults_def_lossy.j2 @@ -22,7 +22,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/buffers_defaults_t1.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/buffers_defaults_t1.j2 index ada7dca895..93dac6b199 100644 --- a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/buffers_defaults_t1.j2 +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/buffers_defaults_t1.j2 @@ -93,7 +93,7 @@ "pool":"[BUFFER_POOL|ingress_lossless_pool]", "xoff":"38816", "size":"1518", - "dynamic_th":"3", + "dynamic_th":"1", "xon_offset":"13440" }, "egress_lossless_profile": { @@ -109,7 +109,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/ivm.sai.config.yaml b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/ivm.sai.config.yaml index 1cc93db620..7725af94fe 100755 --- a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/ivm.sai.config.yaml +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/ivm.sai.config.yaml @@ -4,6 +4,5 @@ IFCS_INNO_CLI_PORT : "9999" IFCS_TARGET : "device" INNOVIUM_DIR : "/innovium" PYTHONPATH : "$INNOVIUM_DIR:$INNOVIUM_DIR/cmds:$INNOVIUM_DIR/scripts:$INNOVIUM_DIR/test/:$INNOVIUM_DIR/test/utils:$INNOVIUM_DIR/utils:$INNOVIUM_DIR/pyctypes" -AVG_IPG_RESERVED_SIZE: "1518" -AVG_QUEUE_RESERVED_SIZE: "1518" IVM_SAI_DATAPATH_CONFIG_FILE: "/usr/share/sonic/hwsku/ivm.sai.datapath.config.yaml" +IVM_SAI_PARAM_A0008: "32" diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/pg_profile_lookup.ini b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/pg_profile_lookup.ini index 27775dfff7..adcb52ab2a 100644 --- a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/pg_profile_lookup.ini +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/pg_profile_lookup.ini @@ -1,14 +1,18 @@ # PG lossless profiles. # speed cable size xon xoff threshold xon_offset - 25000 5m 1518 0 15680 3 13440 - 50000 5m 1518 0 21152 3 13440 - 100000 5m 1518 0 34336 3 13440 - 400000 5m 1518 0 117376 3 13440 - 25000 40m 1518 0 16800 3 13440 - 50000 40m 1518 0 23392 3 13440 - 100000 40m 1518 0 38816 3 13440 - 400000 40m 1518 0 135296 3 13440 - 25000 300m 1518 0 25120 3 13440 - 50000 300m 1518 0 40032 3 13440 - 100000 300m 1518 0 72096 3 13440 - 400000 300m 1518 0 268416 3 13440 + 25000 5m 1518 0 15680 1 13440 + 50000 5m 1518 0 21248 1 13440 + 100000 5m 1518 0 34624 1 13440 + 400000 5m 1518 0 117536 1 13440 + 25000 40m 1518 0 16928 1 13440 + 50000 40m 1518 0 23392 1 13440 + 100000 40m 1518 0 38816 1 13440 + 400000 40m 1518 0 135520 1 13440 + 25000 100m 1518 0 18848 1 13440 + 50000 100m 1518 0 27264 1 13440 + 100000 100m 1518 0 46496 1 13440 + 400000 100m 1518 0 166688 1 13440 + 25000 300m 1518 0 25184 1 13440 + 50000 300m 1518 0 40128 1 13440 + 100000 300m 1518 0 72384 1 13440 + 400000 300m 1518 0 268640 1 13440 diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/qos.json.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/qos.json.j2 index 3938fc1a05..4b9748c7b5 100755 --- a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/qos.json.j2 +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/qos.json.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", "pfc_enable": "3,4" } }, diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/qos_defaults_def_lossy.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/qos_defaults_def_lossy.j2 index 205242d829..104d2d78de 100755 --- a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/qos_defaults_def_lossy.j2 +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/qos_defaults_def_lossy.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]" + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]" } }, "SCHEDULER": { diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/qos_defaults_t1.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/qos_defaults_t1.j2 index 3938fc1a05..4b9748c7b5 100755 --- a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/qos_defaults_t1.j2 +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/qos_defaults_t1.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", "pfc_enable": "3,4" } }, diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/buffers.json.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/buffers.json.j2 index ada7dca895..93dac6b199 100644 --- a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/buffers.json.j2 +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/buffers.json.j2 @@ -93,7 +93,7 @@ "pool":"[BUFFER_POOL|ingress_lossless_pool]", "xoff":"38816", "size":"1518", - "dynamic_th":"3", + "dynamic_th":"1", "xon_offset":"13440" }, "egress_lossless_profile": { @@ -109,7 +109,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/buffers_defaults_def_lossy.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/buffers_defaults_def_lossy.j2 index fa2b49e634..1a31812c26 100644 --- a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/buffers_defaults_def_lossy.j2 +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/buffers_defaults_def_lossy.j2 @@ -22,7 +22,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/buffers_defaults_t1.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/buffers_defaults_t1.j2 index ada7dca895..93dac6b199 100644 --- a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/buffers_defaults_t1.j2 +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/buffers_defaults_t1.j2 @@ -93,7 +93,7 @@ "pool":"[BUFFER_POOL|ingress_lossless_pool]", "xoff":"38816", "size":"1518", - "dynamic_th":"3", + "dynamic_th":"1", "xon_offset":"13440" }, "egress_lossless_profile": { @@ -109,7 +109,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/ivm.sai.config.yaml b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/ivm.sai.config.yaml index 81b706e922..ca615421d2 100755 --- a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/ivm.sai.config.yaml +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/ivm.sai.config.yaml @@ -4,6 +4,5 @@ IFCS_INNO_CLI_PORT : "9999" IFCS_TARGET : "device" INNOVIUM_DIR : "/innovium" PYTHONPATH : "$INNOVIUM_DIR:$INNOVIUM_DIR/cmds:$INNOVIUM_DIR/scripts:$INNOVIUM_DIR/test/:$INNOVIUM_DIR/test/utils:$INNOVIUM_DIR/utils:$INNOVIUM_DIR/pyctypes" -AVG_IPG_RESERVED_SIZE: "1518" -AVG_QUEUE_RESERVED_SIZE: "1518" IVM_SAI_DATAPATH_CONFIG_FILE: "/usr/share/sonic/hwsku/ivm.sai.datapath.config.yaml" +IVM_SAI_PARAM_A0008: "32" diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/pg_profile_lookup.ini b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/pg_profile_lookup.ini index 27775dfff7..adcb52ab2a 100644 --- a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/pg_profile_lookup.ini +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/pg_profile_lookup.ini @@ -1,14 +1,18 @@ # PG lossless profiles. # speed cable size xon xoff threshold xon_offset - 25000 5m 1518 0 15680 3 13440 - 50000 5m 1518 0 21152 3 13440 - 100000 5m 1518 0 34336 3 13440 - 400000 5m 1518 0 117376 3 13440 - 25000 40m 1518 0 16800 3 13440 - 50000 40m 1518 0 23392 3 13440 - 100000 40m 1518 0 38816 3 13440 - 400000 40m 1518 0 135296 3 13440 - 25000 300m 1518 0 25120 3 13440 - 50000 300m 1518 0 40032 3 13440 - 100000 300m 1518 0 72096 3 13440 - 400000 300m 1518 0 268416 3 13440 + 25000 5m 1518 0 15680 1 13440 + 50000 5m 1518 0 21248 1 13440 + 100000 5m 1518 0 34624 1 13440 + 400000 5m 1518 0 117536 1 13440 + 25000 40m 1518 0 16928 1 13440 + 50000 40m 1518 0 23392 1 13440 + 100000 40m 1518 0 38816 1 13440 + 400000 40m 1518 0 135520 1 13440 + 25000 100m 1518 0 18848 1 13440 + 50000 100m 1518 0 27264 1 13440 + 100000 100m 1518 0 46496 1 13440 + 400000 100m 1518 0 166688 1 13440 + 25000 300m 1518 0 25184 1 13440 + 50000 300m 1518 0 40128 1 13440 + 100000 300m 1518 0 72384 1 13440 + 400000 300m 1518 0 268640 1 13440 diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/qos.json.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/qos.json.j2 index 3938fc1a05..4b9748c7b5 100755 --- a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/qos.json.j2 +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/qos.json.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", "pfc_enable": "3,4" } }, diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/qos_defaults_def_lossy.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/qos_defaults_def_lossy.j2 index 205242d829..104d2d78de 100755 --- a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/qos_defaults_def_lossy.j2 +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/qos_defaults_def_lossy.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]" + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]" } }, "SCHEDULER": { diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/qos_defaults_t1.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/qos_defaults_t1.j2 index 3938fc1a05..4b9748c7b5 100755 --- a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/qos_defaults_t1.j2 +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/qos_defaults_t1.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", "pfc_enable": "3,4" } }, diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/buffers.json.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/buffers.json.j2 index ada7dca895..93dac6b199 100644 --- a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/buffers.json.j2 +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/buffers.json.j2 @@ -93,7 +93,7 @@ "pool":"[BUFFER_POOL|ingress_lossless_pool]", "xoff":"38816", "size":"1518", - "dynamic_th":"3", + "dynamic_th":"1", "xon_offset":"13440" }, "egress_lossless_profile": { @@ -109,7 +109,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/buffers_defaults_def_lossy.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/buffers_defaults_def_lossy.j2 index fa2b49e634..1a31812c26 100644 --- a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/buffers_defaults_def_lossy.j2 +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/buffers_defaults_def_lossy.j2 @@ -22,7 +22,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/buffers_defaults_t1.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/buffers_defaults_t1.j2 index ada7dca895..93dac6b199 100644 --- a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/buffers_defaults_t1.j2 +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/buffers_defaults_t1.j2 @@ -93,7 +93,7 @@ "pool":"[BUFFER_POOL|ingress_lossless_pool]", "xoff":"38816", "size":"1518", - "dynamic_th":"3", + "dynamic_th":"1", "xon_offset":"13440" }, "egress_lossless_profile": { @@ -109,7 +109,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/ivm.sai.config.yaml b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/ivm.sai.config.yaml index 1751962805..bc9c7eabdd 100755 --- a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/ivm.sai.config.yaml +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/ivm.sai.config.yaml @@ -4,6 +4,5 @@ IFCS_INNO_CLI_PORT : "9999" IFCS_TARGET : "device" INNOVIUM_DIR : "/innovium" PYTHONPATH : "$INNOVIUM_DIR:$INNOVIUM_DIR/cmds:$INNOVIUM_DIR/scripts:$INNOVIUM_DIR/test/:$INNOVIUM_DIR/test/utils:$INNOVIUM_DIR/utils:$INNOVIUM_DIR/pyctypes" -AVG_IPG_RESERVED_SIZE: "1518" -AVG_QUEUE_RESERVED_SIZE: "1518" IVM_SAI_DATAPATH_CONFIG_FILE: "/usr/share/sonic/hwsku/ivm.sai.datapath.config.yaml" +IVM_SAI_PARAM_A0008: "32" diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/pg_profile_lookup.ini b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/pg_profile_lookup.ini index 27775dfff7..adcb52ab2a 100644 --- a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/pg_profile_lookup.ini +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/pg_profile_lookup.ini @@ -1,14 +1,18 @@ # PG lossless profiles. # speed cable size xon xoff threshold xon_offset - 25000 5m 1518 0 15680 3 13440 - 50000 5m 1518 0 21152 3 13440 - 100000 5m 1518 0 34336 3 13440 - 400000 5m 1518 0 117376 3 13440 - 25000 40m 1518 0 16800 3 13440 - 50000 40m 1518 0 23392 3 13440 - 100000 40m 1518 0 38816 3 13440 - 400000 40m 1518 0 135296 3 13440 - 25000 300m 1518 0 25120 3 13440 - 50000 300m 1518 0 40032 3 13440 - 100000 300m 1518 0 72096 3 13440 - 400000 300m 1518 0 268416 3 13440 + 25000 5m 1518 0 15680 1 13440 + 50000 5m 1518 0 21248 1 13440 + 100000 5m 1518 0 34624 1 13440 + 400000 5m 1518 0 117536 1 13440 + 25000 40m 1518 0 16928 1 13440 + 50000 40m 1518 0 23392 1 13440 + 100000 40m 1518 0 38816 1 13440 + 400000 40m 1518 0 135520 1 13440 + 25000 100m 1518 0 18848 1 13440 + 50000 100m 1518 0 27264 1 13440 + 100000 100m 1518 0 46496 1 13440 + 400000 100m 1518 0 166688 1 13440 + 25000 300m 1518 0 25184 1 13440 + 50000 300m 1518 0 40128 1 13440 + 100000 300m 1518 0 72384 1 13440 + 400000 300m 1518 0 268640 1 13440 diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/qos.json.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/qos.json.j2 index 3938fc1a05..4b9748c7b5 100755 --- a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/qos.json.j2 +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/qos.json.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", "pfc_enable": "3,4" } }, diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/qos_defaults_def_lossy.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/qos_defaults_def_lossy.j2 index 205242d829..104d2d78de 100755 --- a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/qos_defaults_def_lossy.j2 +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/qos_defaults_def_lossy.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]" + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]" } }, "SCHEDULER": { diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/qos_defaults_t1.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/qos_defaults_t1.j2 index 3938fc1a05..4b9748c7b5 100755 --- a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/qos_defaults_t1.j2 +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/qos_defaults_t1.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", "pfc_enable": "3,4" } }, diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/buffers.json.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/buffers.json.j2 index ada7dca895..93dac6b199 100644 --- a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/buffers.json.j2 +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/buffers.json.j2 @@ -93,7 +93,7 @@ "pool":"[BUFFER_POOL|ingress_lossless_pool]", "xoff":"38816", "size":"1518", - "dynamic_th":"3", + "dynamic_th":"1", "xon_offset":"13440" }, "egress_lossless_profile": { @@ -109,7 +109,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/buffers_defaults_def_lossy.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/buffers_defaults_def_lossy.j2 index fa2b49e634..1a31812c26 100644 --- a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/buffers_defaults_def_lossy.j2 +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/buffers_defaults_def_lossy.j2 @@ -22,7 +22,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/buffers_defaults_t1.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/buffers_defaults_t1.j2 index ada7dca895..93dac6b199 100644 --- a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/buffers_defaults_t1.j2 +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/buffers_defaults_t1.j2 @@ -93,7 +93,7 @@ "pool":"[BUFFER_POOL|ingress_lossless_pool]", "xoff":"38816", "size":"1518", - "dynamic_th":"3", + "dynamic_th":"1", "xon_offset":"13440" }, "egress_lossless_profile": { @@ -109,7 +109,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/ivm.sai.config.yaml b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/ivm.sai.config.yaml index bb55cd03a6..ac0a862dbc 100755 --- a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/ivm.sai.config.yaml +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/ivm.sai.config.yaml @@ -4,6 +4,5 @@ IFCS_INNO_CLI_PORT : "9999" IFCS_TARGET : "device" INNOVIUM_DIR : "/innovium" PYTHONPATH : "$INNOVIUM_DIR:$INNOVIUM_DIR/cmds:$INNOVIUM_DIR/scripts:$INNOVIUM_DIR/test/:$INNOVIUM_DIR/test/utils:$INNOVIUM_DIR/utils:$INNOVIUM_DIR/pyctypes" -AVG_IPG_RESERVED_SIZE: "1518" -AVG_QUEUE_RESERVED_SIZE: "1518" IVM_SAI_DATAPATH_CONFIG_FILE: "/usr/share/sonic/hwsku/ivm.sai.datapath.config.yaml" +IVM_SAI_PARAM_A0008: "32" diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/pg_profile_lookup.ini b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/pg_profile_lookup.ini index 27775dfff7..adcb52ab2a 100644 --- a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/pg_profile_lookup.ini +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/pg_profile_lookup.ini @@ -1,14 +1,18 @@ # PG lossless profiles. # speed cable size xon xoff threshold xon_offset - 25000 5m 1518 0 15680 3 13440 - 50000 5m 1518 0 21152 3 13440 - 100000 5m 1518 0 34336 3 13440 - 400000 5m 1518 0 117376 3 13440 - 25000 40m 1518 0 16800 3 13440 - 50000 40m 1518 0 23392 3 13440 - 100000 40m 1518 0 38816 3 13440 - 400000 40m 1518 0 135296 3 13440 - 25000 300m 1518 0 25120 3 13440 - 50000 300m 1518 0 40032 3 13440 - 100000 300m 1518 0 72096 3 13440 - 400000 300m 1518 0 268416 3 13440 + 25000 5m 1518 0 15680 1 13440 + 50000 5m 1518 0 21248 1 13440 + 100000 5m 1518 0 34624 1 13440 + 400000 5m 1518 0 117536 1 13440 + 25000 40m 1518 0 16928 1 13440 + 50000 40m 1518 0 23392 1 13440 + 100000 40m 1518 0 38816 1 13440 + 400000 40m 1518 0 135520 1 13440 + 25000 100m 1518 0 18848 1 13440 + 50000 100m 1518 0 27264 1 13440 + 100000 100m 1518 0 46496 1 13440 + 400000 100m 1518 0 166688 1 13440 + 25000 300m 1518 0 25184 1 13440 + 50000 300m 1518 0 40128 1 13440 + 100000 300m 1518 0 72384 1 13440 + 400000 300m 1518 0 268640 1 13440 diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/qos.json.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/qos.json.j2 index 3938fc1a05..4b9748c7b5 100755 --- a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/qos.json.j2 +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/qos.json.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", "pfc_enable": "3,4" } }, diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/qos_defaults_def_lossy.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/qos_defaults_def_lossy.j2 index 205242d829..104d2d78de 100755 --- a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/qos_defaults_def_lossy.j2 +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/qos_defaults_def_lossy.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]" + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]" } }, "SCHEDULER": { diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/qos_defaults_t1.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/qos_defaults_t1.j2 index 3938fc1a05..4b9748c7b5 100755 --- a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/qos_defaults_t1.j2 +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/qos_defaults_t1.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", "pfc_enable": "3,4" } }, diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100nrz/buffers.json.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100nrz/buffers.json.j2 index 7e537dddd1..e70268bee8 100644 --- a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100nrz/buffers.json.j2 +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100nrz/buffers.json.j2 @@ -77,7 +77,7 @@ "pool":"[BUFFER_POOL|ingress_lossless_pool]", "xoff":"38166", "size":"1518", - "dynamic_th":"-4", + "dynamic_th":"1", "xon_offset":"13440" }, "ingress_lossy_profile": { @@ -93,7 +93,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|egress_lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100nrz/ivm.sai.config.yaml b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100nrz/ivm.sai.config.yaml index f7a9a79067..7ad9c806fd 100755 --- a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100nrz/ivm.sai.config.yaml +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100nrz/ivm.sai.config.yaml @@ -4,6 +4,5 @@ IFCS_INNO_CLI_PORT : "9999" IFCS_TARGET : "device" INNOVIUM_DIR : "/innovium" PYTHONPATH : "$INNOVIUM_DIR:$INNOVIUM_DIR/cmds:$INNOVIUM_DIR/scripts:$INNOVIUM_DIR/test/:$INNOVIUM_DIR/test/utils" -AVG_IPG_RESERVED_SIZE: "1518" -AVG_QUEUE_RESERVED_SIZE: "1518" IVM_SAI_DATAPATH_CONFIG_FILE: "/usr/share/sonic/hwsku/ivm.sai.datapath.config.yaml" +IVM_SAI_PARAM_A0008: "32" diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100nrz/qos.json.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100nrz/qos.json.j2 index b22aa6ef59..56e2b411e2 100755 --- a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100nrz/qos.json.j2 +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100nrz/qos.json.j2 @@ -93,9 +93,9 @@ }, "PORT_QOS_MAP": { "Ethernet180,Ethernet8,Ethernet44,Ethernet184,Ethernet188,Ethernet0,Ethernet4,Ethernet108,Ethernet248,Ethernet100,Ethernet244,Ethernet128,Ethernet104,Ethernet240,Ethernet40,Ethernet228,Ethernet96,Ethernet168,Ethernet148,Ethernet204,Ethernet120,Ethernet220,Ethernet144,Ethernet208,Ethernet160,Ethernet224,Ethernet140,Ethernet56,Ethernet164,Ethernet76,Ethernet72,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet196,Ethernet28,Ethernet192,Ethernet200,Ethernet124,Ethernet24,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet152,Ethernet136,Ethernet156,Ethernet92,Ethernet132,Ethernet48,Ethernet232,Ethernet172,Ethernet216,Ethernet236,Ethernet176,Ethernet212,Ethernet64,Ethernet88,Ethernet60,Ethernet52,Ethernet20,Ethernet68,Ethernet252": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", "pfc_enable": "4,5" } } diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/buffers.json.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/buffers.json.j2 index ada7dca895..93dac6b199 100644 --- a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/buffers.json.j2 +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/buffers.json.j2 @@ -93,7 +93,7 @@ "pool":"[BUFFER_POOL|ingress_lossless_pool]", "xoff":"38816", "size":"1518", - "dynamic_th":"3", + "dynamic_th":"1", "xon_offset":"13440" }, "egress_lossless_profile": { @@ -109,7 +109,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/buffers_defaults_def_lossy.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/buffers_defaults_def_lossy.j2 index fa2b49e634..1a31812c26 100644 --- a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/buffers_defaults_def_lossy.j2 +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/buffers_defaults_def_lossy.j2 @@ -22,7 +22,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/buffers_defaults_t1.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/buffers_defaults_t1.j2 index ada7dca895..93dac6b199 100644 --- a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/buffers_defaults_t1.j2 +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/buffers_defaults_t1.j2 @@ -93,7 +93,7 @@ "pool":"[BUFFER_POOL|ingress_lossless_pool]", "xoff":"38816", "size":"1518", - "dynamic_th":"3", + "dynamic_th":"1", "xon_offset":"13440" }, "egress_lossless_profile": { @@ -109,7 +109,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/ivm.sai.config.yaml b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/ivm.sai.config.yaml index e762aafe39..61246f89ce 100755 --- a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/ivm.sai.config.yaml +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/ivm.sai.config.yaml @@ -4,6 +4,5 @@ IFCS_INNO_CLI_PORT : "9999" IFCS_TARGET : "device" INNOVIUM_DIR : "/innovium" PYTHONPATH : "$INNOVIUM_DIR:$INNOVIUM_DIR/cmds:$INNOVIUM_DIR/scripts:$INNOVIUM_DIR/test/:$INNOVIUM_DIR/test/utils:$INNOVIUM_DIR/utils:$INNOVIUM_DIR/pyctypes" -AVG_IPG_RESERVED_SIZE: "1518" -AVG_QUEUE_RESERVED_SIZE: "1518" IVM_SAI_DATAPATH_CONFIG_FILE: "/usr/share/sonic/hwsku/ivm.sai.datapath.config.yaml" +IVM_SAI_PARAM_A0008: "32" diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/pg_profile_lookup.ini b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/pg_profile_lookup.ini index 27775dfff7..adcb52ab2a 100644 --- a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/pg_profile_lookup.ini +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/pg_profile_lookup.ini @@ -1,14 +1,18 @@ # PG lossless profiles. # speed cable size xon xoff threshold xon_offset - 25000 5m 1518 0 15680 3 13440 - 50000 5m 1518 0 21152 3 13440 - 100000 5m 1518 0 34336 3 13440 - 400000 5m 1518 0 117376 3 13440 - 25000 40m 1518 0 16800 3 13440 - 50000 40m 1518 0 23392 3 13440 - 100000 40m 1518 0 38816 3 13440 - 400000 40m 1518 0 135296 3 13440 - 25000 300m 1518 0 25120 3 13440 - 50000 300m 1518 0 40032 3 13440 - 100000 300m 1518 0 72096 3 13440 - 400000 300m 1518 0 268416 3 13440 + 25000 5m 1518 0 15680 1 13440 + 50000 5m 1518 0 21248 1 13440 + 100000 5m 1518 0 34624 1 13440 + 400000 5m 1518 0 117536 1 13440 + 25000 40m 1518 0 16928 1 13440 + 50000 40m 1518 0 23392 1 13440 + 100000 40m 1518 0 38816 1 13440 + 400000 40m 1518 0 135520 1 13440 + 25000 100m 1518 0 18848 1 13440 + 50000 100m 1518 0 27264 1 13440 + 100000 100m 1518 0 46496 1 13440 + 400000 100m 1518 0 166688 1 13440 + 25000 300m 1518 0 25184 1 13440 + 50000 300m 1518 0 40128 1 13440 + 100000 300m 1518 0 72384 1 13440 + 400000 300m 1518 0 268640 1 13440 diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/qos.json.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/qos.json.j2 index 3938fc1a05..4b9748c7b5 100755 --- a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/qos.json.j2 +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/qos.json.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", "pfc_enable": "3,4" } }, diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/qos_defaults_def_lossy.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/qos_defaults_def_lossy.j2 index 205242d829..104d2d78de 100755 --- a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/qos_defaults_def_lossy.j2 +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/qos_defaults_def_lossy.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]" + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]" } }, "SCHEDULER": { diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/qos_defaults_t1.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/qos_defaults_t1.j2 index 3938fc1a05..4b9748c7b5 100755 --- a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/qos_defaults_t1.j2 +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/qos_defaults_t1.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", "pfc_enable": "3,4" } }, diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/alt_cfg/port_config_aux.ini b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/alt_cfg/port_config_aux.ini deleted file mode 100755 index b02a938b34..0000000000 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/alt_cfg/port_config_aux.ini +++ /dev/null @@ -1,35 +0,0 @@ -# name lanes alias speed index mtu fec -Ethernet0 249,250,251,252 Eth1 400000 0 9126 rs -Ethernet8 241,242,243,244 Eth2 400000 1 9126 rs -Ethernet16 233,234,235,236 Eth3 400000 2 9126 rs -Ethernet24 225,226,227,228 Eth4 400000 3 9126 rs -Ethernet32 217,218,219,220 Eth5 400000 4 9126 rs -Ethernet40 209,210,211,212 Eth6 400000 5 9126 rs -Ethernet48 201,202,203,204 Eth7 400000 6 9126 rs -Ethernet56 193,194,195,196 Eth8 400000 7 9126 rs -Ethernet64 185,186,187,188 Eth9 400000 8 9126 rs -Ethernet72 177,178,179,180 Eth10 400000 9 9126 rs -Ethernet80 169,170,171,172 Eth11 400000 10 9126 rs -Ethernet88 161,162,163,164 Eth12 400000 11 9126 rs -Ethernet96 153,154,155,156 Eth13 400000 12 9126 rs -Ethernet104 145,146,147,148 Eth14 400000 13 9126 rs -Ethernet112 137,138,139,140 Eth15 400000 14 9126 rs -Ethernet120 129,130,131,132 Eth16 400000 15 9126 rs -Ethernet128 121,122,123,124 Eth17 400000 16 9126 rs -Ethernet136 113,114,115,116 Eth18 400000 17 9126 rs -Ethernet144 97,98,99,100 Eth19 400000 18 9126 rs -Ethernet152 105,106,107,108 Eth20 400000 19 9126 rs -Ethernet160 81,82,83,84 Eth21 400000 20 9126 rs -Ethernet168 89,90,91,92 Eth22 400000 21 9126 rs -Ethernet176 65,66,67,68 Eth23 400000 22 9126 rs -Ethernet184 73,74,75,76 Eth24 400000 23 9126 rs -Ethernet192 49,50,51,52 Eth25 400000 24 9126 rs -Ethernet200 57,58,59,60 Eth26 400000 25 9126 rs -Ethernet208 33,34,35,36 Eth27 400000 26 9126 rs -Ethernet216 41,42,43,44 Eth28 400000 27 9126 rs -Ethernet224 17,18,19,20 Eth29 400000 28 9126 rs -Ethernet232 25,26,27,28 Eth30 400000 29 9126 rs -Ethernet240 1,2,3,4 Eth31 400000 30 9126 rs -Ethernet248 9,10,11,12 Eth32 400000 31 9126 rs -Ethernet256 257 Aux1 10000 32 9126 none -Ethernet257 258 Aux2 10000 33 9126 none diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/buffers.json.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/buffers.json.j2 index ada7dca895..93dac6b199 100644 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/buffers.json.j2 +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/buffers.json.j2 @@ -93,7 +93,7 @@ "pool":"[BUFFER_POOL|ingress_lossless_pool]", "xoff":"38816", "size":"1518", - "dynamic_th":"3", + "dynamic_th":"1", "xon_offset":"13440" }, "egress_lossless_profile": { @@ -109,7 +109,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/buffers_defaults_def_lossy.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/buffers_defaults_def_lossy.j2 index fa2b49e634..1a31812c26 100644 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/buffers_defaults_def_lossy.j2 +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/buffers_defaults_def_lossy.j2 @@ -22,7 +22,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/buffers_defaults_t1.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/buffers_defaults_t1.j2 index ada7dca895..93dac6b199 100644 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/buffers_defaults_t1.j2 +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/buffers_defaults_t1.j2 @@ -93,7 +93,7 @@ "pool":"[BUFFER_POOL|ingress_lossless_pool]", "xoff":"38816", "size":"1518", - "dynamic_th":"3", + "dynamic_th":"1", "xon_offset":"13440" }, "egress_lossless_profile": { @@ -109,7 +109,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/ivm.sai.config.yaml b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/ivm.sai.config.yaml index 30a83d145e..b897ed8fcc 100755 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/ivm.sai.config.yaml +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/ivm.sai.config.yaml @@ -4,6 +4,5 @@ IFCS_INNO_CLI_PORT : "9999" IFCS_TARGET : "device" INNOVIUM_DIR : "/innovium" PYTHONPATH : "$INNOVIUM_DIR:$INNOVIUM_DIR/cmds:$INNOVIUM_DIR/scripts:$INNOVIUM_DIR/test/:$INNOVIUM_DIR/test/utils:$INNOVIUM_DIR/utils:$INNOVIUM_DIR/pyctypes" -AVG_IPG_RESERVED_SIZE: "1518" -AVG_QUEUE_RESERVED_SIZE: "1518" IVM_SAI_DATAPATH_CONFIG_FILE: "/usr/share/sonic/hwsku/ivm.sai.datapath.config.yaml" +IVM_SAI_PARAM_A0008: "32" diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/pg_profile_lookup.ini b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/pg_profile_lookup.ini index 27775dfff7..adcb52ab2a 100644 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/pg_profile_lookup.ini +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/pg_profile_lookup.ini @@ -1,14 +1,18 @@ # PG lossless profiles. # speed cable size xon xoff threshold xon_offset - 25000 5m 1518 0 15680 3 13440 - 50000 5m 1518 0 21152 3 13440 - 100000 5m 1518 0 34336 3 13440 - 400000 5m 1518 0 117376 3 13440 - 25000 40m 1518 0 16800 3 13440 - 50000 40m 1518 0 23392 3 13440 - 100000 40m 1518 0 38816 3 13440 - 400000 40m 1518 0 135296 3 13440 - 25000 300m 1518 0 25120 3 13440 - 50000 300m 1518 0 40032 3 13440 - 100000 300m 1518 0 72096 3 13440 - 400000 300m 1518 0 268416 3 13440 + 25000 5m 1518 0 15680 1 13440 + 50000 5m 1518 0 21248 1 13440 + 100000 5m 1518 0 34624 1 13440 + 400000 5m 1518 0 117536 1 13440 + 25000 40m 1518 0 16928 1 13440 + 50000 40m 1518 0 23392 1 13440 + 100000 40m 1518 0 38816 1 13440 + 400000 40m 1518 0 135520 1 13440 + 25000 100m 1518 0 18848 1 13440 + 50000 100m 1518 0 27264 1 13440 + 100000 100m 1518 0 46496 1 13440 + 400000 100m 1518 0 166688 1 13440 + 25000 300m 1518 0 25184 1 13440 + 50000 300m 1518 0 40128 1 13440 + 100000 300m 1518 0 72384 1 13440 + 400000 300m 1518 0 268640 1 13440 diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/qos.json.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/qos.json.j2 index 3938fc1a05..4b9748c7b5 100755 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/qos.json.j2 +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/qos.json.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", "pfc_enable": "3,4" } }, diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/qos_defaults_def_lossy.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/qos_defaults_def_lossy.j2 index 205242d829..104d2d78de 100755 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/qos_defaults_def_lossy.j2 +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/qos_defaults_def_lossy.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]" + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]" } }, "SCHEDULER": { diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/qos_defaults_t1.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/qos_defaults_t1.j2 index 3938fc1a05..4b9748c7b5 100755 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/qos_defaults_t1.j2 +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/qos_defaults_t1.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", "pfc_enable": "3,4" } }, diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/alt_cfg/config_128x100G_Delta-et-c032if_aux.yaml b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/alt_cfg/config_128x100G_Delta-et-c032if_aux.yaml deleted file mode 100755 index ad50fd04c2..0000000000 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/alt_cfg/config_128x100G_Delta-et-c032if_aux.yaml +++ /dev/null @@ -1,1102 +0,0 @@ -ifcs: - options: - log_level: "info" -nodes: -- node_id: "0" - options: - sku: "configs/sku/innovium.77700_B" - netdev: - - auto_create: "no" - multi_interface: "yes" - buffer_management_mode: "api_driven" - max_lossless_tc: "2" - txring: - - txring_id: "0" - desc_count: "1024" - prio: "1" - netdev: "true" - - txring_id: "1" - desc_count: "1024" - prio: "1" - netdev: "true" - - txring_id: "2" - desc_count: "1024" - prio: "1" - netdev: "true" - - txring_id: "3" - desc_count: "1024" - prio: "1" - netdev: "true" - rxring: - - rxring_id: "0" - desc_count: "1024" - prio: "1" - netdev: "true" - queues: "0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44" - - rxring_id: "1" - desc_count: "1024" - prio: "1" - netdev: "true" - queues: "1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45" - - rxring_id: "2" - desc_count: "1024" - prio: "1" - netdev: "true" - queues: "2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46" - - rxring_id: "3" - desc_count: "1024" - prio: "1" - netdev: "true" - queues: "3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47" - sys_clk: "1720" - ifc_clk: "1200" - mac_clk: "1340" - - devports: - - id: "0" - sysport: "1000" - type: "cpu" - - fec: "KPFEC" - id: "249" - lanes: "0:2" - serdes_group: "31" - speed: "100G" - sysport: "249" - type: "eth" - - fec: "KPFEC" - id: "251" - lanes: "2:2" - serdes_group: "31" - speed: "100G" - sysport: "251" - type: "eth" - - fec: "KPFEC" - id: "253" - lanes: "4:2" - serdes_group: "31" - speed: "100G" - sysport: "253" - type: "eth" - - fec: "KPFEC" - id: "255" - lanes: "6:2" - serdes_group: "31" - speed: "100G" - sysport: "255" - type: "eth" - - fec: "KPFEC" - id: "241" - lanes: "0:2" - serdes_group: "30" - speed: "100G" - sysport: "241" - type: "eth" - - fec: "KPFEC" - id: "243" - lanes: "2:2" - serdes_group: "30" - speed: "100G" - sysport: "243" - type: "eth" - - fec: "KPFEC" - id: "245" - lanes: "4:2" - serdes_group: "30" - speed: "100G" - sysport: "245" - type: "eth" - - fec: "KPFEC" - id: "247" - lanes: "6:2" - serdes_group: "30" - speed: "100G" - sysport: "247" - type: "eth" - - fec: "KPFEC" - id: "233" - lanes: "0:2" - serdes_group: "29" - speed: "100G" - sysport: "233" - type: "eth" - - fec: "KPFEC" - id: "235" - lanes: "2:2" - serdes_group: "29" - speed: "100G" - sysport: "235" - type: "eth" - - fec: "KPFEC" - id: "237" - lanes: "4:2" - serdes_group: "29" - speed: "100G" - sysport: "237" - type: "eth" - - fec: "KPFEC" - id: "239" - lanes: "6:2" - serdes_group: "29" - speed: "100G" - sysport: "239" - type: "eth" - - fec: "KPFEC" - id: "225" - lanes: "0:2" - serdes_group: "28" - speed: "100G" - sysport: "225" - type: "eth" - - fec: "KPFEC" - id: "227" - lanes: "2:2" - serdes_group: "28" - speed: "100G" - sysport: "227" - type: "eth" - - fec: "KPFEC" - id: "229" - lanes: "4:2" - serdes_group: "28" - speed: "100G" - sysport: "229" - type: "eth" - - fec: "KPFEC" - id: "231" - lanes: "6:2" - serdes_group: "28" - speed: "100G" - sysport: "231" - type: "eth" - - fec: "KPFEC" - id: "217" - lanes: "0:2" - serdes_group: "27" - speed: "100G" - sysport: "217" - type: "eth" - - fec: "KPFEC" - id: "219" - lanes: "2:2" - serdes_group: "27" - speed: "100G" - sysport: "219" - type: "eth" - - fec: "KPFEC" - id: "221" - lanes: "4:2" - serdes_group: "27" - speed: "100G" - sysport: "221" - type: "eth" - - fec: "KPFEC" - id: "223" - lanes: "6:2" - serdes_group: "27" - speed: "100G" - sysport: "223" - type: "eth" - - fec: "KPFEC" - id: "209" - lanes: "0:2" - serdes_group: "26" - speed: "100G" - sysport: "209" - type: "eth" - - fec: "KPFEC" - id: "211" - lanes: "2:2" - serdes_group: "26" - speed: "100G" - sysport: "211" - type: "eth" - - fec: "KPFEC" - id: "213" - lanes: "4:2" - serdes_group: "26" - speed: "100G" - sysport: "213" - type: "eth" - - fec: "KPFEC" - id: "215" - lanes: "6:2" - serdes_group: "26" - speed: "100G" - sysport: "215" - type: "eth" - - fec: "KPFEC" - id: "201" - lanes: "0:2" - serdes_group: "25" - speed: "100G" - sysport: "201" - type: "eth" - - fec: "KPFEC" - id: "203" - lanes: "2:2" - serdes_group: "25" - speed: "100G" - sysport: "203" - type: "eth" - - fec: "KPFEC" - id: "205" - lanes: "4:2" - serdes_group: "25" - speed: "100G" - sysport: "205" - type: "eth" - - fec: "KPFEC" - id: "207" - lanes: "6:2" - serdes_group: "25" - speed: "100G" - sysport: "207" - type: "eth" - - fec: "KPFEC" - id: "193" - lanes: "0:2" - serdes_group: "24" - speed: "100G" - sysport: "193" - type: "eth" - - fec: "KPFEC" - id: "195" - lanes: "2:2" - serdes_group: "24" - speed: "100G" - sysport: "195" - type: "eth" - - fec: "KPFEC" - id: "197" - lanes: "4:2" - serdes_group: "24" - speed: "100G" - sysport: "197" - type: "eth" - - fec: "KPFEC" - id: "199" - lanes: "6:2" - serdes_group: "24" - speed: "100G" - sysport: "199" - type: "eth" - - fec: "KPFEC" - id: "185" - lanes: "0:2" - serdes_group: "23" - speed: "100G" - sysport: "185" - type: "eth" - - fec: "KPFEC" - id: "187" - lanes: "2:2" - serdes_group: "23" - speed: "100G" - sysport: "187" - type: "eth" - - fec: "KPFEC" - id: "189" - lanes: "4:2" - serdes_group: "23" - speed: "100G" - sysport: "189" - type: "eth" - - fec: "KPFEC" - id: "191" - lanes: "6:2" - serdes_group: "23" - speed: "100G" - sysport: "191" - type: "eth" - - fec: "KPFEC" - id: "177" - lanes: "0:2" - serdes_group: "22" - speed: "100G" - sysport: "177" - type: "eth" - - fec: "KPFEC" - id: "179" - lanes: "2:2" - serdes_group: "22" - speed: "100G" - sysport: "179" - type: "eth" - - fec: "KPFEC" - id: "181" - lanes: "4:2" - serdes_group: "22" - speed: "100G" - sysport: "181" - type: "eth" - - fec: "KPFEC" - id: "183" - lanes: "6:2" - serdes_group: "22" - speed: "100G" - sysport: "183" - type: "eth" - - fec: "KPFEC" - id: "169" - lanes: "0:2" - serdes_group: "21" - speed: "100G" - sysport: "169" - type: "eth" - - fec: "KPFEC" - id: "171" - lanes: "2:2" - serdes_group: "21" - speed: "100G" - sysport: "171" - type: "eth" - - fec: "KPFEC" - id: "173" - lanes: "4:2" - serdes_group: "21" - speed: "100G" - sysport: "173" - type: "eth" - - fec: "KPFEC" - id: "175" - lanes: "6:2" - serdes_group: "21" - speed: "100G" - sysport: "175" - type: "eth" - - fec: "KPFEC" - id: "161" - lanes: "0:2" - serdes_group: "20" - speed: "100G" - sysport: "161" - type: "eth" - - fec: "KPFEC" - id: "163" - lanes: "2:2" - serdes_group: "20" - speed: "100G" - sysport: "163" - type: "eth" - - fec: "KPFEC" - id: "165" - lanes: "4:2" - serdes_group: "20" - speed: "100G" - sysport: "165" - type: "eth" - - fec: "KPFEC" - id: "167" - lanes: "6:2" - serdes_group: "20" - speed: "100G" - sysport: "167" - type: "eth" - - fec: "KPFEC" - id: "153" - lanes: "0:2" - serdes_group: "19" - speed: "100G" - sysport: "153" - type: "eth" - - fec: "KPFEC" - id: "155" - lanes: "2:2" - serdes_group: "19" - speed: "100G" - sysport: "155" - type: "eth" - - fec: "KPFEC" - id: "157" - lanes: "4:2" - serdes_group: "19" - speed: "100G" - sysport: "157" - type: "eth" - - fec: "KPFEC" - id: "159" - lanes: "6:2" - serdes_group: "19" - speed: "100G" - sysport: "159" - type: "eth" - - fec: "KPFEC" - id: "145" - lanes: "0:2" - serdes_group: "18" - speed: "100G" - sysport: "145" - type: "eth" - - fec: "KPFEC" - id: "147" - lanes: "2:2" - serdes_group: "18" - speed: "100G" - sysport: "147" - type: "eth" - - fec: "KPFEC" - id: "149" - lanes: "4:2" - serdes_group: "18" - speed: "100G" - sysport: "149" - type: "eth" - - fec: "KPFEC" - id: "151" - lanes: "6:2" - serdes_group: "18" - speed: "100G" - sysport: "151" - type: "eth" - - fec: "KPFEC" - id: "137" - lanes: "0:2" - serdes_group: "17" - speed: "100G" - sysport: "137" - type: "eth" - - fec: "KPFEC" - id: "139" - lanes: "2:2" - serdes_group: "17" - speed: "100G" - sysport: "139" - type: "eth" - - fec: "KPFEC" - id: "141" - lanes: "4:2" - serdes_group: "17" - speed: "100G" - sysport: "141" - type: "eth" - - fec: "KPFEC" - id: "143" - lanes: "6:2" - serdes_group: "17" - speed: "100G" - sysport: "143" - type: "eth" - - fec: "KPFEC" - id: "129" - lanes: "0:2" - serdes_group: "16" - speed: "100G" - sysport: "129" - type: "eth" - - fec: "KPFEC" - id: "131" - lanes: "2:2" - serdes_group: "16" - speed: "100G" - sysport: "131" - type: "eth" - - fec: "KPFEC" - id: "133" - lanes: "4:2" - serdes_group: "16" - speed: "100G" - sysport: "133" - type: "eth" - - fec: "KPFEC" - id: "135" - lanes: "6:2" - serdes_group: "16" - speed: "100G" - sysport: "135" - type: "eth" - - fec: "KPFEC" - id: "121" - lanes: "0:2" - serdes_group: "15" - speed: "100G" - sysport: "121" - type: "eth" - - fec: "KPFEC" - id: "123" - lanes: "2:2" - serdes_group: "15" - speed: "100G" - sysport: "123" - type: "eth" - - fec: "KPFEC" - id: "125" - lanes: "4:2" - serdes_group: "15" - speed: "100G" - sysport: "125" - type: "eth" - - fec: "KPFEC" - id: "127" - lanes: "6:2" - serdes_group: "15" - speed: "100G" - sysport: "127" - type: "eth" - - fec: "KPFEC" - id: "113" - lanes: "0:2" - serdes_group: "14" - speed: "100G" - sysport: "113" - type: "eth" - - fec: "KPFEC" - id: "115" - lanes: "2:2" - serdes_group: "14" - speed: "100G" - sysport: "115" - type: "eth" - - fec: "KPFEC" - id: "117" - lanes: "4:2" - serdes_group: "14" - speed: "100G" - sysport: "117" - type: "eth" - - fec: "KPFEC" - id: "119" - lanes: "6:2" - serdes_group: "14" - speed: "100G" - sysport: "119" - type: "eth" - - fec: "KPFEC" - id: "97" - lanes: "0:2" - serdes_group: "12" - speed: "100G" - sysport: "97" - type: "eth" - - fec: "KPFEC" - id: "99" - lanes: "2:2" - serdes_group: "12" - speed: "100G" - sysport: "99" - type: "eth" - - fec: "KPFEC" - id: "101" - lanes: "4:2" - serdes_group: "12" - speed: "100G" - sysport: "101" - type: "eth" - - fec: "KPFEC" - id: "103" - lanes: "6:2" - serdes_group: "12" - speed: "100G" - sysport: "103" - type: "eth" - - fec: "KPFEC" - id: "105" - lanes: "0:2" - serdes_group: "13" - speed: "100G" - sysport: "105" - type: "eth" - - fec: "KPFEC" - id: "107" - lanes: "2:2" - serdes_group: "13" - speed: "100G" - sysport: "107" - type: "eth" - - fec: "KPFEC" - id: "109" - lanes: "4:2" - serdes_group: "13" - speed: "100G" - sysport: "109" - type: "eth" - - fec: "KPFEC" - id: "111" - lanes: "6:2" - serdes_group: "13" - speed: "100G" - sysport: "111" - type: "eth" - - fec: "KPFEC" - id: "81" - lanes: "0:2" - serdes_group: "10" - speed: "100G" - sysport: "81" - type: "eth" - - fec: "KPFEC" - id: "83" - lanes: "2:2" - serdes_group: "10" - speed: "100G" - sysport: "83" - type: "eth" - - fec: "KPFEC" - id: "85" - lanes: "4:2" - serdes_group: "10" - speed: "100G" - sysport: "85" - type: "eth" - - fec: "KPFEC" - id: "87" - lanes: "6:2" - serdes_group: "10" - speed: "100G" - sysport: "87" - type: "eth" - - fec: "KPFEC" - id: "89" - lanes: "0:2" - serdes_group: "11" - speed: "100G" - sysport: "89" - type: "eth" - - fec: "KPFEC" - id: "91" - lanes: "2:2" - serdes_group: "11" - speed: "100G" - sysport: "91" - type: "eth" - - fec: "KPFEC" - id: "93" - lanes: "4:2" - serdes_group: "11" - speed: "100G" - sysport: "93" - type: "eth" - - fec: "KPFEC" - id: "95" - lanes: "6:2" - serdes_group: "11" - speed: "100G" - sysport: "95" - type: "eth" - - fec: "KPFEC" - id: "65" - lanes: "0:2" - serdes_group: "8" - speed: "100G" - sysport: "65" - type: "eth" - - fec: "KPFEC" - id: "67" - lanes: "2:2" - serdes_group: "8" - speed: "100G" - sysport: "67" - type: "eth" - - fec: "KPFEC" - id: "69" - lanes: "4:2" - serdes_group: "8" - speed: "100G" - sysport: "69" - type: "eth" - - fec: "KPFEC" - id: "71" - lanes: "6:2" - serdes_group: "8" - speed: "100G" - sysport: "71" - type: "eth" - - fec: "KPFEC" - id: "73" - lanes: "0:2" - serdes_group: "9" - speed: "100G" - sysport: "73" - type: "eth" - - fec: "KPFEC" - id: "75" - lanes: "2:2" - serdes_group: "9" - speed: "100G" - sysport: "75" - type: "eth" - - fec: "KPFEC" - id: "77" - lanes: "4:2" - serdes_group: "9" - speed: "100G" - sysport: "77" - type: "eth" - - fec: "KPFEC" - id: "79" - lanes: "6:2" - serdes_group: "9" - speed: "100G" - sysport: "79" - type: "eth" - - fec: "KPFEC" - id: "49" - lanes: "0:2" - serdes_group: "6" - speed: "100G" - sysport: "49" - type: "eth" - - fec: "KPFEC" - id: "51" - lanes: "2:2" - serdes_group: "6" - speed: "100G" - sysport: "51" - type: "eth" - - fec: "KPFEC" - id: "53" - lanes: "4:2" - serdes_group: "6" - speed: "100G" - sysport: "53" - type: "eth" - - fec: "KPFEC" - id: "55" - lanes: "6:2" - serdes_group: "6" - speed: "100G" - sysport: "55" - type: "eth" - - fec: "KPFEC" - id: "57" - lanes: "0:2" - serdes_group: "7" - speed: "100G" - sysport: "57" - type: "eth" - - fec: "KPFEC" - id: "59" - lanes: "2:2" - serdes_group: "7" - speed: "100G" - sysport: "59" - type: "eth" - - fec: "KPFEC" - id: "61" - lanes: "4:2" - serdes_group: "7" - speed: "100G" - sysport: "61" - type: "eth" - - fec: "KPFEC" - id: "63" - lanes: "6:2" - serdes_group: "7" - speed: "100G" - sysport: "63" - type: "eth" - - fec: "KPFEC" - id: "33" - lanes: "0:2" - serdes_group: "4" - speed: "100G" - sysport: "33" - type: "eth" - - fec: "KPFEC" - id: "35" - lanes: "2:2" - serdes_group: "4" - speed: "100G" - sysport: "35" - type: "eth" - - fec: "KPFEC" - id: "37" - lanes: "4:2" - serdes_group: "4" - speed: "100G" - sysport: "37" - type: "eth" - - fec: "KPFEC" - id: "39" - lanes: "6:2" - serdes_group: "4" - speed: "100G" - sysport: "39" - type: "eth" - - fec: "KPFEC" - id: "41" - lanes: "0:2" - serdes_group: "5" - speed: "100G" - sysport: "41" - type: "eth" - - fec: "KPFEC" - id: "43" - lanes: "2:2" - serdes_group: "5" - speed: "100G" - sysport: "43" - type: "eth" - - fec: "KPFEC" - id: "45" - lanes: "4:2" - serdes_group: "5" - speed: "100G" - sysport: "45" - type: "eth" - - fec: "KPFEC" - id: "47" - lanes: "6:2" - serdes_group: "5" - speed: "100G" - sysport: "47" - type: "eth" - - fec: "KPFEC" - id: "17" - lanes: "0:2" - serdes_group: "2" - speed: "100G" - sysport: "17" - type: "eth" - - fec: "KPFEC" - id: "19" - lanes: "2:2" - serdes_group: "2" - speed: "100G" - sysport: "19" - type: "eth" - - fec: "KPFEC" - id: "21" - lanes: "4:2" - serdes_group: "2" - speed: "100G" - sysport: "21" - type: "eth" - - fec: "KPFEC" - id: "23" - lanes: "6:2" - serdes_group: "2" - speed: "100G" - sysport: "23" - type: "eth" - - fec: "KPFEC" - id: "25" - lanes: "0:2" - serdes_group: "3" - speed: "100G" - sysport: "25" - type: "eth" - - fec: "KPFEC" - id: "27" - lanes: "2:2" - serdes_group: "3" - speed: "100G" - sysport: "27" - type: "eth" - - fec: "KPFEC" - id: "29" - lanes: "4:2" - serdes_group: "3" - speed: "100G" - sysport: "29" - type: "eth" - - fec: "KPFEC" - id: "31" - lanes: "6:2" - serdes_group: "3" - speed: "100G" - sysport: "31" - type: "eth" - - fec: "KPFEC" - id: "1" - lanes: "0:2" - serdes_group: "0" - speed: "100G" - sysport: "1" - type: "eth" - - fec: "KPFEC" - id: "3" - lanes: "2:2" - serdes_group: "0" - speed: "100G" - sysport: "3" - type: "eth" - - fec: "KPFEC" - id: "5" - lanes: "4:2" - serdes_group: "0" - speed: "100G" - sysport: "5" - type: "eth" - - fec: "KPFEC" - id: "7" - lanes: "6:2" - serdes_group: "0" - speed: "100G" - sysport: "7" - type: "eth" - - fec: "KPFEC" - id: "9" - lanes: "0:2" - serdes_group: "1" - speed: "100G" - sysport: "9" - type: "eth" - - fec: "KPFEC" - id: "11" - lanes: "2:2" - serdes_group: "1" - speed: "100G" - sysport: "11" - type: "eth" - - fec: "KPFEC" - id: "13" - lanes: "4:2" - serdes_group: "1" - speed: "100G" - sysport: "13" - type: "eth" - - fec: "KPFEC" - id: "15" - lanes: "6:2" - serdes_group: "1" - speed: "100G" - sysport: "15" - type: "eth" - - fec: "NONE" - id: "257" - lanes: "0:1" - serdes_group: "32" - speed: "10G" - sysport: "257" - type: "mgmt 0" - - fec: "NONE" - id: "258" - lanes: "1:1" - serdes_group: "32" - speed: "10G" - sysport: "258" - type: "mgmt 1" - - isg: - - id: "0" - tx_polarity: "01010101" - rx_polarity: "01100000" - lane_swap: "23641075" - - id: "1" - tx_polarity: "10110000" - rx_polarity: "11111111" - lane_swap: "64317520" - - id: "2" - tx_polarity: "00000000" - rx_polarity: "00000011" - lane_swap: "63147520" - - id: "3" - tx_polarity: "01101000" - rx_polarity: "00001110" - lane_swap: "31572046" - - id: "4" - tx_polarity: "00111000" - rx_polarity: "00001000" - lane_swap: "46105732" - - id: "5" - tx_polarity: "10111111" - rx_polarity: "11101000" - lane_swap: "27153604" - - id: "6" - tx_polarity: "01101110" - rx_polarity: "00001101" - lane_swap: "46503721" - - id: "7" - tx_polarity: "01000100" - rx_polarity: "10000101" - lane_swap: "03671245" - - id: "8" - tx_polarity: "01110101" - rx_polarity: "00010000" - lane_swap: "12640375" - - id: "9" - tx_polarity: "01011100" - rx_polarity: "11001111" - lane_swap: "02561347" - - id: "10" - tx_polarity: "01110110" - rx_polarity: "11000000" - lane_swap: "12740365" - - id: "11" - tx_polarity: "00111000" - rx_polarity: "00010111" - lane_swap: "01572436" - - id: "12" - tx_polarity: "00001111" - rx_polarity: "10111001" - lane_swap: "54320176" - - id: "13" - tx_polarity: "10011101" - rx_polarity: "00111011" - lane_swap: "26153704" - - id: "14" - tx_polarity: "00110000" - rx_polarity: "11010000" - lane_swap: "37452601" - - id: "15" - tx_polarity: "11100010" - rx_polarity: "01110011" - lane_swap: "51370462" - - id: "16" - tx_polarity: "10111010" - rx_polarity: "11010011" - lane_swap: "36152704" - - id: "17" - tx_polarity: "01011101" - rx_polarity: "00110001" - lane_swap: "45621073" - - id: "18" - tx_polarity: "11011111" - rx_polarity: "11001011" - lane_swap: "26143705" - - id: "19" - tx_polarity: "00100110" - rx_polarity: "00001001" - lane_swap: "42730165" - - id: "20" - tx_polarity: "10011011" - rx_polarity: "01101101" - lane_swap: "54217603" - - id: "21" - tx_polarity: "00101110" - rx_polarity: "10111111" - lane_swap: "26031745" - - id: "22" - tx_polarity: "01001110" - rx_polarity: "00111001" - lane_swap: "36024715" - - id: "23" - tx_polarity: "10101101" - rx_polarity: "01010011" - lane_swap: "45621370" - - id: "24" - tx_polarity: "11001110" - rx_polarity: "00011111" - lane_swap: "65234701" - - id: "25" - tx_polarity: "01110001" - rx_polarity: "01010111" - lane_swap: "37601452" - - id: "26" - tx_polarity: "01000100" - rx_polarity: "00001111" - lane_swap: "65034721" - - id: "27" - tx_polarity: "10111101" - rx_polarity: "11000101" - lane_swap: "34501672" - - id: "28" - tx_polarity: "01111000" - rx_polarity: "01110110" - lane_swap: "43061275" - - id: "29" - tx_polarity: "11110111" - rx_polarity: "11100111" - lane_swap: "57304621" - - id: "30" - tx_polarity: "10000100" - rx_polarity: "00101111" - lane_swap: "47125603" - - id: "31" - tx_polarity: "11111111" - rx_polarity: "11100010" - lane_swap: "13460275" - - id: "32" - tx_polarity: "00000000" - rx_polarity: "00000000" - lane_swap: "01234567" diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/alt_cfg/port_config_aux.ini b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/alt_cfg/port_config_aux.ini deleted file mode 100644 index b2e5a267f4..0000000000 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/alt_cfg/port_config_aux.ini +++ /dev/null @@ -1,131 +0,0 @@ -# name lanes alias speed index mtu -Ethernet0 249,250 Eth1/1 100000 0 9126 -Ethernet2 251,252 Eth1/2 100000 0 9126 -Ethernet4 253,254 Eth1/3 100000 0 9126 -Ethernet6 255,256 Eth1/4 100000 0 9126 -Ethernet8 241,242 Eth2/1 100000 1 9126 -Ethernet10 243,244 Eth2/2 100000 1 9126 -Ethernet12 245,246 Eth2/3 100000 1 9126 -Ethernet14 247,248 Eth2/4 100000 1 9126 -Ethernet16 233,234 Eth3/1 100000 2 9126 -Ethernet18 235,236 Eth3/2 100000 2 9126 -Ethernet20 237,238 Eth3/3 100000 2 9126 -Ethernet22 239,240 Eth3/4 100000 2 9126 -Ethernet24 225,226 Eth4/1 100000 3 9126 -Ethernet26 227,228 Eth4/2 100000 3 9126 -Ethernet28 229,230 Eth4/3 100000 3 9126 -Ethernet30 231,232 Eth4/4 100000 3 9126 -Ethernet32 217,218 Eth5/1 100000 4 9126 -Ethernet34 219,220 Eth5/2 100000 4 9126 -Ethernet36 221,222 Eth5/3 100000 4 9126 -Ethernet38 223,224 Eth5/4 100000 4 9126 -Ethernet40 209,210 Eth6/1 100000 5 9126 -Ethernet42 211,212 Eth6/2 100000 5 9126 -Ethernet44 213,214 Eth6/3 100000 5 9126 -Ethernet46 215,216 Eth6/4 100000 5 9126 -Ethernet48 201,202 Eth7/1 100000 6 9126 -Ethernet50 203,204 Eth7/2 100000 6 9126 -Ethernet52 205,206 Eth7/3 100000 6 9126 -Ethernet54 207,208 Eth7/4 100000 6 9126 -Ethernet56 193,194 Eth8/1 100000 7 9126 -Ethernet58 195,196 Eth8/2 100000 7 9126 -Ethernet60 197,198 Eth8/3 100000 7 9126 -Ethernet62 199,200 Eth8/4 100000 7 9126 -Ethernet64 185,186 Eth9/1 100000 8 9126 -Ethernet66 187,188 Eth9/2 100000 8 9126 -Ethernet68 189,190 Eth9/3 100000 8 9126 -Ethernet70 191,192 Eth9/4 100000 8 9126 -Ethernet72 177,178 Eth10/1 100000 9 9126 -Ethernet74 179,180 Eth10/2 100000 9 9126 -Ethernet76 181,182 Eth10/3 100000 9 9126 -Ethernet78 183,184 Eth10/4 100000 9 9126 -Ethernet80 169,170 Eth11/1 100000 10 9126 -Ethernet82 171,172 Eth11/2 100000 10 9126 -Ethernet84 173,174 Eth11/3 100000 10 9126 -Ethernet86 175,176 Eth11/4 100000 10 9126 -Ethernet88 161,162 Eth12/1 100000 11 9126 -Ethernet90 163,164 Eth12/2 100000 11 9126 -Ethernet92 165,166 Eth12/3 100000 11 9126 -Ethernet94 167,168 Eth12/4 100000 11 9126 -Ethernet96 153,154 Eth13/1 100000 12 9126 -Ethernet98 155,156 Eth13/2 100000 12 9126 -Ethernet100 157,158 Eth13/3 100000 12 9126 -Ethernet102 159,160 Eth13/4 100000 12 9126 -Ethernet104 145,146 Eth14/1 100000 13 9126 -Ethernet106 147,148 Eth14/2 100000 13 9126 -Ethernet108 149,150 Eth14/3 100000 13 9126 -Ethernet110 151,152 Eth14/4 100000 13 9126 -Ethernet112 137,138 Eth15/1 100000 14 9126 -Ethernet114 139,140 Eth15/2 100000 14 9126 -Ethernet116 141,142 Eth15/3 100000 14 9126 -Ethernet118 143,144 Eth15/4 100000 14 9126 -Ethernet120 129,130 Eth16/1 100000 15 9126 -Ethernet122 131,132 Eth16/2 100000 15 9126 -Ethernet124 133,134 Eth16/3 100000 15 9126 -Ethernet126 135,136 Eth16/4 100000 15 9126 -Ethernet128 121,122 Eth17/1 100000 16 9126 -Ethernet130 123,124 Eth17/2 100000 16 9126 -Ethernet132 125,126 Eth17/3 100000 16 9126 -Ethernet134 127,128 Eth17/4 100000 16 9126 -Ethernet136 113,114 Eth18/1 100000 17 9126 -Ethernet138 115,116 Eth18/2 100000 17 9126 -Ethernet140 117,118 Eth18/3 100000 17 9126 -Ethernet142 119,120 Eth18/4 100000 17 9126 -Ethernet144 97,98 Eth19/1 100000 18 9126 -Ethernet146 99,100 Eth19/2 100000 18 9126 -Ethernet148 101,102 Eth19/3 100000 18 9126 -Ethernet150 103,104 Eth19/4 100000 18 9126 -Ethernet152 105,106 Eth20/1 100000 19 9126 -Ethernet154 107,108 Eth20/2 100000 19 9126 -Ethernet156 109,110 Eth20/3 100000 19 9126 -Ethernet158 111,112 Eth20/4 100000 19 9126 -Ethernet160 81,82 Eth21/1 100000 20 9126 -Ethernet162 83,84 Eth21/2 100000 20 9126 -Ethernet164 85,86 Eth21/3 100000 20 9126 -Ethernet166 87,88 Eth21/4 100000 20 9126 -Ethernet168 89,90 Eth22/1 100000 21 9126 -Ethernet170 91,92 Eth22/2 100000 21 9126 -Ethernet172 93,94 Eth22/3 100000 21 9126 -Ethernet174 95,96 Eth22/4 100000 21 9126 -Ethernet176 65,66 Eth23/1 100000 22 9126 -Ethernet178 67,68 Eth23/2 100000 22 9126 -Ethernet180 69,70 Eth23/3 100000 22 9126 -Ethernet182 71,72 Eth23/4 100000 22 9126 -Ethernet184 73,74 Eth24/1 100000 23 9126 -Ethernet186 75,76 Eth24/2 100000 23 9126 -Ethernet188 77,78 Eth24/3 100000 23 9126 -Ethernet190 79,80 Eth24/4 100000 23 9126 -Ethernet192 49,50 Eth25/1 100000 24 9126 -Ethernet194 51,52 Eth25/2 100000 24 9126 -Ethernet196 53,54 Eth25/3 100000 24 9126 -Ethernet198 55,56 Eth25/4 100000 24 9126 -Ethernet200 57,58 Eth26/1 100000 25 9126 -Ethernet202 59,60 Eth26/2 100000 25 9126 -Ethernet204 61,62 Eth26/3 100000 25 9126 -Ethernet206 63,64 Eth26/4 100000 25 9126 -Ethernet208 33,34 Eth27/1 100000 26 9126 -Ethernet210 35,36 Eth27/2 100000 26 9126 -Ethernet212 37,38 Eth27/3 100000 26 9126 -Ethernet214 39,40 Eth27/4 100000 26 9126 -Ethernet216 41,42 Eth28/1 100000 27 9126 -Ethernet218 43,44 Eth28/2 100000 27 9126 -Ethernet220 45,46 Eth28/3 100000 27 9126 -Ethernet222 47,48 Eth28/4 100000 27 9126 -Ethernet224 17,18 Eth29/1 100000 28 9126 -Ethernet226 19,20 Eth29/2 100000 28 9126 -Ethernet228 21,22 Eth29/3 100000 28 9126 -Ethernet230 23,24 Eth29/4 100000 28 9126 -Ethernet232 25,26 Eth30/1 100000 29 9126 -Ethernet234 27,28 Eth30/2 100000 29 9126 -Ethernet236 29,30 Eth30/3 100000 29 9126 -Ethernet238 31,32 Eth30/4 100000 29 9126 -Ethernet240 1,2 Eth31/1 100000 30 9126 -Ethernet242 3,4 Eth31/2 100000 30 9126 -Ethernet244 5,6 Eth31/3 100000 30 9126 -Ethernet246 7,8 Eth31/4 100000 30 9126 -Ethernet248 9,10 Eth32/1 100000 31 9126 -Ethernet250 11,12 Eth32/2 100000 31 9126 -Ethernet252 13,14 Eth32/3 100000 31 9126 -Ethernet254 15,16 Eth32/4 100000 31 9126 -Ethernet256 257 Aux1 10000 32 9126 -Ethernet257 258 Aux2 10000 33 9126 diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/buffers.json.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/buffers.json.j2 index ada7dca895..93dac6b199 100644 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/buffers.json.j2 +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/buffers.json.j2 @@ -93,7 +93,7 @@ "pool":"[BUFFER_POOL|ingress_lossless_pool]", "xoff":"38816", "size":"1518", - "dynamic_th":"3", + "dynamic_th":"1", "xon_offset":"13440" }, "egress_lossless_profile": { @@ -109,7 +109,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/buffers_defaults_def_lossy.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/buffers_defaults_def_lossy.j2 index fa2b49e634..1a31812c26 100644 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/buffers_defaults_def_lossy.j2 +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/buffers_defaults_def_lossy.j2 @@ -22,7 +22,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/buffers_defaults_t1.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/buffers_defaults_t1.j2 index ada7dca895..93dac6b199 100644 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/buffers_defaults_t1.j2 +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/buffers_defaults_t1.j2 @@ -93,7 +93,7 @@ "pool":"[BUFFER_POOL|ingress_lossless_pool]", "xoff":"38816", "size":"1518", - "dynamic_th":"3", + "dynamic_th":"1", "xon_offset":"13440" }, "egress_lossless_profile": { @@ -109,7 +109,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/ivm.sai.config.yaml b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/ivm.sai.config.yaml index fdc892f315..f637b395a9 100755 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/ivm.sai.config.yaml +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/ivm.sai.config.yaml @@ -4,6 +4,5 @@ IFCS_INNO_CLI_PORT : "9999" IFCS_TARGET : "device" INNOVIUM_DIR : "/innovium" PYTHONPATH : "$INNOVIUM_DIR:$INNOVIUM_DIR/cmds:$INNOVIUM_DIR/scripts:$INNOVIUM_DIR/test/:$INNOVIUM_DIR/test/utils:$INNOVIUM_DIR/utils:$INNOVIUM_DIR/pyctypes" -AVG_IPG_RESERVED_SIZE: "1518" -AVG_QUEUE_RESERVED_SIZE: "1518" IVM_SAI_DATAPATH_CONFIG_FILE: "/usr/share/sonic/hwsku/ivm.sai.datapath.config.yaml" +IVM_SAI_PARAM_A0008: "32" diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/pg_profile_lookup.ini b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/pg_profile_lookup.ini index 27775dfff7..adcb52ab2a 100644 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/pg_profile_lookup.ini +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/pg_profile_lookup.ini @@ -1,14 +1,18 @@ # PG lossless profiles. # speed cable size xon xoff threshold xon_offset - 25000 5m 1518 0 15680 3 13440 - 50000 5m 1518 0 21152 3 13440 - 100000 5m 1518 0 34336 3 13440 - 400000 5m 1518 0 117376 3 13440 - 25000 40m 1518 0 16800 3 13440 - 50000 40m 1518 0 23392 3 13440 - 100000 40m 1518 0 38816 3 13440 - 400000 40m 1518 0 135296 3 13440 - 25000 300m 1518 0 25120 3 13440 - 50000 300m 1518 0 40032 3 13440 - 100000 300m 1518 0 72096 3 13440 - 400000 300m 1518 0 268416 3 13440 + 25000 5m 1518 0 15680 1 13440 + 50000 5m 1518 0 21248 1 13440 + 100000 5m 1518 0 34624 1 13440 + 400000 5m 1518 0 117536 1 13440 + 25000 40m 1518 0 16928 1 13440 + 50000 40m 1518 0 23392 1 13440 + 100000 40m 1518 0 38816 1 13440 + 400000 40m 1518 0 135520 1 13440 + 25000 100m 1518 0 18848 1 13440 + 50000 100m 1518 0 27264 1 13440 + 100000 100m 1518 0 46496 1 13440 + 400000 100m 1518 0 166688 1 13440 + 25000 300m 1518 0 25184 1 13440 + 50000 300m 1518 0 40128 1 13440 + 100000 300m 1518 0 72384 1 13440 + 400000 300m 1518 0 268640 1 13440 diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/qos.json.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/qos.json.j2 index 3938fc1a05..4b9748c7b5 100755 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/qos.json.j2 +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/qos.json.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", "pfc_enable": "3,4" } }, diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/qos_defaults_def_lossy.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/qos_defaults_def_lossy.j2 index 205242d829..104d2d78de 100755 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/qos_defaults_def_lossy.j2 +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/qos_defaults_def_lossy.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]" + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]" } }, "SCHEDULER": { diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/qos_defaults_t1.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/qos_defaults_t1.j2 index 3938fc1a05..4b9748c7b5 100755 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/qos_defaults_t1.j2 +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/qos_defaults_t1.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", "pfc_enable": "3,4" } }, diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/buffers.json.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/buffers.json.j2 index ada7dca895..93dac6b199 100644 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/buffers.json.j2 +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/buffers.json.j2 @@ -93,7 +93,7 @@ "pool":"[BUFFER_POOL|ingress_lossless_pool]", "xoff":"38816", "size":"1518", - "dynamic_th":"3", + "dynamic_th":"1", "xon_offset":"13440" }, "egress_lossless_profile": { @@ -109,7 +109,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/buffers_defaults_def_lossy.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/buffers_defaults_def_lossy.j2 index fa2b49e634..1a31812c26 100644 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/buffers_defaults_def_lossy.j2 +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/buffers_defaults_def_lossy.j2 @@ -22,7 +22,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/buffers_defaults_t1.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/buffers_defaults_t1.j2 index ada7dca895..93dac6b199 100644 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/buffers_defaults_t1.j2 +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/buffers_defaults_t1.j2 @@ -93,7 +93,7 @@ "pool":"[BUFFER_POOL|ingress_lossless_pool]", "xoff":"38816", "size":"1518", - "dynamic_th":"3", + "dynamic_th":"1", "xon_offset":"13440" }, "egress_lossless_profile": { @@ -109,7 +109,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/ivm.sai.config.yaml b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/ivm.sai.config.yaml index 6c5b901819..cddcc2214e 100755 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/ivm.sai.config.yaml +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/ivm.sai.config.yaml @@ -4,6 +4,5 @@ IFCS_INNO_CLI_PORT : "9999" IFCS_TARGET : "device" INNOVIUM_DIR : "/innovium" PYTHONPATH : "$INNOVIUM_DIR:$INNOVIUM_DIR/cmds:$INNOVIUM_DIR/scripts:$INNOVIUM_DIR/test/:$INNOVIUM_DIR/test/utils:$INNOVIUM_DIR/utils:$INNOVIUM_DIR/pyctypes" -AVG_IPG_RESERVED_SIZE: "1518" -AVG_QUEUE_RESERVED_SIZE: "1518" IVM_SAI_DATAPATH_CONFIG_FILE: "/usr/share/sonic/hwsku/ivm.sai.datapath.config.yaml" +IVM_SAI_PARAM_A0008: "32" diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/pg_profile_lookup.ini b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/pg_profile_lookup.ini index 27775dfff7..adcb52ab2a 100644 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/pg_profile_lookup.ini +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/pg_profile_lookup.ini @@ -1,14 +1,18 @@ # PG lossless profiles. # speed cable size xon xoff threshold xon_offset - 25000 5m 1518 0 15680 3 13440 - 50000 5m 1518 0 21152 3 13440 - 100000 5m 1518 0 34336 3 13440 - 400000 5m 1518 0 117376 3 13440 - 25000 40m 1518 0 16800 3 13440 - 50000 40m 1518 0 23392 3 13440 - 100000 40m 1518 0 38816 3 13440 - 400000 40m 1518 0 135296 3 13440 - 25000 300m 1518 0 25120 3 13440 - 50000 300m 1518 0 40032 3 13440 - 100000 300m 1518 0 72096 3 13440 - 400000 300m 1518 0 268416 3 13440 + 25000 5m 1518 0 15680 1 13440 + 50000 5m 1518 0 21248 1 13440 + 100000 5m 1518 0 34624 1 13440 + 400000 5m 1518 0 117536 1 13440 + 25000 40m 1518 0 16928 1 13440 + 50000 40m 1518 0 23392 1 13440 + 100000 40m 1518 0 38816 1 13440 + 400000 40m 1518 0 135520 1 13440 + 25000 100m 1518 0 18848 1 13440 + 50000 100m 1518 0 27264 1 13440 + 100000 100m 1518 0 46496 1 13440 + 400000 100m 1518 0 166688 1 13440 + 25000 300m 1518 0 25184 1 13440 + 50000 300m 1518 0 40128 1 13440 + 100000 300m 1518 0 72384 1 13440 + 400000 300m 1518 0 268640 1 13440 diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/qos.json.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/qos.json.j2 index 3938fc1a05..4b9748c7b5 100755 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/qos.json.j2 +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/qos.json.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", "pfc_enable": "3,4" } }, diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/qos_defaults_def_lossy.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/qos_defaults_def_lossy.j2 index 205242d829..104d2d78de 100755 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/qos_defaults_def_lossy.j2 +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/qos_defaults_def_lossy.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]" + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]" } }, "SCHEDULER": { diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/qos_defaults_t1.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/qos_defaults_t1.j2 index 3938fc1a05..4b9748c7b5 100755 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/qos_defaults_t1.j2 +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/qos_defaults_t1.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", "pfc_enable": "3,4" } }, diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/alt_cfg/config_32x200G_Delta-et-c032if_aux.yaml b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/alt_cfg/config_32x200G_Delta-et-c032if_aux.yaml deleted file mode 100755 index 0a76811110..0000000000 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/alt_cfg/config_32x200G_Delta-et-c032if_aux.yaml +++ /dev/null @@ -1,429 +0,0 @@ -ifcs: - options: - log_level: "info" -nodes: -- node_id: "0" - options: - sku: "configs/sku/innovium.77700_B" - netdev: - - auto_create: "no" - multi_interface: "yes" - buffer_management_mode: "api_driven" - max_lossless_tc: "2" - txring: - - txring_id: "0" - desc_count: "1024" - prio: "1" - netdev: "true" - - txring_id: "1" - desc_count: "1024" - prio: "1" - netdev: "true" - - txring_id: "2" - desc_count: "1024" - prio: "1" - netdev: "true" - - txring_id: "3" - desc_count: "1024" - prio: "1" - netdev: "true" - rxring: - - rxring_id: "0" - desc_count: "1024" - prio: "1" - netdev: "true" - queues: "0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44" - - rxring_id: "1" - desc_count: "1024" - prio: "1" - netdev: "true" - queues: "1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45" - - rxring_id: "2" - desc_count: "1024" - prio: "1" - netdev: "true" - queues: "2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46" - - rxring_id: "3" - desc_count: "1024" - prio: "1" - netdev: "true" - queues: "3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47" - sys_clk: "1720" - ifc_clk: "1200" - mac_clk: "1340" - - devports: - - id: "0" - sysport: "1000" - type: "cpu" - - fec: "KPFEC" - id: "249" - lanes: "0:4" - serdes_group: "31" - speed: "200G" - sysport: "249" - type: "eth" - - fec: "KPFEC" - id: "241" - lanes: "0:4" - serdes_group: "30" - speed: "200G" - sysport: "241" - type: "eth" - - fec: "KPFEC" - id: "233" - lanes: "0:4" - serdes_group: "29" - speed: "200G" - sysport: "233" - type: "eth" - - fec: "KPFEC" - id: "225" - lanes: "0:4" - serdes_group: "28" - speed: "200G" - sysport: "225" - type: "eth" - - fec: "KPFEC" - id: "217" - lanes: "0:4" - serdes_group: "27" - speed: "200G" - sysport: "217" - type: "eth" - - fec: "KPFEC" - id: "209" - lanes: "0:4" - serdes_group: "26" - speed: "200G" - sysport: "209" - type: "eth" - - fec: "KPFEC" - id: "201" - lanes: "0:4" - serdes_group: "25" - speed: "200G" - sysport: "201" - type: "eth" - - fec: "KPFEC" - id: "193" - lanes: "0:4" - serdes_group: "24" - speed: "200G" - sysport: "193" - type: "eth" - - fec: "KPFEC" - id: "185" - lanes: "0:4" - serdes_group: "23" - speed: "200G" - sysport: "185" - type: "eth" - - fec: "KPFEC" - id: "177" - lanes: "0:4" - serdes_group: "22" - speed: "200G" - sysport: "177" - type: "eth" - - fec: "KPFEC" - id: "169" - lanes: "0:4" - serdes_group: "21" - speed: "200G" - sysport: "169" - type: "eth" - - fec: "KPFEC" - id: "161" - lanes: "0:4" - serdes_group: "20" - speed: "200G" - sysport: "161" - type: "eth" - - fec: "KPFEC" - id: "153" - lanes: "0:4" - serdes_group: "19" - speed: "200G" - sysport: "153" - type: "eth" - - fec: "KPFEC" - id: "145" - lanes: "0:4" - serdes_group: "18" - speed: "200G" - sysport: "145" - type: "eth" - - fec: "KPFEC" - id: "137" - lanes: "0:4" - serdes_group: "17" - speed: "200G" - sysport: "137" - type: "eth" - - fec: "KPFEC" - id: "129" - lanes: "0:4" - serdes_group: "16" - speed: "200G" - sysport: "129" - type: "eth" - - fec: "KPFEC" - id: "121" - lanes: "0:4" - serdes_group: "15" - speed: "200G" - sysport: "121" - type: "eth" - - fec: "KPFEC" - id: "113" - lanes: "0:4" - serdes_group: "14" - speed: "200G" - sysport: "113" - type: "eth" - - fec: "KPFEC" - id: "97" - lanes: "0:4" - serdes_group: "12" - speed: "200G" - sysport: "97" - type: "eth" - - fec: "KPFEC" - id: "105" - lanes: "0:4" - serdes_group: "13" - speed: "200G" - sysport: "105" - type: "eth" - - fec: "KPFEC" - id: "81" - lanes: "0:4" - serdes_group: "10" - speed: "200G" - sysport: "81" - type: "eth" - - fec: "KPFEC" - id: "89" - lanes: "0:4" - serdes_group: "11" - speed: "200G" - sysport: "89" - type: "eth" - - fec: "KPFEC" - id: "65" - lanes: "0:4" - serdes_group: "8" - speed: "200G" - sysport: "65" - type: "eth" - - fec: "KPFEC" - id: "73" - lanes: "0:4" - serdes_group: "9" - speed: "200G" - sysport: "73" - type: "eth" - - fec: "KPFEC" - id: "49" - lanes: "0:4" - serdes_group: "6" - speed: "200G" - sysport: "49" - type: "eth" - - fec: "KPFEC" - id: "57" - lanes: "0:4" - serdes_group: "7" - speed: "200G" - sysport: "57" - type: "eth" - - fec: "KPFEC" - id: "33" - lanes: "0:4" - serdes_group: "4" - speed: "200G" - sysport: "33" - type: "eth" - - fec: "KPFEC" - id: "41" - lanes: "0:4" - serdes_group: "5" - speed: "200G" - sysport: "41" - type: "eth" - - fec: "KPFEC" - id: "17" - lanes: "0:4" - serdes_group: "2" - speed: "200G" - sysport: "17" - type: "eth" - - fec: "KPFEC" - id: "25" - lanes: "0:4" - serdes_group: "3" - speed: "200G" - sysport: "25" - type: "eth" - - fec: "KPFEC" - id: "1" - lanes: "0:4" - serdes_group: "0" - speed: "200G" - sysport: "1" - type: "eth" - - fec: "KPFEC" - id: "9" - lanes: "0:4" - serdes_group: "1" - speed: "200G" - sysport: "9" - type: "eth" - - fec: "NONE" - id: "257" - lanes: "0:1" - serdes_group: "32" - speed: "10G" - sysport: "257" - type: "mgmt 0" - - fec: "NONE" - id: "258" - lanes: "1:1" - serdes_group: "32" - speed: "10G" - sysport: "258" - type: "mgmt 1" - isg: - - id: "0" - tx_polarity: "01010101" - rx_polarity: "01100000" - lane_swap: "23641075" - - id: "1" - tx_polarity: "10110000" - rx_polarity: "11111111" - lane_swap: "64317520" - - id: "2" - tx_polarity: "00000000" - rx_polarity: "00000011" - lane_swap: "63147520" - - id: "3" - tx_polarity: "01101000" - rx_polarity: "00001110" - lane_swap: "31572046" - - id: "4" - tx_polarity: "00111000" - rx_polarity: "00001000" - lane_swap: "46105732" - - id: "5" - tx_polarity: "10111111" - rx_polarity: "11101000" - lane_swap: "27153604" - - id: "6" - tx_polarity: "01101110" - rx_polarity: "00001101" - lane_swap: "46503721" - - id: "7" - tx_polarity: "01000100" - rx_polarity: "10000101" - lane_swap: "03671245" - - id: "8" - tx_polarity: "01110101" - rx_polarity: "00010000" - lane_swap: "12640375" - - id: "9" - tx_polarity: "01011100" - rx_polarity: "11001111" - lane_swap: "02561347" - - id: "10" - tx_polarity: "01110110" - rx_polarity: "11000000" - lane_swap: "12740365" - - id: "11" - tx_polarity: "00111000" - rx_polarity: "00010111" - lane_swap: "01572436" - - id: "12" - tx_polarity: "00001111" - rx_polarity: "10111001" - lane_swap: "54320176" - - id: "13" - tx_polarity: "10011101" - rx_polarity: "00111011" - lane_swap: "26153704" - - id: "14" - tx_polarity: "00110000" - rx_polarity: "11010000" - lane_swap: "37452601" - - id: "15" - tx_polarity: "11100010" - rx_polarity: "01110011" - lane_swap: "51370462" - - id: "16" - tx_polarity: "10111010" - rx_polarity: "11010011" - lane_swap: "36152704" - - id: "17" - tx_polarity: "01011101" - rx_polarity: "00110001" - lane_swap: "45621073" - - id: "18" - tx_polarity: "11011111" - rx_polarity: "11001011" - lane_swap: "26143705" - - id: "19" - tx_polarity: "00100110" - rx_polarity: "00001001" - lane_swap: "42730165" - - id: "20" - tx_polarity: "10011011" - rx_polarity: "01101101" - lane_swap: "54217603" - - id: "21" - tx_polarity: "00101110" - rx_polarity: "10111111" - lane_swap: "26031745" - - id: "22" - tx_polarity: "01001110" - rx_polarity: "00111001" - lane_swap: "36024715" - - id: "23" - tx_polarity: "10101101" - rx_polarity: "01010011" - lane_swap: "45621370" - - id: "24" - tx_polarity: "11001110" - rx_polarity: "00011111" - lane_swap: "65234701" - - id: "25" - tx_polarity: "01110001" - rx_polarity: "01010111" - lane_swap: "37601452" - - id: "26" - tx_polarity: "01000100" - rx_polarity: "00001111" - lane_swap: "65034721" - - id: "27" - tx_polarity: "10111101" - rx_polarity: "11000101" - lane_swap: "34501672" - - id: "28" - tx_polarity: "01111000" - rx_polarity: "01110110" - lane_swap: "43061275" - - id: "29" - tx_polarity: "11110111" - rx_polarity: "11100111" - lane_swap: "57304621" - - id: "30" - tx_polarity: "10000100" - rx_polarity: "00101111" - lane_swap: "47125603" - - id: "31" - tx_polarity: "11111111" - rx_polarity: "11100010" - lane_swap: "13460275" - - id: "32" - tx_polarity: "00000000" - rx_polarity: "00000000" - lane_swap: "01234567" diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/alt_cfg/port_config_aux.ini b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/alt_cfg/port_config_aux.ini deleted file mode 100755 index ab7873fb07..0000000000 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/alt_cfg/port_config_aux.ini +++ /dev/null @@ -1,35 +0,0 @@ -# name lanes alias speed index mtu fec -Ethernet0 249,250,251,252 Eth1 200000 0 9126 rs -Ethernet8 241,242,243,244 Eth2 200000 1 9126 rs -Ethernet16 233,234,235,236 Eth3 200000 2 9126 rs -Ethernet24 225,226,227,228 Eth4 200000 3 9126 rs -Ethernet32 217,218,219,220 Eth5 200000 4 9126 rs -Ethernet40 209,210,211,212 Eth6 200000 5 9126 rs -Ethernet48 201,202,203,204 Eth7 200000 6 9126 rs -Ethernet56 193,194,195,196 Eth8 200000 7 9126 rs -Ethernet64 185,186,187,188 Eth9 200000 8 9126 rs -Ethernet72 177,178,179,180 Eth10 200000 9 9126 rs -Ethernet80 169,170,171,172 Eth11 200000 10 9126 rs -Ethernet88 161,162,163,164 Eth12 200000 11 9126 rs -Ethernet96 153,154,155,156 Eth13 200000 12 9126 rs -Ethernet104 145,146,147,148 Eth14 200000 13 9126 rs -Ethernet112 137,138,139,140 Eth15 200000 14 9126 rs -Ethernet120 129,130,131,132 Eth16 200000 15 9126 rs -Ethernet128 121,122,123,124 Eth17 200000 16 9126 rs -Ethernet136 113,114,115,116 Eth18 200000 17 9126 rs -Ethernet144 97,98,99,100 Eth19 200000 18 9126 rs -Ethernet152 105,106,107,108 Eth20 200000 19 9126 rs -Ethernet160 81,82,83,84 Eth21 200000 20 9126 rs -Ethernet168 89,90,91,92 Eth22 200000 21 9126 rs -Ethernet176 65,66,67,68 Eth23 200000 22 9126 rs -Ethernet184 73,74,75,76 Eth24 200000 23 9126 rs -Ethernet192 49,50,51,52 Eth25 200000 24 9126 rs -Ethernet200 57,58,59,60 Eth26 200000 25 9126 rs -Ethernet208 33,34,35,36 Eth27 200000 26 9126 rs -Ethernet216 41,42,43,44 Eth28 200000 27 9126 rs -Ethernet224 17,18,19,20 Eth29 200000 28 9126 rs -Ethernet232 25,26,27,28 Eth30 200000 29 9126 rs -Ethernet240 1,2,3,4 Eth31 200000 30 9126 rs -Ethernet248 9,10,11,12 Eth32 200000 31 9126 rs -Ethernet256 257 Aux1 10000 32 9126 none -Ethernet257 258 Aux2 10000 33 9126 none diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/buffers.json.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/buffers.json.j2 index ada7dca895..93dac6b199 100644 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/buffers.json.j2 +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/buffers.json.j2 @@ -93,7 +93,7 @@ "pool":"[BUFFER_POOL|ingress_lossless_pool]", "xoff":"38816", "size":"1518", - "dynamic_th":"3", + "dynamic_th":"1", "xon_offset":"13440" }, "egress_lossless_profile": { @@ -109,7 +109,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/buffers_defaults_def_lossy.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/buffers_defaults_def_lossy.j2 index fa2b49e634..1a31812c26 100644 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/buffers_defaults_def_lossy.j2 +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/buffers_defaults_def_lossy.j2 @@ -22,7 +22,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/buffers_defaults_t1.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/buffers_defaults_t1.j2 index ada7dca895..93dac6b199 100644 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/buffers_defaults_t1.j2 +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/buffers_defaults_t1.j2 @@ -93,7 +93,7 @@ "pool":"[BUFFER_POOL|ingress_lossless_pool]", "xoff":"38816", "size":"1518", - "dynamic_th":"3", + "dynamic_th":"1", "xon_offset":"13440" }, "egress_lossless_profile": { @@ -109,7 +109,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/ivm.sai.config.yaml b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/ivm.sai.config.yaml index e5dd8271b2..7f968fbb40 100755 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/ivm.sai.config.yaml +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/ivm.sai.config.yaml @@ -4,6 +4,5 @@ IFCS_INNO_CLI_PORT : "9999" IFCS_TARGET : "device" INNOVIUM_DIR : "/innovium" PYTHONPATH : "$INNOVIUM_DIR:$INNOVIUM_DIR/cmds:$INNOVIUM_DIR/scripts:$INNOVIUM_DIR/test/:$INNOVIUM_DIR/test/utils:$INNOVIUM_DIR/utils:$INNOVIUM_DIR/pyctypes" -AVG_IPG_RESERVED_SIZE: "1518" -AVG_QUEUE_RESERVED_SIZE: "1518" IVM_SAI_DATAPATH_CONFIG_FILE: "/usr/share/sonic/hwsku/ivm.sai.datapath.config.yaml" +IVM_SAI_PARAM_A0008: "32" diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/pg_profile_lookup.ini b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/pg_profile_lookup.ini index 27775dfff7..adcb52ab2a 100644 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/pg_profile_lookup.ini +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/pg_profile_lookup.ini @@ -1,14 +1,18 @@ # PG lossless profiles. # speed cable size xon xoff threshold xon_offset - 25000 5m 1518 0 15680 3 13440 - 50000 5m 1518 0 21152 3 13440 - 100000 5m 1518 0 34336 3 13440 - 400000 5m 1518 0 117376 3 13440 - 25000 40m 1518 0 16800 3 13440 - 50000 40m 1518 0 23392 3 13440 - 100000 40m 1518 0 38816 3 13440 - 400000 40m 1518 0 135296 3 13440 - 25000 300m 1518 0 25120 3 13440 - 50000 300m 1518 0 40032 3 13440 - 100000 300m 1518 0 72096 3 13440 - 400000 300m 1518 0 268416 3 13440 + 25000 5m 1518 0 15680 1 13440 + 50000 5m 1518 0 21248 1 13440 + 100000 5m 1518 0 34624 1 13440 + 400000 5m 1518 0 117536 1 13440 + 25000 40m 1518 0 16928 1 13440 + 50000 40m 1518 0 23392 1 13440 + 100000 40m 1518 0 38816 1 13440 + 400000 40m 1518 0 135520 1 13440 + 25000 100m 1518 0 18848 1 13440 + 50000 100m 1518 0 27264 1 13440 + 100000 100m 1518 0 46496 1 13440 + 400000 100m 1518 0 166688 1 13440 + 25000 300m 1518 0 25184 1 13440 + 50000 300m 1518 0 40128 1 13440 + 100000 300m 1518 0 72384 1 13440 + 400000 300m 1518 0 268640 1 13440 diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/qos.json.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/qos.json.j2 index 3938fc1a05..4b9748c7b5 100755 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/qos.json.j2 +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/qos.json.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", "pfc_enable": "3,4" } }, diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/qos_defaults_def_lossy.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/qos_defaults_def_lossy.j2 index 205242d829..104d2d78de 100755 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/qos_defaults_def_lossy.j2 +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/qos_defaults_def_lossy.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]" + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]" } }, "SCHEDULER": { diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/qos_defaults_t1.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/qos_defaults_t1.j2 index 3938fc1a05..4b9748c7b5 100755 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/qos_defaults_t1.j2 +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/qos_defaults_t1.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", "pfc_enable": "3,4" } }, diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/alt_cfg/port_config_aux.ini b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/alt_cfg/port_config_aux.ini deleted file mode 100755 index b02a938b34..0000000000 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/alt_cfg/port_config_aux.ini +++ /dev/null @@ -1,35 +0,0 @@ -# name lanes alias speed index mtu fec -Ethernet0 249,250,251,252 Eth1 400000 0 9126 rs -Ethernet8 241,242,243,244 Eth2 400000 1 9126 rs -Ethernet16 233,234,235,236 Eth3 400000 2 9126 rs -Ethernet24 225,226,227,228 Eth4 400000 3 9126 rs -Ethernet32 217,218,219,220 Eth5 400000 4 9126 rs -Ethernet40 209,210,211,212 Eth6 400000 5 9126 rs -Ethernet48 201,202,203,204 Eth7 400000 6 9126 rs -Ethernet56 193,194,195,196 Eth8 400000 7 9126 rs -Ethernet64 185,186,187,188 Eth9 400000 8 9126 rs -Ethernet72 177,178,179,180 Eth10 400000 9 9126 rs -Ethernet80 169,170,171,172 Eth11 400000 10 9126 rs -Ethernet88 161,162,163,164 Eth12 400000 11 9126 rs -Ethernet96 153,154,155,156 Eth13 400000 12 9126 rs -Ethernet104 145,146,147,148 Eth14 400000 13 9126 rs -Ethernet112 137,138,139,140 Eth15 400000 14 9126 rs -Ethernet120 129,130,131,132 Eth16 400000 15 9126 rs -Ethernet128 121,122,123,124 Eth17 400000 16 9126 rs -Ethernet136 113,114,115,116 Eth18 400000 17 9126 rs -Ethernet144 97,98,99,100 Eth19 400000 18 9126 rs -Ethernet152 105,106,107,108 Eth20 400000 19 9126 rs -Ethernet160 81,82,83,84 Eth21 400000 20 9126 rs -Ethernet168 89,90,91,92 Eth22 400000 21 9126 rs -Ethernet176 65,66,67,68 Eth23 400000 22 9126 rs -Ethernet184 73,74,75,76 Eth24 400000 23 9126 rs -Ethernet192 49,50,51,52 Eth25 400000 24 9126 rs -Ethernet200 57,58,59,60 Eth26 400000 25 9126 rs -Ethernet208 33,34,35,36 Eth27 400000 26 9126 rs -Ethernet216 41,42,43,44 Eth28 400000 27 9126 rs -Ethernet224 17,18,19,20 Eth29 400000 28 9126 rs -Ethernet232 25,26,27,28 Eth30 400000 29 9126 rs -Ethernet240 1,2,3,4 Eth31 400000 30 9126 rs -Ethernet248 9,10,11,12 Eth32 400000 31 9126 rs -Ethernet256 257 Aux1 10000 32 9126 none -Ethernet257 258 Aux2 10000 33 9126 none diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/buffers.json.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/buffers.json.j2 index ada7dca895..93dac6b199 100644 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/buffers.json.j2 +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/buffers.json.j2 @@ -93,7 +93,7 @@ "pool":"[BUFFER_POOL|ingress_lossless_pool]", "xoff":"38816", "size":"1518", - "dynamic_th":"3", + "dynamic_th":"1", "xon_offset":"13440" }, "egress_lossless_profile": { @@ -109,7 +109,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/buffers_defaults_def_lossy.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/buffers_defaults_def_lossy.j2 index fa2b49e634..1a31812c26 100644 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/buffers_defaults_def_lossy.j2 +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/buffers_defaults_def_lossy.j2 @@ -22,7 +22,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/buffers_defaults_t1.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/buffers_defaults_t1.j2 index ada7dca895..93dac6b199 100644 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/buffers_defaults_t1.j2 +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/buffers_defaults_t1.j2 @@ -93,7 +93,7 @@ "pool":"[BUFFER_POOL|ingress_lossless_pool]", "xoff":"38816", "size":"1518", - "dynamic_th":"3", + "dynamic_th":"1", "xon_offset":"13440" }, "egress_lossless_profile": { @@ -109,7 +109,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/ivm.sai.config.yaml b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/ivm.sai.config.yaml index 30a83d145e..b897ed8fcc 100755 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/ivm.sai.config.yaml +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/ivm.sai.config.yaml @@ -4,6 +4,5 @@ IFCS_INNO_CLI_PORT : "9999" IFCS_TARGET : "device" INNOVIUM_DIR : "/innovium" PYTHONPATH : "$INNOVIUM_DIR:$INNOVIUM_DIR/cmds:$INNOVIUM_DIR/scripts:$INNOVIUM_DIR/test/:$INNOVIUM_DIR/test/utils:$INNOVIUM_DIR/utils:$INNOVIUM_DIR/pyctypes" -AVG_IPG_RESERVED_SIZE: "1518" -AVG_QUEUE_RESERVED_SIZE: "1518" IVM_SAI_DATAPATH_CONFIG_FILE: "/usr/share/sonic/hwsku/ivm.sai.datapath.config.yaml" +IVM_SAI_PARAM_A0008: "32" diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/pg_profile_lookup.ini b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/pg_profile_lookup.ini index 27775dfff7..adcb52ab2a 100644 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/pg_profile_lookup.ini +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/pg_profile_lookup.ini @@ -1,14 +1,18 @@ # PG lossless profiles. # speed cable size xon xoff threshold xon_offset - 25000 5m 1518 0 15680 3 13440 - 50000 5m 1518 0 21152 3 13440 - 100000 5m 1518 0 34336 3 13440 - 400000 5m 1518 0 117376 3 13440 - 25000 40m 1518 0 16800 3 13440 - 50000 40m 1518 0 23392 3 13440 - 100000 40m 1518 0 38816 3 13440 - 400000 40m 1518 0 135296 3 13440 - 25000 300m 1518 0 25120 3 13440 - 50000 300m 1518 0 40032 3 13440 - 100000 300m 1518 0 72096 3 13440 - 400000 300m 1518 0 268416 3 13440 + 25000 5m 1518 0 15680 1 13440 + 50000 5m 1518 0 21248 1 13440 + 100000 5m 1518 0 34624 1 13440 + 400000 5m 1518 0 117536 1 13440 + 25000 40m 1518 0 16928 1 13440 + 50000 40m 1518 0 23392 1 13440 + 100000 40m 1518 0 38816 1 13440 + 400000 40m 1518 0 135520 1 13440 + 25000 100m 1518 0 18848 1 13440 + 50000 100m 1518 0 27264 1 13440 + 100000 100m 1518 0 46496 1 13440 + 400000 100m 1518 0 166688 1 13440 + 25000 300m 1518 0 25184 1 13440 + 50000 300m 1518 0 40128 1 13440 + 100000 300m 1518 0 72384 1 13440 + 400000 300m 1518 0 268640 1 13440 diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/qos.json.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/qos.json.j2 index 3938fc1a05..4b9748c7b5 100755 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/qos.json.j2 +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/qos.json.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", "pfc_enable": "3,4" } }, diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/qos_defaults_def_lossy.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/qos_defaults_def_lossy.j2 index 205242d829..104d2d78de 100755 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/qos_defaults_def_lossy.j2 +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/qos_defaults_def_lossy.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]" + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]" } }, "SCHEDULER": { diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/qos_defaults_t1.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/qos_defaults_t1.j2 index 3938fc1a05..4b9748c7b5 100755 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/qos_defaults_t1.j2 +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/qos_defaults_t1.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", "pfc_enable": "3,4" } }, diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/alt_cfg/config_64x100G_Delta-et-c032if_aux.yaml b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/alt_cfg/config_64x100G_Delta-et-c032if_aux.yaml deleted file mode 100755 index e5fbcc9354..0000000000 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/alt_cfg/config_64x100G_Delta-et-c032if_aux.yaml +++ /dev/null @@ -1,653 +0,0 @@ -ifcs: - options: - log_level: "info" -nodes: -- node_id: "0" - options: - sku: "configs/sku/innovium.77700_B" - netdev: - - auto_create: "no" - multi_interface: "yes" - buffer_management_mode: "api_driven" - max_lossless_tc: "2" - txring: - - txring_id: "0" - desc_count: "1024" - prio: "1" - netdev: "true" - - txring_id: "1" - desc_count: "1024" - prio: "1" - netdev: "true" - - txring_id: "2" - desc_count: "1024" - prio: "1" - netdev: "true" - - txring_id: "3" - desc_count: "1024" - prio: "1" - netdev: "true" - rxring: - - rxring_id: "0" - desc_count: "1024" - prio: "1" - netdev: "true" - queues: "0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44" - - rxring_id: "1" - desc_count: "1024" - prio: "1" - netdev: "true" - queues: "1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45" - - rxring_id: "2" - desc_count: "1024" - prio: "1" - netdev: "true" - queues: "2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46" - - rxring_id: "3" - desc_count: "1024" - prio: "1" - netdev: "true" - queues: "3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47" - sys_clk: "1720" - ifc_clk: "1200" - mac_clk: "1340" - - devports: - - id: "0" - sysport: "1000" - type: "cpu" - - fec: "KRFEC" - id: "249" - lanes: "0:4" - serdes_group: "31" - speed: "100G" - sysport: "249" - type: "eth" - - fec: "KRFEC" - id: "253" - lanes: "4:4" - serdes_group: "31" - speed: "100G" - sysport: "253" - type: "eth" - - fec: "KRFEC" - id: "241" - lanes: "0:4" - serdes_group: "30" - speed: "100G" - sysport: "241" - type: "eth" - - fec: "KRFEC" - id: "245" - lanes: "4:4" - serdes_group: "30" - speed: "100G" - sysport: "245" - type: "eth" - - fec: "KRFEC" - id: "233" - lanes: "0:4" - serdes_group: "29" - speed: "100G" - sysport: "233" - type: "eth" - - fec: "KRFEC" - id: "237" - lanes: "4:4" - serdes_group: "29" - speed: "100G" - sysport: "237" - type: "eth" - - fec: "KRFEC" - id: "225" - lanes: "0:4" - serdes_group: "28" - speed: "100G" - sysport: "225" - type: "eth" - - fec: "KRFEC" - id: "229" - lanes: "4:4" - serdes_group: "28" - speed: "100G" - sysport: "229" - type: "eth" - - fec: "KRFEC" - id: "217" - lanes: "0:4" - serdes_group: "27" - speed: "100G" - sysport: "217" - type: "eth" - - fec: "KRFEC" - id: "221" - lanes: "4:4" - serdes_group: "27" - speed: "100G" - sysport: "221" - type: "eth" - - fec: "KRFEC" - id: "209" - lanes: "0:4" - serdes_group: "26" - speed: "100G" - sysport: "209" - type: "eth" - - fec: "KRFEC" - id: "213" - lanes: "4:4" - serdes_group: "26" - speed: "100G" - sysport: "213" - type: "eth" - - fec: "KRFEC" - id: "201" - lanes: "0:4" - serdes_group: "25" - speed: "100G" - sysport: "201" - type: "eth" - - fec: "KRFEC" - id: "205" - lanes: "4:4" - serdes_group: "25" - speed: "100G" - sysport: "205" - type: "eth" - - fec: "KRFEC" - id: "193" - lanes: "0:4" - serdes_group: "24" - speed: "100G" - sysport: "193" - type: "eth" - - fec: "KRFEC" - id: "197" - lanes: "4:4" - serdes_group: "24" - speed: "100G" - sysport: "197" - type: "eth" - - fec: "KRFEC" - id: "185" - lanes: "0:4" - serdes_group: "23" - speed: "100G" - sysport: "185" - type: "eth" - - fec: "KRFEC" - id: "189" - lanes: "4:4" - serdes_group: "23" - speed: "100G" - sysport: "189" - type: "eth" - - fec: "KRFEC" - id: "177" - lanes: "0:4" - serdes_group: "22" - speed: "100G" - sysport: "177" - type: "eth" - - fec: "KRFEC" - id: "181" - lanes: "4:4" - serdes_group: "22" - speed: "100G" - sysport: "181" - type: "eth" - - fec: "KRFEC" - id: "169" - lanes: "0:4" - serdes_group: "21" - speed: "100G" - sysport: "169" - type: "eth" - - fec: "KRFEC" - id: "173" - lanes: "4:4" - serdes_group: "21" - speed: "100G" - sysport: "173" - type: "eth" - - fec: "KRFEC" - id: "161" - lanes: "0:4" - serdes_group: "20" - speed: "100G" - sysport: "161" - type: "eth" - - fec: "KRFEC" - id: "165" - lanes: "4:4" - serdes_group: "20" - speed: "100G" - sysport: "165" - type: "eth" - - fec: "KRFEC" - id: "153" - lanes: "0:4" - serdes_group: "19" - speed: "100G" - sysport: "153" - type: "eth" - - fec: "KRFEC" - id: "157" - lanes: "4:4" - serdes_group: "19" - speed: "100G" - sysport: "157" - type: "eth" - - fec: "KRFEC" - id: "145" - lanes: "0:4" - serdes_group: "18" - speed: "100G" - sysport: "145" - type: "eth" - - fec: "KRFEC" - id: "149" - lanes: "4:4" - serdes_group: "18" - speed: "100G" - sysport: "149" - type: "eth" - - fec: "KRFEC" - id: "137" - lanes: "0:4" - serdes_group: "17" - speed: "100G" - sysport: "137" - type: "eth" - - fec: "KRFEC" - id: "141" - lanes: "4:4" - serdes_group: "17" - speed: "100G" - sysport: "141" - type: "eth" - - fec: "KRFEC" - id: "129" - lanes: "0:4" - serdes_group: "16" - speed: "100G" - sysport: "129" - type: "eth" - - fec: "KRFEC" - id: "133" - lanes: "4:4" - serdes_group: "16" - speed: "100G" - sysport: "133" - type: "eth" - - fec: "KRFEC" - id: "121" - lanes: "0:4" - serdes_group: "15" - speed: "100G" - sysport: "121" - type: "eth" - - fec: "KRFEC" - id: "125" - lanes: "4:4" - serdes_group: "15" - speed: "100G" - sysport: "125" - type: "eth" - - fec: "KRFEC" - id: "113" - lanes: "0:4" - serdes_group: "14" - speed: "100G" - sysport: "113" - type: "eth" - - fec: "KRFEC" - id: "117" - lanes: "4:4" - serdes_group: "14" - speed: "100G" - sysport: "117" - type: "eth" - - fec: "KRFEC" - id: "97" - lanes: "0:4" - serdes_group: "12" - speed: "100G" - sysport: "97" - type: "eth" - - fec: "KRFEC" - id: "101" - lanes: "4:4" - serdes_group: "12" - speed: "100G" - sysport: "101" - type: "eth" - - fec: "KRFEC" - id: "105" - lanes: "0:4" - serdes_group: "13" - speed: "100G" - sysport: "105" - type: "eth" - - fec: "KRFEC" - id: "109" - lanes: "4:4" - serdes_group: "13" - speed: "100G" - sysport: "109" - type: "eth" - - fec: "KRFEC" - id: "81" - lanes: "0:4" - serdes_group: "10" - speed: "100G" - sysport: "81" - type: "eth" - - fec: "KRFEC" - id: "85" - lanes: "4:4" - serdes_group: "10" - speed: "100G" - sysport: "85" - type: "eth" - - fec: "KRFEC" - id: "89" - lanes: "0:4" - serdes_group: "11" - speed: "100G" - sysport: "89" - type: "eth" - - fec: "KRFEC" - id: "93" - lanes: "4:4" - serdes_group: "11" - speed: "100G" - sysport: "93" - type: "eth" - - fec: "KRFEC" - id: "65" - lanes: "0:4" - serdes_group: "8" - speed: "100G" - sysport: "65" - type: "eth" - - fec: "KRFEC" - id: "69" - lanes: "4:4" - serdes_group: "8" - speed: "100G" - sysport: "69" - type: "eth" - - fec: "KRFEC" - id: "73" - lanes: "0:4" - serdes_group: "9" - speed: "100G" - sysport: "73" - type: "eth" - - fec: "KRFEC" - id: "77" - lanes: "4:4" - serdes_group: "9" - speed: "100G" - sysport: "77" - type: "eth" - - fec: "KRFEC" - id: "49" - lanes: "0:4" - serdes_group: "6" - speed: "100G" - sysport: "49" - type: "eth" - - fec: "KRFEC" - id: "53" - lanes: "4:4" - serdes_group: "6" - speed: "100G" - sysport: "53" - type: "eth" - - fec: "KRFEC" - id: "57" - lanes: "0:4" - serdes_group: "7" - speed: "100G" - sysport: "57" - type: "eth" - - fec: "KRFEC" - id: "61" - lanes: "4:4" - serdes_group: "7" - speed: "100G" - sysport: "61" - type: "eth" - - fec: "KRFEC" - id: "33" - lanes: "0:4" - serdes_group: "4" - speed: "100G" - sysport: "33" - type: "eth" - - fec: "KRFEC" - id: "37" - lanes: "4:4" - serdes_group: "4" - speed: "100G" - sysport: "37" - type: "eth" - - fec: "KRFEC" - id: "41" - lanes: "0:4" - serdes_group: "5" - speed: "100G" - sysport: "41" - type: "eth" - - fec: "KRFEC" - id: "45" - lanes: "4:4" - serdes_group: "5" - speed: "100G" - sysport: "45" - type: "eth" - - fec: "KRFEC" - id: "17" - lanes: "0:4" - serdes_group: "2" - speed: "100G" - sysport: "17" - type: "eth" - - fec: "KRFEC" - id: "21" - lanes: "4:4" - serdes_group: "2" - speed: "100G" - sysport: "21" - type: "eth" - - fec: "KRFEC" - id: "25" - lanes: "0:4" - serdes_group: "3" - speed: "100G" - sysport: "25" - type: "eth" - - fec: "KRFEC" - id: "29" - lanes: "4:4" - serdes_group: "3" - speed: "100G" - sysport: "29" - type: "eth" - - fec: "KRFEC" - id: "1" - lanes: "0:4" - serdes_group: "0" - speed: "100G" - sysport: "1" - type: "eth" - - fec: "KRFEC" - id: "5" - lanes: "4:4" - serdes_group: "0" - speed: "100G" - sysport: "5" - type: "eth" - - fec: "KRFEC" - id: "9" - lanes: "0:4" - serdes_group: "1" - speed: "100G" - sysport: "9" - type: "eth" - - fec: "KRFEC" - id: "13" - lanes: "4:4" - serdes_group: "1" - speed: "100G" - sysport: "13" - type: "eth" - - fec: "NONE" - id: "257" - lanes: "0:1" - serdes_group: "32" - speed: "10G" - sysport: "257" - type: "mgmt 0" - - fec: "NONE" - id: "258" - lanes: "1:1" - serdes_group: "32" - speed: "10G" - sysport: "258" - type: "mgmt 1" - isg: - - id: "0" - tx_polarity: "01010101" - rx_polarity: "01100000" - lane_swap: "23641075" - - id: "1" - tx_polarity: "10110000" - rx_polarity: "11111111" - lane_swap: "64317520" - - id: "2" - tx_polarity: "00000000" - rx_polarity: "00000011" - lane_swap: "63147520" - - id: "3" - tx_polarity: "01101000" - rx_polarity: "00001110" - lane_swap: "31572046" - - id: "4" - tx_polarity: "00111000" - rx_polarity: "00001000" - lane_swap: "46105732" - - id: "5" - tx_polarity: "10111111" - rx_polarity: "11101000" - lane_swap: "27153604" - - id: "6" - tx_polarity: "01101110" - rx_polarity: "00001101" - lane_swap: "46503721" - - id: "7" - tx_polarity: "01000100" - rx_polarity: "10000101" - lane_swap: "03671245" - - id: "8" - tx_polarity: "01110101" - rx_polarity: "00010000" - lane_swap: "12640375" - - id: "9" - tx_polarity: "01011100" - rx_polarity: "11001111" - lane_swap: "02561347" - - id: "10" - tx_polarity: "01110110" - rx_polarity: "11000000" - lane_swap: "12740365" - - id: "11" - tx_polarity: "00111000" - rx_polarity: "00010111" - lane_swap: "01572436" - - id: "12" - tx_polarity: "00001111" - rx_polarity: "10111001" - lane_swap: "54320176" - - id: "13" - tx_polarity: "10011101" - rx_polarity: "00111011" - lane_swap: "26153704" - - id: "14" - tx_polarity: "00110000" - rx_polarity: "11010000" - lane_swap: "37452601" - - id: "15" - tx_polarity: "11100010" - rx_polarity: "01110011" - lane_swap: "51370462" - - id: "16" - tx_polarity: "10111010" - rx_polarity: "11010011" - lane_swap: "36152704" - - id: "17" - tx_polarity: "01011101" - rx_polarity: "00110001" - lane_swap: "45621073" - - id: "18" - tx_polarity: "11011111" - rx_polarity: "11001011" - lane_swap: "26143705" - - id: "19" - tx_polarity: "00100110" - rx_polarity: "00001001" - lane_swap: "42730165" - - id: "20" - tx_polarity: "10011011" - rx_polarity: "01101101" - lane_swap: "54217603" - - id: "21" - tx_polarity: "00101110" - rx_polarity: "10111111" - lane_swap: "26031745" - - id: "22" - tx_polarity: "01001110" - rx_polarity: "00111001" - lane_swap: "36024715" - - id: "23" - tx_polarity: "10101101" - rx_polarity: "01010011" - lane_swap: "45621370" - - id: "24" - tx_polarity: "11001110" - rx_polarity: "00011111" - lane_swap: "65234701" - - id: "25" - tx_polarity: "01110001" - rx_polarity: "01010111" - lane_swap: "37601452" - - id: "26" - tx_polarity: "01000100" - rx_polarity: "00001111" - lane_swap: "65034721" - - id: "27" - tx_polarity: "10111101" - rx_polarity: "11000101" - lane_swap: "34501672" - - id: "28" - tx_polarity: "01111000" - rx_polarity: "01110110" - lane_swap: "43061275" - - id: "29" - tx_polarity: "11110111" - rx_polarity: "11100111" - lane_swap: "57304621" - - id: "30" - tx_polarity: "10000100" - rx_polarity: "00101111" - lane_swap: "47125603" - - id: "31" - tx_polarity: "11111111" - rx_polarity: "11100010" - lane_swap: "13460275" - - id: "32" - tx_polarity: "00000000" - rx_polarity: "00000000" - lane_swap: "01234567" diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/alt_cfg/port_config_aux.ini b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/alt_cfg/port_config_aux.ini deleted file mode 100644 index 50df2f775f..0000000000 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/alt_cfg/port_config_aux.ini +++ /dev/null @@ -1,67 +0,0 @@ -# name lanes alias speed index mtu -Ethernet0 249,250,251,252 Eth1/1 100000 0 9126 -Ethernet4 253,254,255,256 Eth1/2 100000 0 9126 -Ethernet8 241,242,243,244 Eth2/1 100000 1 9126 -Ethernet12 245,246,247,248 Eth2/2 100000 1 9126 -Ethernet16 233,234,235,236 Eth3/1 100000 2 9126 -Ethernet20 237,238,239,240 Eth3/2 100000 2 9126 -Ethernet24 225,226,227,228 Eth4/1 100000 3 9126 -Ethernet28 229,230,231,232 Eth4/2 100000 3 9126 -Ethernet32 217,218,219,220 Eth5/1 100000 4 9126 -Ethernet36 221,222,223,224 Eth5/2 100000 4 9126 -Ethernet40 209,210,211,212 Eth6/1 100000 5 9126 -Ethernet44 213,214,215,216 Eth6/1 100000 5 9126 -Ethernet48 201,202,203,204 Eth7/1 100000 6 9126 -Ethernet52 205,206,207,208 Eth7/2 100000 6 9126 -Ethernet56 193,194,195,196 Eth8/1 100000 7 9126 -Ethernet60 197,198,199,200 Eth8/2 100000 7 9126 -Ethernet64 185,186,187,188 Eth9/2 100000 8 9126 -Ethernet68 189,190,191,192 Eth9/2 100000 8 9126 -Ethernet72 177,178,179,180 Eth10/1 100000 9 9126 -Ethernet76 181,182,183,184 Eth10/2 100000 9 9126 -Ethernet80 169,170,171,172 Eth11/1 100000 10 9126 -Ethernet84 173,174,175,176 Eth11/2 100000 10 9126 -Ethernet88 161,162,163,164 Eth12/1 100000 11 9126 -Ethernet92 165,166,167,168 Eth12/2 100000 11 9126 -Ethernet96 153,154,155,156 Eth13/1 100000 12 9126 -Ethernet100 157,158,159,160 Eth13/2 100000 12 9126 -Ethernet104 145,146,147,148 Eth14/1 100000 13 9126 -Ethernet108 149,150,151,152 Eth14/2 100000 13 9126 -Ethernet112 137,138,139,140 Eth15/1 100000 14 9126 -Ethernet116 141,142,143,144 Eth15/2 100000 14 9126 -Ethernet120 129,130,131,132 Eth16/1 100000 15 9126 -Ethernet124 133,134,135,136 Eth16/2 100000 15 9126 -Ethernet128 121,122,123,124 Eth17/1 100000 16 9126 -Ethernet132 125,126,127,128 Eth17/2 100000 16 9126 -Ethernet136 113,114,115,116 Eth18/1 100000 17 9126 -Ethernet140 117,118,119,120 Eth18/2 100000 17 9126 -Ethernet144 97,98,99,100 Eth19/1 100000 18 9126 -Ethernet148 101,102,103,104 Eth19/2 100000 18 9126 -Ethernet152 105,106,107,108 Eth20/1 100000 19 9126 -Ethernet156 109,110,111,112 Eth20/2 100000 19 9126 -Ethernet160 81,82,83,84 Eth21/1 100000 20 9126 -Ethernet164 85,86,87,88 Eth21/2 100000 20 9126 -Ethernet168 89,90,91,92 Eth22/1 100000 21 9126 -Ethernet172 93,94,95,96 Eth22/2 100000 21 9126 -Ethernet176 65,66,67,68 Eth23/1 100000 22 9126 -Ethernet180 69,70,71,72 Eth23/2 100000 22 9126 -Ethernet184 73,74,75,76 Eth24/1 100000 23 9126 -Ethernet188 77,78,79,80 Eth24/2 100000 23 9126 -Ethernet192 49,50,51,52 Eth25/1 100000 24 9126 -Ethernet196 53,54,55,56 Eth25/2 100000 24 9126 -Ethernet200 57,58,59,60 Eth26/1 100000 25 9126 -Ethernet204 61,62,63,64 Eth26/2 100000 25 9126 -Ethernet208 33,34,35,36 Eth27/1 100000 26 9126 -Ethernet212 37,38,39,40 Eth27/2 100000 26 9126 -Ethernet216 41,42,43,44 Eth28/1 100000 27 9126 -Ethernet220 45,46,47,48 Eth28/2 100000 27 9126 -Ethernet224 17,18,19,20 Eth29/1 100000 28 9126 -Ethernet228 21,22,23,24 Eth29/2 100000 28 9126 -Ethernet232 25,26,27,28 Eth30/1 100000 29 9126 -Ethernet236 29,30,31,32 Eth30/2 100000 29 9126 -Ethernet240 1,2,3,4 Eth31/1 100000 30 9126 -Ethernet244 5,6,7,8 Eth31/2 100000 30 9126 -Ethernet248 9,10,11,12 Eth32/1 100000 31 9126 -Ethernet252 13,14,15,16 Eth32/2 100000 31 9126 -Ethernet256 257 Aux1 10000 32 9126 -Ethernet257 258 Aux2 10000 33 9126 diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/buffers.json.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/buffers.json.j2 index ada7dca895..93dac6b199 100644 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/buffers.json.j2 +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/buffers.json.j2 @@ -93,7 +93,7 @@ "pool":"[BUFFER_POOL|ingress_lossless_pool]", "xoff":"38816", "size":"1518", - "dynamic_th":"3", + "dynamic_th":"1", "xon_offset":"13440" }, "egress_lossless_profile": { @@ -109,7 +109,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/buffers_defaults_def_lossy.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/buffers_defaults_def_lossy.j2 index fa2b49e634..1a31812c26 100644 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/buffers_defaults_def_lossy.j2 +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/buffers_defaults_def_lossy.j2 @@ -22,7 +22,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/buffers_defaults_t1.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/buffers_defaults_t1.j2 index ada7dca895..93dac6b199 100644 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/buffers_defaults_t1.j2 +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/buffers_defaults_t1.j2 @@ -93,7 +93,7 @@ "pool":"[BUFFER_POOL|ingress_lossless_pool]", "xoff":"38816", "size":"1518", - "dynamic_th":"3", + "dynamic_th":"1", "xon_offset":"13440" }, "egress_lossless_profile": { @@ -109,7 +109,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/ivm.sai.config.yaml b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/ivm.sai.config.yaml index 9d2cc0dd60..ff2b068dfc 100755 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/ivm.sai.config.yaml +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/ivm.sai.config.yaml @@ -4,6 +4,5 @@ IFCS_INNO_CLI_PORT : "9999" IFCS_TARGET : "device" INNOVIUM_DIR : "/innovium" PYTHONPATH : "$INNOVIUM_DIR:$INNOVIUM_DIR/cmds:$INNOVIUM_DIR/scripts:$INNOVIUM_DIR/test/:$INNOVIUM_DIR/test/utils:$INNOVIUM_DIR/utils:$INNOVIUM_DIR/pyctypes" -AVG_IPG_RESERVED_SIZE: "1518" -AVG_QUEUE_RESERVED_SIZE: "1518" IVM_SAI_DATAPATH_CONFIG_FILE: "/usr/share/sonic/hwsku/ivm.sai.datapath.config.yaml" +IVM_SAI_PARAM_A0008: "32" diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/pg_profile_lookup.ini b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/pg_profile_lookup.ini index 27775dfff7..adcb52ab2a 100644 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/pg_profile_lookup.ini +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/pg_profile_lookup.ini @@ -1,14 +1,18 @@ # PG lossless profiles. # speed cable size xon xoff threshold xon_offset - 25000 5m 1518 0 15680 3 13440 - 50000 5m 1518 0 21152 3 13440 - 100000 5m 1518 0 34336 3 13440 - 400000 5m 1518 0 117376 3 13440 - 25000 40m 1518 0 16800 3 13440 - 50000 40m 1518 0 23392 3 13440 - 100000 40m 1518 0 38816 3 13440 - 400000 40m 1518 0 135296 3 13440 - 25000 300m 1518 0 25120 3 13440 - 50000 300m 1518 0 40032 3 13440 - 100000 300m 1518 0 72096 3 13440 - 400000 300m 1518 0 268416 3 13440 + 25000 5m 1518 0 15680 1 13440 + 50000 5m 1518 0 21248 1 13440 + 100000 5m 1518 0 34624 1 13440 + 400000 5m 1518 0 117536 1 13440 + 25000 40m 1518 0 16928 1 13440 + 50000 40m 1518 0 23392 1 13440 + 100000 40m 1518 0 38816 1 13440 + 400000 40m 1518 0 135520 1 13440 + 25000 100m 1518 0 18848 1 13440 + 50000 100m 1518 0 27264 1 13440 + 100000 100m 1518 0 46496 1 13440 + 400000 100m 1518 0 166688 1 13440 + 25000 300m 1518 0 25184 1 13440 + 50000 300m 1518 0 40128 1 13440 + 100000 300m 1518 0 72384 1 13440 + 400000 300m 1518 0 268640 1 13440 diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/qos.json.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/qos.json.j2 index 3938fc1a05..4b9748c7b5 100755 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/qos.json.j2 +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/qos.json.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", "pfc_enable": "3,4" } }, diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/qos_defaults_def_lossy.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/qos_defaults_def_lossy.j2 index 205242d829..104d2d78de 100755 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/qos_defaults_def_lossy.j2 +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/qos_defaults_def_lossy.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]" + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]" } }, "SCHEDULER": { diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/qos_defaults_t1.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/qos_defaults_t1.j2 index 3938fc1a05..4b9748c7b5 100755 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/qos_defaults_t1.j2 +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/qos_defaults_t1.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", "pfc_enable": "3,4" } }, diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/alt_cfg/config_64x200G_Delta-et-c032if_aux.yaml b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/alt_cfg/config_64x200G_Delta-et-c032if_aux.yaml deleted file mode 100755 index 4b75a205ab..0000000000 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/alt_cfg/config_64x200G_Delta-et-c032if_aux.yaml +++ /dev/null @@ -1,653 +0,0 @@ -ifcs: - options: - log_level: "info" -nodes: -- node_id: "0" - options: - sku: "configs/sku/innovium.77700_B" - netdev: - - auto_create: "no" - multi_interface: "yes" - buffer_management_mode: "api_driven" - max_lossless_tc: "2" - txring: - - txring_id: "0" - desc_count: "1024" - prio: "1" - netdev: "true" - - txring_id: "1" - desc_count: "1024" - prio: "1" - netdev: "true" - - txring_id: "2" - desc_count: "1024" - prio: "1" - netdev: "true" - - txring_id: "3" - desc_count: "1024" - prio: "1" - netdev: "true" - rxring: - - rxring_id: "0" - desc_count: "1024" - prio: "1" - netdev: "true" - queues: "0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44" - - rxring_id: "1" - desc_count: "1024" - prio: "1" - netdev: "true" - queues: "1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45" - - rxring_id: "2" - desc_count: "1024" - prio: "1" - netdev: "true" - queues: "2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46" - - rxring_id: "3" - desc_count: "1024" - prio: "1" - netdev: "true" - queues: "3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47" - sys_clk: "1720" - ifc_clk: "1200" - mac_clk: "1340" - - devports: - - id: "0" - sysport: "1000" - type: "cpu" - - fec: "KPFEC" - id: "249" - lanes: "0:4" - serdes_group: "31" - speed: "200G" - sysport: "249" - type: "eth" - - fec: "KPFEC" - id: "253" - lanes: "4:4" - serdes_group: "31" - speed: "200G" - sysport: "253" - type: "eth" - - fec: "KPFEC" - id: "241" - lanes: "0:4" - serdes_group: "30" - speed: "200G" - sysport: "241" - type: "eth" - - fec: "KPFEC" - id: "245" - lanes: "4:4" - serdes_group: "30" - speed: "200G" - sysport: "245" - type: "eth" - - fec: "KPFEC" - id: "233" - lanes: "0:4" - serdes_group: "29" - speed: "200G" - sysport: "233" - type: "eth" - - fec: "KPFEC" - id: "237" - lanes: "4:4" - serdes_group: "29" - speed: "200G" - sysport: "237" - type: "eth" - - fec: "KPFEC" - id: "225" - lanes: "0:4" - serdes_group: "28" - speed: "200G" - sysport: "225" - type: "eth" - - fec: "KPFEC" - id: "229" - lanes: "4:4" - serdes_group: "28" - speed: "200G" - sysport: "229" - type: "eth" - - fec: "KPFEC" - id: "217" - lanes: "0:4" - serdes_group: "27" - speed: "200G" - sysport: "217" - type: "eth" - - fec: "KPFEC" - id: "221" - lanes: "4:4" - serdes_group: "27" - speed: "200G" - sysport: "221" - type: "eth" - - fec: "KPFEC" - id: "209" - lanes: "0:4" - serdes_group: "26" - speed: "200G" - sysport: "209" - type: "eth" - - fec: "KPFEC" - id: "213" - lanes: "4:4" - serdes_group: "26" - speed: "200G" - sysport: "213" - type: "eth" - - fec: "KPFEC" - id: "201" - lanes: "0:4" - serdes_group: "25" - speed: "200G" - sysport: "201" - type: "eth" - - fec: "KPFEC" - id: "205" - lanes: "4:4" - serdes_group: "25" - speed: "200G" - sysport: "205" - type: "eth" - - fec: "KPFEC" - id: "193" - lanes: "0:4" - serdes_group: "24" - speed: "200G" - sysport: "193" - type: "eth" - - fec: "KPFEC" - id: "197" - lanes: "4:4" - serdes_group: "24" - speed: "200G" - sysport: "197" - type: "eth" - - fec: "KPFEC" - id: "185" - lanes: "0:4" - serdes_group: "23" - speed: "200G" - sysport: "185" - type: "eth" - - fec: "KPFEC" - id: "189" - lanes: "4:4" - serdes_group: "23" - speed: "200G" - sysport: "189" - type: "eth" - - fec: "KPFEC" - id: "177" - lanes: "0:4" - serdes_group: "22" - speed: "200G" - sysport: "177" - type: "eth" - - fec: "KPFEC" - id: "181" - lanes: "4:4" - serdes_group: "22" - speed: "200G" - sysport: "181" - type: "eth" - - fec: "KPFEC" - id: "169" - lanes: "0:4" - serdes_group: "21" - speed: "200G" - sysport: "169" - type: "eth" - - fec: "KPFEC" - id: "173" - lanes: "4:4" - serdes_group: "21" - speed: "200G" - sysport: "173" - type: "eth" - - fec: "KPFEC" - id: "161" - lanes: "0:4" - serdes_group: "20" - speed: "200G" - sysport: "161" - type: "eth" - - fec: "KPFEC" - id: "165" - lanes: "4:4" - serdes_group: "20" - speed: "200G" - sysport: "165" - type: "eth" - - fec: "KPFEC" - id: "153" - lanes: "0:4" - serdes_group: "19" - speed: "200G" - sysport: "153" - type: "eth" - - fec: "KPFEC" - id: "157" - lanes: "4:4" - serdes_group: "19" - speed: "200G" - sysport: "157" - type: "eth" - - fec: "KPFEC" - id: "145" - lanes: "0:4" - serdes_group: "18" - speed: "200G" - sysport: "145" - type: "eth" - - fec: "KPFEC" - id: "149" - lanes: "4:4" - serdes_group: "18" - speed: "200G" - sysport: "149" - type: "eth" - - fec: "KPFEC" - id: "137" - lanes: "0:4" - serdes_group: "17" - speed: "200G" - sysport: "137" - type: "eth" - - fec: "KPFEC" - id: "141" - lanes: "4:4" - serdes_group: "17" - speed: "200G" - sysport: "141" - type: "eth" - - fec: "KPFEC" - id: "129" - lanes: "0:4" - serdes_group: "16" - speed: "200G" - sysport: "129" - type: "eth" - - fec: "KPFEC" - id: "133" - lanes: "4:4" - serdes_group: "16" - speed: "200G" - sysport: "133" - type: "eth" - - fec: "KPFEC" - id: "121" - lanes: "0:4" - serdes_group: "15" - speed: "200G" - sysport: "121" - type: "eth" - - fec: "KPFEC" - id: "125" - lanes: "4:4" - serdes_group: "15" - speed: "200G" - sysport: "125" - type: "eth" - - fec: "KPFEC" - id: "113" - lanes: "0:4" - serdes_group: "14" - speed: "200G" - sysport: "113" - type: "eth" - - fec: "KPFEC" - id: "117" - lanes: "4:4" - serdes_group: "14" - speed: "200G" - sysport: "117" - type: "eth" - - fec: "KPFEC" - id: "97" - lanes: "0:4" - serdes_group: "12" - speed: "200G" - sysport: "97" - type: "eth" - - fec: "KPFEC" - id: "101" - lanes: "4:4" - serdes_group: "12" - speed: "200G" - sysport: "101" - type: "eth" - - fec: "KPFEC" - id: "105" - lanes: "0:4" - serdes_group: "13" - speed: "200G" - sysport: "105" - type: "eth" - - fec: "KPFEC" - id: "109" - lanes: "4:4" - serdes_group: "13" - speed: "200G" - sysport: "109" - type: "eth" - - fec: "KPFEC" - id: "81" - lanes: "0:4" - serdes_group: "10" - speed: "200G" - sysport: "81" - type: "eth" - - fec: "KPFEC" - id: "85" - lanes: "4:4" - serdes_group: "10" - speed: "200G" - sysport: "85" - type: "eth" - - fec: "KPFEC" - id: "89" - lanes: "0:4" - serdes_group: "11" - speed: "200G" - sysport: "89" - type: "eth" - - fec: "KPFEC" - id: "93" - lanes: "4:4" - serdes_group: "11" - speed: "200G" - sysport: "93" - type: "eth" - - fec: "KPFEC" - id: "65" - lanes: "0:4" - serdes_group: "8" - speed: "200G" - sysport: "65" - type: "eth" - - fec: "KPFEC" - id: "69" - lanes: "4:4" - serdes_group: "8" - speed: "200G" - sysport: "69" - type: "eth" - - fec: "KPFEC" - id: "73" - lanes: "0:4" - serdes_group: "9" - speed: "200G" - sysport: "73" - type: "eth" - - fec: "KPFEC" - id: "77" - lanes: "4:4" - serdes_group: "9" - speed: "200G" - sysport: "77" - type: "eth" - - fec: "KPFEC" - id: "49" - lanes: "0:4" - serdes_group: "6" - speed: "200G" - sysport: "49" - type: "eth" - - fec: "KPFEC" - id: "53" - lanes: "4:4" - serdes_group: "6" - speed: "200G" - sysport: "53" - type: "eth" - - fec: "KPFEC" - id: "57" - lanes: "0:4" - serdes_group: "7" - speed: "200G" - sysport: "57" - type: "eth" - - fec: "KPFEC" - id: "61" - lanes: "4:4" - serdes_group: "7" - speed: "200G" - sysport: "61" - type: "eth" - - fec: "KPFEC" - id: "33" - lanes: "0:4" - serdes_group: "4" - speed: "200G" - sysport: "33" - type: "eth" - - fec: "KPFEC" - id: "37" - lanes: "4:4" - serdes_group: "4" - speed: "200G" - sysport: "37" - type: "eth" - - fec: "KPFEC" - id: "41" - lanes: "0:4" - serdes_group: "5" - speed: "200G" - sysport: "41" - type: "eth" - - fec: "KPFEC" - id: "45" - lanes: "4:4" - serdes_group: "5" - speed: "200G" - sysport: "45" - type: "eth" - - fec: "KPFEC" - id: "17" - lanes: "0:4" - serdes_group: "2" - speed: "200G" - sysport: "17" - type: "eth" - - fec: "KPFEC" - id: "21" - lanes: "4:4" - serdes_group: "2" - speed: "200G" - sysport: "21" - type: "eth" - - fec: "KPFEC" - id: "25" - lanes: "0:4" - serdes_group: "3" - speed: "200G" - sysport: "25" - type: "eth" - - fec: "KPFEC" - id: "29" - lanes: "4:4" - serdes_group: "3" - speed: "200G" - sysport: "29" - type: "eth" - - fec: "KPFEC" - id: "1" - lanes: "0:4" - serdes_group: "0" - speed: "200G" - sysport: "1" - type: "eth" - - fec: "KPFEC" - id: "5" - lanes: "4:4" - serdes_group: "0" - speed: "200G" - sysport: "5" - type: "eth" - - fec: "KPFEC" - id: "9" - lanes: "0:4" - serdes_group: "1" - speed: "200G" - sysport: "9" - type: "eth" - - fec: "KPFEC" - id: "13" - lanes: "4:4" - serdes_group: "1" - speed: "200G" - sysport: "13" - type: "eth" - - fec: "NONE" - id: "257" - lanes: "0:1" - serdes_group: "32" - speed: "10G" - sysport: "257" - type: "mgmt 0" - - fec: "NONE" - id: "258" - lanes: "1:1" - serdes_group: "32" - speed: "10G" - sysport: "258" - type: "mgmt 1" - isg: - - id: "0" - tx_polarity: "01010101" - rx_polarity: "01100000" - lane_swap: "23641075" - - id: "1" - tx_polarity: "10110000" - rx_polarity: "11111111" - lane_swap: "64317520" - - id: "2" - tx_polarity: "00000000" - rx_polarity: "00000011" - lane_swap: "63147520" - - id: "3" - tx_polarity: "01101000" - rx_polarity: "00001110" - lane_swap: "31572046" - - id: "4" - tx_polarity: "00111000" - rx_polarity: "00001000" - lane_swap: "46105732" - - id: "5" - tx_polarity: "10111111" - rx_polarity: "11101000" - lane_swap: "27153604" - - id: "6" - tx_polarity: "01101110" - rx_polarity: "00001101" - lane_swap: "46503721" - - id: "7" - tx_polarity: "01000100" - rx_polarity: "10000101" - lane_swap: "03671245" - - id: "8" - tx_polarity: "01110101" - rx_polarity: "00010000" - lane_swap: "12640375" - - id: "9" - tx_polarity: "01011100" - rx_polarity: "11001111" - lane_swap: "02561347" - - id: "10" - tx_polarity: "01110110" - rx_polarity: "11000000" - lane_swap: "12740365" - - id: "11" - tx_polarity: "00111000" - rx_polarity: "00010111" - lane_swap: "01572436" - - id: "12" - tx_polarity: "00001111" - rx_polarity: "10111001" - lane_swap: "54320176" - - id: "13" - tx_polarity: "10011101" - rx_polarity: "00111011" - lane_swap: "26153704" - - id: "14" - tx_polarity: "00110000" - rx_polarity: "11010000" - lane_swap: "37452601" - - id: "15" - tx_polarity: "11100010" - rx_polarity: "01110011" - lane_swap: "51370462" - - id: "16" - tx_polarity: "10111010" - rx_polarity: "11010011" - lane_swap: "36152704" - - id: "17" - tx_polarity: "01011101" - rx_polarity: "00110001" - lane_swap: "45621073" - - id: "18" - tx_polarity: "11011111" - rx_polarity: "11001011" - lane_swap: "26143705" - - id: "19" - tx_polarity: "00100110" - rx_polarity: "00001001" - lane_swap: "42730165" - - id: "20" - tx_polarity: "10011011" - rx_polarity: "01101101" - lane_swap: "54217603" - - id: "21" - tx_polarity: "00101110" - rx_polarity: "10111111" - lane_swap: "26031745" - - id: "22" - tx_polarity: "01001110" - rx_polarity: "00111001" - lane_swap: "36024715" - - id: "23" - tx_polarity: "10101101" - rx_polarity: "01010011" - lane_swap: "45621370" - - id: "24" - tx_polarity: "11001110" - rx_polarity: "00011111" - lane_swap: "65234701" - - id: "25" - tx_polarity: "01110001" - rx_polarity: "01010111" - lane_swap: "37601452" - - id: "26" - tx_polarity: "01000100" - rx_polarity: "00001111" - lane_swap: "65034721" - - id: "27" - tx_polarity: "10111101" - rx_polarity: "11000101" - lane_swap: "34501672" - - id: "28" - tx_polarity: "01111000" - rx_polarity: "01110110" - lane_swap: "43061275" - - id: "29" - tx_polarity: "11110111" - rx_polarity: "11100111" - lane_swap: "57304621" - - id: "30" - tx_polarity: "10000100" - rx_polarity: "00101111" - lane_swap: "47125603" - - id: "31" - tx_polarity: "11111111" - rx_polarity: "11100010" - lane_swap: "13460275" - - id: "32" - tx_polarity: "00000000" - rx_polarity: "00000000" - lane_swap: "01234567" diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/alt_cfg/port_config_aux b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/alt_cfg/port_config_aux deleted file mode 100644 index 48971bbb7c..0000000000 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/alt_cfg/port_config_aux +++ /dev/null @@ -1,67 +0,0 @@ -# name lanes alias speed index mtu -Ethernet0 249,250,251,252 Eth1/1 200000 0 9126 -Ethernet4 253,254,255,256 Eth1/2 200000 0 9126 -Ethernet8 241,242,243,244 Eth2/1 200000 1 9126 -Ethernet12 245,246,247,248 Eth2/2 200000 1 9126 -Ethernet16 233,234,235,236 Eth3/1 200000 2 9126 -Ethernet20 237,238,239,240 Eth3/2 200000 2 9126 -Ethernet24 225,226,227,228 Eth4/1 200000 3 9126 -Ethernet28 229,230,231,232 Eth4/2 200000 3 9126 -Ethernet32 217,218,219,220 Eth5/1 200000 4 9126 -Ethernet36 221,222,223,224 Eth5/2 200000 4 9126 -Ethernet40 209,210,211,212 Eth6/1 200000 5 9126 -Ethernet44 213,214,215,216 Eth6/1 200000 5 9126 -Ethernet48 201,202,203,204 Eth7/1 200000 6 9126 -Ethernet52 205,206,207,208 Eth7/2 200000 6 9126 -Ethernet56 193,194,195,196 Eth8/1 200000 7 9126 -Ethernet60 197,198,199,200 Eth8/2 200000 7 9126 -Ethernet64 185,186,187,188 Eth9/2 200000 8 9126 -Ethernet68 189,190,191,192 Eth9/2 200000 8 9126 -Ethernet72 177,178,179,180 Eth10/1 200000 9 9126 -Ethernet76 181,182,183,184 Eth10/2 200000 9 9126 -Ethernet80 169,170,171,172 Eth11/1 200000 10 9126 -Ethernet84 173,174,175,176 Eth11/2 200000 10 9126 -Ethernet88 161,162,163,164 Eth12/1 200000 11 9126 -Ethernet92 165,166,167,168 Eth12/2 200000 11 9126 -Ethernet96 153,154,155,156 Eth13/1 200000 12 9126 -Ethernet100 157,158,159,160 Eth13/2 200000 12 9126 -Ethernet104 145,146,147,148 Eth14/1 200000 13 9126 -Ethernet108 149,150,151,152 Eth14/2 200000 13 9126 -Ethernet112 137,138,139,140 Eth15/1 200000 14 9126 -Ethernet116 141,142,143,144 Eth15/2 200000 14 9126 -Ethernet120 129,130,131,132 Eth16/1 200000 15 9126 -Ethernet124 133,134,135,136 Eth16/2 200000 15 9126 -Ethernet128 121,122,123,124 Eth17/1 200000 16 9126 -Ethernet132 125,126,127,128 Eth17/2 200000 16 9126 -Ethernet136 113,114,115,116 Eth18/1 200000 17 9126 -Ethernet140 117,118,119,120 Eth18/2 200000 17 9126 -Ethernet144 97,98,99,100 Eth19/1 200000 18 9126 -Ethernet148 101,102,103,104 Eth19/2 200000 18 9126 -Ethernet152 105,106,107,108 Eth20/1 200000 19 9126 -Ethernet156 109,110,111,112 Eth20/2 200000 19 9126 -Ethernet160 81,82,83,84 Eth21/1 200000 20 9126 -Ethernet164 85,86,87,88 Eth21/2 200000 20 9126 -Ethernet168 89,90,91,92 Eth22/1 200000 21 9126 -Ethernet172 93,94,95,96 Eth22/2 200000 21 9126 -Ethernet176 65,66,67,68 Eth23/1 200000 22 9126 -Ethernet180 69,70,71,72 Eth23/2 200000 22 9126 -Ethernet184 73,74,75,76 Eth24/1 200000 23 9126 -Ethernet188 77,78,79,80 Eth24/2 200000 23 9126 -Ethernet192 49,50,51,52 Eth25/1 200000 24 9126 -Ethernet196 53,54,55,56 Eth25/2 200000 24 9126 -Ethernet200 57,58,59,60 Eth26/1 200000 25 9126 -Ethernet204 61,62,63,64 Eth26/2 200000 25 9126 -Ethernet208 33,34,35,36 Eth27/1 200000 26 9126 -Ethernet212 37,38,39,40 Eth27/2 200000 26 9126 -Ethernet216 41,42,43,44 Eth28/1 200000 27 9126 -Ethernet220 45,46,47,48 Eth28/2 200000 27 9126 -Ethernet224 17,18,19,20 Eth29/1 200000 28 9126 -Ethernet228 21,22,23,24 Eth29/2 200000 28 9126 -Ethernet232 25,26,27,28 Eth30/1 200000 29 9126 -Ethernet236 29,30,31,32 Eth30/2 200000 29 9126 -Ethernet240 1,2,3,4 Eth31/1 200000 30 9126 -Ethernet244 5,6,7,8 Eth31/2 200000 30 9126 -Ethernet248 9,10,11,12 Eth32/1 200000 31 9126 -Ethernet252 13,14,15,16 Eth32/2 200000 31 9126 -Ethernet256 257 Aux1 10000 32 9126 -Ethernet257 258 Aux2 10000 33 9126 diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/buffers.json.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/buffers.json.j2 index ada7dca895..93dac6b199 100644 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/buffers.json.j2 +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/buffers.json.j2 @@ -93,7 +93,7 @@ "pool":"[BUFFER_POOL|ingress_lossless_pool]", "xoff":"38816", "size":"1518", - "dynamic_th":"3", + "dynamic_th":"1", "xon_offset":"13440" }, "egress_lossless_profile": { @@ -109,7 +109,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/buffers_defaults_def_lossy.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/buffers_defaults_def_lossy.j2 index fa2b49e634..1a31812c26 100644 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/buffers_defaults_def_lossy.j2 +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/buffers_defaults_def_lossy.j2 @@ -22,7 +22,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/buffers_defaults_t1.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/buffers_defaults_t1.j2 index ada7dca895..93dac6b199 100644 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/buffers_defaults_t1.j2 +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/buffers_defaults_t1.j2 @@ -93,7 +93,7 @@ "pool":"[BUFFER_POOL|ingress_lossless_pool]", "xoff":"38816", "size":"1518", - "dynamic_th":"3", + "dynamic_th":"1", "xon_offset":"13440" }, "egress_lossless_profile": { @@ -109,7 +109,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/ivm.sai.config.yaml b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/ivm.sai.config.yaml index 1f34d882ff..fd8e019108 100755 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/ivm.sai.config.yaml +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/ivm.sai.config.yaml @@ -4,6 +4,5 @@ IFCS_INNO_CLI_PORT : "9999" IFCS_TARGET : "device" INNOVIUM_DIR : "/innovium" PYTHONPATH : "$INNOVIUM_DIR:$INNOVIUM_DIR/cmds:$INNOVIUM_DIR/scripts:$INNOVIUM_DIR/test/:$INNOVIUM_DIR/test/utils:$INNOVIUM_DIR/utils:$INNOVIUM_DIR/pyctypes" -AVG_IPG_RESERVED_SIZE: "1518" -AVG_QUEUE_RESERVED_SIZE: "1518" IVM_SAI_DATAPATH_CONFIG_FILE: "/usr/share/sonic/hwsku/ivm.sai.datapath.config.yaml" +IVM_SAI_PARAM_A0008: "32" diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/pg_profile_lookup.ini b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/pg_profile_lookup.ini index 27775dfff7..adcb52ab2a 100644 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/pg_profile_lookup.ini +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/pg_profile_lookup.ini @@ -1,14 +1,18 @@ # PG lossless profiles. # speed cable size xon xoff threshold xon_offset - 25000 5m 1518 0 15680 3 13440 - 50000 5m 1518 0 21152 3 13440 - 100000 5m 1518 0 34336 3 13440 - 400000 5m 1518 0 117376 3 13440 - 25000 40m 1518 0 16800 3 13440 - 50000 40m 1518 0 23392 3 13440 - 100000 40m 1518 0 38816 3 13440 - 400000 40m 1518 0 135296 3 13440 - 25000 300m 1518 0 25120 3 13440 - 50000 300m 1518 0 40032 3 13440 - 100000 300m 1518 0 72096 3 13440 - 400000 300m 1518 0 268416 3 13440 + 25000 5m 1518 0 15680 1 13440 + 50000 5m 1518 0 21248 1 13440 + 100000 5m 1518 0 34624 1 13440 + 400000 5m 1518 0 117536 1 13440 + 25000 40m 1518 0 16928 1 13440 + 50000 40m 1518 0 23392 1 13440 + 100000 40m 1518 0 38816 1 13440 + 400000 40m 1518 0 135520 1 13440 + 25000 100m 1518 0 18848 1 13440 + 50000 100m 1518 0 27264 1 13440 + 100000 100m 1518 0 46496 1 13440 + 400000 100m 1518 0 166688 1 13440 + 25000 300m 1518 0 25184 1 13440 + 50000 300m 1518 0 40128 1 13440 + 100000 300m 1518 0 72384 1 13440 + 400000 300m 1518 0 268640 1 13440 diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/qos.json.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/qos.json.j2 index 3938fc1a05..4b9748c7b5 100755 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/qos.json.j2 +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/qos.json.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", "pfc_enable": "3,4" } }, diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/qos_defaults_def_lossy.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/qos_defaults_def_lossy.j2 index 205242d829..104d2d78de 100755 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/qos_defaults_def_lossy.j2 +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/qos_defaults_def_lossy.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]" + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]" } }, "SCHEDULER": { diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/qos_defaults_t1.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/qos_defaults_t1.j2 index 3938fc1a05..4b9748c7b5 100755 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/qos_defaults_t1.j2 +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/qos_defaults_t1.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", "pfc_enable": "3,4" } }, diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56/Delta-evs-a-32q56/buffers.json.j2 b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56/Delta-evs-a-32q56/buffers.json.j2 index f81abfcfc5..44f6abfe9a 100644 --- a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56/Delta-evs-a-32q56/buffers.json.j2 +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56/Delta-evs-a-32q56/buffers.json.j2 @@ -76,7 +76,7 @@ "pool":"[BUFFER_POOL|ingress_lossless_pool]", "xoff":"1433600", "size":"1518", - "dynamic_th":"-4", + "dynamic_th":"1", "xon_offset":"6272" }, "ingress_lossy_profile": { @@ -92,7 +92,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|egress_lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56/Delta-evs-a-32q56/qos.json.j2 b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56/Delta-evs-a-32q56/qos.json.j2 index 6c734d46ff..374e849588 100755 --- a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56/Delta-evs-a-32q56/qos.json.j2 +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56/Delta-evs-a-32q56/qos.json.j2 @@ -111,9 +111,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", "pfc_enable": "4,5" } } diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56/buffers.json.j2 b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56/buffers.json.j2 index 1ab009be2d..6f9ed3c7f6 100644 --- a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56/buffers.json.j2 +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56/buffers.json.j2 @@ -93,7 +93,7 @@ "pool":"[BUFFER_POOL|ingress_lossless_pool]", "xoff":"38816", "size":"1518", - "dynamic_th":"3", + "dynamic_th":"1", "xon_offset":"13440" }, "egress_lossless_profile": { @@ -109,7 +109,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56/buffers_defaults_def_lossy.j2 b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56/buffers_defaults_def_lossy.j2 index c61ec1d149..72a618f07f 100644 --- a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56/buffers_defaults_def_lossy.j2 +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56/buffers_defaults_def_lossy.j2 @@ -22,7 +22,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56/buffers_defaults_t1.j2 b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56/buffers_defaults_t1.j2 index 1ab009be2d..6f9ed3c7f6 100644 --- a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56/buffers_defaults_t1.j2 +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56/buffers_defaults_t1.j2 @@ -93,7 +93,7 @@ "pool":"[BUFFER_POOL|ingress_lossless_pool]", "xoff":"38816", "size":"1518", - "dynamic_th":"3", + "dynamic_th":"1", "xon_offset":"13440" }, "egress_lossless_profile": { @@ -109,7 +109,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56/ivm.sai.config.yaml b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56/ivm.sai.config.yaml index 607e2da931..ff1b69d113 100755 --- a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56/ivm.sai.config.yaml +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56/ivm.sai.config.yaml @@ -4,6 +4,5 @@ IFCS_INNO_CLI_PORT : "9999" IFCS_TARGET : "device" INNOVIUM_DIR : "/innovium" PYTHONPATH : "$INNOVIUM_DIR:$INNOVIUM_DIR/cmds:$INNOVIUM_DIR/scripts:$INNOVIUM_DIR/test/:$INNOVIUM_DIR/test/utils:$INNOVIUM_DIR/utils:$INNOVIUM_DIR/pyctypes" -AVG_IPG_RESERVED_SIZE: "1518" -AVG_QUEUE_RESERVED_SIZE: "1518" IVM_SAI_DATAPATH_CONFIG_FILE: "/usr/share/sonic/hwsku/ivm.sai.datapath.config.yaml" +IVM_SAI_PARAM_A0008: "32" diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56/pg_profile_lookup.ini b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56/pg_profile_lookup.ini index 36c3bb0a48..adcb52ab2a 100644 --- a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56/pg_profile_lookup.ini +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56/pg_profile_lookup.ini @@ -1,14 +1,18 @@ # PG lossless profiles. # speed cable size xon xoff threshold xon_offset - 25000 5m 1518 0 17600 3 13440 - 50000 5m 1518 0 23456 3 13440 - 100000 5m 1518 0 36064 3 13440 - 400000 5m 1518 0 118464 3 13440 - 25000 40m 1518 0 18720 3 13440 - 50000 40m 1518 0 25696 3 13440 - 100000 40m 1518 0 40544 3 13440 - 400000 40m 1518 0 136384 3 13440 - 25000 300m 1518 0 27040 3 13440 - 50000 300m 1518 0 42336 3 13440 - 100000 300m 1518 0 73824 3 13440 - 400000 300m 1518 0 269504 3 13440 + 25000 5m 1518 0 15680 1 13440 + 50000 5m 1518 0 21248 1 13440 + 100000 5m 1518 0 34624 1 13440 + 400000 5m 1518 0 117536 1 13440 + 25000 40m 1518 0 16928 1 13440 + 50000 40m 1518 0 23392 1 13440 + 100000 40m 1518 0 38816 1 13440 + 400000 40m 1518 0 135520 1 13440 + 25000 100m 1518 0 18848 1 13440 + 50000 100m 1518 0 27264 1 13440 + 100000 100m 1518 0 46496 1 13440 + 400000 100m 1518 0 166688 1 13440 + 25000 300m 1518 0 25184 1 13440 + 50000 300m 1518 0 40128 1 13440 + 100000 300m 1518 0 72384 1 13440 + 400000 300m 1518 0 268640 1 13440 diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56/qos.json.j2 b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56/qos.json.j2 index 3938fc1a05..4b9748c7b5 100755 --- a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56/qos.json.j2 +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56/qos.json.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", "pfc_enable": "3,4" } }, diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56/qos_defaults_def_lossy.j2 b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56/qos_defaults_def_lossy.j2 index 205242d829..104d2d78de 100755 --- a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56/qos_defaults_def_lossy.j2 +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56/qos_defaults_def_lossy.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]" + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]" } }, "SCHEDULER": { diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56/qos_defaults_t1.j2 b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56/qos_defaults_t1.j2 index 3938fc1a05..4b9748c7b5 100644 --- a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56/qos_defaults_t1.j2 +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56/qos_defaults_t1.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", "pfc_enable": "3,4" } }, diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_32x100/buffers.json.j2 b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_32x100/buffers.json.j2 index 1ab009be2d..6f9ed3c7f6 100644 --- a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_32x100/buffers.json.j2 +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_32x100/buffers.json.j2 @@ -93,7 +93,7 @@ "pool":"[BUFFER_POOL|ingress_lossless_pool]", "xoff":"38816", "size":"1518", - "dynamic_th":"3", + "dynamic_th":"1", "xon_offset":"13440" }, "egress_lossless_profile": { @@ -109,7 +109,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_32x100/buffers_defaults_def_lossy.j2 b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_32x100/buffers_defaults_def_lossy.j2 index c61ec1d149..72a618f07f 100644 --- a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_32x100/buffers_defaults_def_lossy.j2 +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_32x100/buffers_defaults_def_lossy.j2 @@ -22,7 +22,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_32x100/buffers_defaults_t1.j2 b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_32x100/buffers_defaults_t1.j2 index 1ab009be2d..6f9ed3c7f6 100644 --- a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_32x100/buffers_defaults_t1.j2 +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_32x100/buffers_defaults_t1.j2 @@ -93,7 +93,7 @@ "pool":"[BUFFER_POOL|ingress_lossless_pool]", "xoff":"38816", "size":"1518", - "dynamic_th":"3", + "dynamic_th":"1", "xon_offset":"13440" }, "egress_lossless_profile": { @@ -109,7 +109,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_32x100/config_32x100G_Delta-evs-a-32q56.yaml b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_32x100/config_32x100G_Delta-evs-a-32q56.yaml index 1f6d6b48e6..4001da815d 100755 --- a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_32x100/config_32x100G_Delta-evs-a-32q56.yaml +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_32x100/config_32x100G_Delta-evs-a-32q56.yaml @@ -10,6 +10,8 @@ nodes: multi_interface: "yes" buffer_management_mode: "api_driven" max_lossless_tc: "2" + ilpm_enable: "1" + forward_profile: "IFCS_FORWARD_PROFILE_ID_PROFILE_E" skip_pll_check: "false" mac_clk: "750" sys_clk: "1300" diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_32x100/ivm.sai.config.yaml b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_32x100/ivm.sai.config.yaml index 607e2da931..cc13d7b64f 100755 --- a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_32x100/ivm.sai.config.yaml +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_32x100/ivm.sai.config.yaml @@ -4,6 +4,5 @@ IFCS_INNO_CLI_PORT : "9999" IFCS_TARGET : "device" INNOVIUM_DIR : "/innovium" PYTHONPATH : "$INNOVIUM_DIR:$INNOVIUM_DIR/cmds:$INNOVIUM_DIR/scripts:$INNOVIUM_DIR/test/:$INNOVIUM_DIR/test/utils:$INNOVIUM_DIR/utils:$INNOVIUM_DIR/pyctypes" -AVG_IPG_RESERVED_SIZE: "1518" -AVG_QUEUE_RESERVED_SIZE: "1518" IVM_SAI_DATAPATH_CONFIG_FILE: "/usr/share/sonic/hwsku/ivm.sai.datapath.config.yaml" +IVM_SAI_PARAM_A0008: "64" diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_32x100/pg_profile_lookup.ini b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_32x100/pg_profile_lookup.ini index 36c3bb0a48..adcb52ab2a 100644 --- a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_32x100/pg_profile_lookup.ini +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_32x100/pg_profile_lookup.ini @@ -1,14 +1,18 @@ # PG lossless profiles. # speed cable size xon xoff threshold xon_offset - 25000 5m 1518 0 17600 3 13440 - 50000 5m 1518 0 23456 3 13440 - 100000 5m 1518 0 36064 3 13440 - 400000 5m 1518 0 118464 3 13440 - 25000 40m 1518 0 18720 3 13440 - 50000 40m 1518 0 25696 3 13440 - 100000 40m 1518 0 40544 3 13440 - 400000 40m 1518 0 136384 3 13440 - 25000 300m 1518 0 27040 3 13440 - 50000 300m 1518 0 42336 3 13440 - 100000 300m 1518 0 73824 3 13440 - 400000 300m 1518 0 269504 3 13440 + 25000 5m 1518 0 15680 1 13440 + 50000 5m 1518 0 21248 1 13440 + 100000 5m 1518 0 34624 1 13440 + 400000 5m 1518 0 117536 1 13440 + 25000 40m 1518 0 16928 1 13440 + 50000 40m 1518 0 23392 1 13440 + 100000 40m 1518 0 38816 1 13440 + 400000 40m 1518 0 135520 1 13440 + 25000 100m 1518 0 18848 1 13440 + 50000 100m 1518 0 27264 1 13440 + 100000 100m 1518 0 46496 1 13440 + 400000 100m 1518 0 166688 1 13440 + 25000 300m 1518 0 25184 1 13440 + 50000 300m 1518 0 40128 1 13440 + 100000 300m 1518 0 72384 1 13440 + 400000 300m 1518 0 268640 1 13440 diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_32x100/qos.json.j2 b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_32x100/qos.json.j2 index 3938fc1a05..4b9748c7b5 100755 --- a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_32x100/qos.json.j2 +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_32x100/qos.json.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", "pfc_enable": "3,4" } }, diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_32x100/qos_defaults_def_lossy.j2 b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_32x100/qos_defaults_def_lossy.j2 index 205242d829..104d2d78de 100755 --- a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_32x100/qos_defaults_def_lossy.j2 +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_32x100/qos_defaults_def_lossy.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]" + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]" } }, "SCHEDULER": { diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_32x100/qos_defaults_t1.j2 b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_32x100/qos_defaults_t1.j2 index 3938fc1a05..4b9748c7b5 100644 --- a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_32x100/qos_defaults_t1.j2 +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_32x100/qos_defaults_t1.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", "pfc_enable": "3,4" } }, diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/buffers.json.j2 b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/buffers.json.j2 new file mode 100644 index 0000000000..6f9ed3c7f6 --- /dev/null +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/buffers.json.j2 @@ -0,0 +1,137 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '40m' %} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) %} + {%- set cable_len = [] %} + {%- for local_port in DEVICE_NEIGHBOR %} + {%- if local_port == port_name %} + {%- if DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor_role = neighbor.type %} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role %} + {%- set roles1 = roles1 | lower %} + {%- set roles2 = roles2 | lower %} + {%- if roles1 in ports2cable %} + {%- if cable_len.append(ports2cable[roles1]) %}{% endif %} + {%- elif roles2 in ports2cable %} + {%- if cable_len.append(ports2cable[roles2]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else %} + {%- if switch_role.lower() == 'torrouter' %} + {%- for local_port in VLAN_MEMBER %} + {%- if local_port[1] == port_name %} + {%- set roles3 = switch_role + '_' + 'server' %} + {%- set roles3 = roles3 | lower %} + {%- if roles3 in ports2cable %} + {%- if cable_len.append(ports2cable[roles3]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- endif %} +{%- endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "34056960", + "type": "ingress", + "mode": "dynamic", + "xoff": "4185600" + }, + "lossy_pool": { + "size": "14595840", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xoff":"38816", + "size":"1518", + "dynamic_th":"1", + "xon_offset":"13440" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"23001600" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"0", + "static_th":"23001600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"1518", + "dynamic_th":"2" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/buffers_defaults_def_lossy.j2 b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/buffers_defaults_def_lossy.j2 new file mode 100644 index 0000000000..72a618f07f --- /dev/null +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/buffers_defaults_def_lossy.j2 @@ -0,0 +1,38 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "BUFFER_POOL": { + "lossy_pool": { + "size": "46003200", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"0", + "static_th":"23001600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"1518", + "dynamic_th":"2" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-7": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|0-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/buffers_defaults_lossy_t1.j2 b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/buffers_defaults_lossy_t1.j2 new file mode 100644 index 0000000000..6e07eb1d5e --- /dev/null +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/buffers_defaults_lossy_t1.j2 @@ -0,0 +1,38 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "BUFFER_POOL": { + "lossy_pool": { + "size": "46003200", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"0", + "static_th":"23001600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"1120", + "dynamic_th":"2" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-7": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|0-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/buffers_defaults_t1.j2 b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/buffers_defaults_t1.j2 new file mode 100644 index 0000000000..6f9ed3c7f6 --- /dev/null +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/buffers_defaults_t1.j2 @@ -0,0 +1,137 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '40m' %} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) %} + {%- set cable_len = [] %} + {%- for local_port in DEVICE_NEIGHBOR %} + {%- if local_port == port_name %} + {%- if DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor_role = neighbor.type %} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role %} + {%- set roles1 = roles1 | lower %} + {%- set roles2 = roles2 | lower %} + {%- if roles1 in ports2cable %} + {%- if cable_len.append(ports2cable[roles1]) %}{% endif %} + {%- elif roles2 in ports2cable %} + {%- if cable_len.append(ports2cable[roles2]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else %} + {%- if switch_role.lower() == 'torrouter' %} + {%- for local_port in VLAN_MEMBER %} + {%- if local_port[1] == port_name %} + {%- set roles3 = switch_role + '_' + 'server' %} + {%- set roles3 = roles3 | lower %} + {%- if roles3 in ports2cable %} + {%- if cable_len.append(ports2cable[roles3]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- endif %} +{%- endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "34056960", + "type": "ingress", + "mode": "dynamic", + "xoff": "4185600" + }, + "lossy_pool": { + "size": "14595840", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xoff":"38816", + "size":"1518", + "dynamic_th":"1", + "xon_offset":"13440" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"23001600" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"0", + "static_th":"23001600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"1518", + "dynamic_th":"2" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/config_48x25G_8x100G_Delta-evs-a-32q56.yaml b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/config_48x25G_8x100G_Delta-evs-a-32q56.yaml new file mode 100755 index 0000000000..184e76c2b8 --- /dev/null +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/config_48x25G_8x100G_Delta-evs-a-32q56.yaml @@ -0,0 +1,561 @@ +ifcs: + options: + log_level: "info" +nodes: +- node_id: "0" + options: + sku: "configs/sku/innovium.55200" + netdev: + - auto_create: "no" + multi_interface: "yes" + buffer_management_mode: "api_driven" + max_lossless_tc: "2" + skip_pll_check: "false" + mac_clk: "750" + sys_clk: "975" + ifc_clk: "525" + txring: + - txring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "3" + desc_count: "1024" + prio: "1" + netdev: "true" + rxring: + - rxring_id: "0" + desc_count: "1024" + prio: "1" + queues: "0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44" + netdev: "true" + - rxring_id: "1" + desc_count: "1024" + prio: "1" + queues: "1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45" + netdev: "true" + - rxring_id: "2" + desc_count: "1024" + prio: "1" + queues: "2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46" + netdev: "true" + - rxring_id: "3" + desc_count: "1024" + prio: "1" + queues: "3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47" + netdev: "true" + devports: + - id: "0" + sysport: "1000" + type: "cpu" + - id: "1" + fec: "KRFEC" + lanes: "0:1" + serdes_group: "14" + speed: "25G" + sysport: "1" + type: "eth" + - id: "2" + fec: "KRFEC" + lanes: "1:1" + serdes_group: "14" + speed: "25G" + sysport: "2" + type: "eth" + - id: "3" + fec: "KRFEC" + lanes: "2:1" + serdes_group: "14" + speed: "25G" + sysport: "3" + type: "eth" + - id: "4" + fec: "KRFEC" + lanes: "3:1" + serdes_group: "14" + speed: "25G" + sysport: "4" + type: "eth" + - id: "5" + fec: "KRFEC" + lanes: "4:1" + serdes_group: "14" + speed: "25G" + sysport: "5" + type: "eth" + - id: "6" + fec: "KRFEC" + lanes: "5:1" + serdes_group: "14" + speed: "25G" + sysport: "6" + type: "eth" + - id: "7" + fec: "KRFEC" + lanes: "6:1" + serdes_group: "14" + speed: "25G" + sysport: "7" + type: "eth" + - id: "8" + fec: "KRFEC" + lanes: "7:1" + serdes_group: "14" + speed: "25G" + sysport: "8" + type: "eth" + - id: "9" + fec: "KRFEC" + lanes: "7:1" + serdes_group: "13" + speed: "25G" + sysport: "9" + type: "eth" + - id: "10" + fec: "KRFEC" + lanes: "6:1" + serdes_group: "13" + speed: "25G" + sysport: "10" + type: "eth" + - id: "11" + fec: "KRFEC" + lanes: "5:1" + serdes_group: "13" + speed: "25G" + sysport: "11" + type: "eth" + - id: "12" + fec: "KRFEC" + lanes: "4:1" + serdes_group: "13" + speed: "25G" + sysport: "12" + type: "eth" + - id: "13" + fec: "KRFEC" + lanes: "3:1" + serdes_group: "13" + speed: "25G" + sysport: "13" + type: "eth" + - id: "14" + fec: "KRFEC" + lanes: "2:1" + serdes_group: "13" + speed: "25G" + sysport: "14" + type: "eth" + - id: "15" + fec: "KRFEC" + lanes: "1:1" + serdes_group: "13" + speed: "25G" + sysport: "15" + type: "eth" + - id: "16" + fec: "KRFEC" + lanes: "0:1" + serdes_group: "13" + speed: "25G" + sysport: "16" + type: "eth" + - id: "17" + fec: "KRFEC" + lanes: "7:1" + serdes_group: "11" + speed: "25G" + sysport: "17" + type: "eth" + - id: "18" + fec: "KRFEC" + lanes: "6:1" + serdes_group: "11" + speed: "25G" + sysport: "18" + type: "eth" + - id: "19" + fec: "KRFEC" + lanes: "5:1" + serdes_group: "11" + speed: "25G" + sysport: "19" + type: "eth" + - id: "20" + fec: "KRFEC" + lanes: "4:1" + serdes_group: "11" + speed: "25G" + sysport: "20" + type: "eth" + - id: "21" + fec: "KRFEC" + lanes: "3:1" + serdes_group: "11" + speed: "25G" + sysport: "21" + type: "eth" + - id: "22" + fec: "KRFEC" + lanes: "2:1" + serdes_group: "11" + speed: "25G" + sysport: "22" + type: "eth" + - id: "23" + fec: "KRFEC" + lanes: "1:1" + serdes_group: "11" + speed: "25G" + sysport: "23" + type: "eth" + - id: "24" + fec: "KRFEC" + lanes: "0:1" + serdes_group: "11" + speed: "25G" + sysport: "24" + type: "eth" + - id: "25" + fec: "KRFEC" + lanes: "1:1" + serdes_group: "5" + speed: "25G" + sysport: "25" + type: "eth" + - id: "26" + fec: "KRFEC" + lanes: "5:1" + serdes_group: "5" + speed: "25G" + sysport: "26" + type: "eth" + - id: "27" + fec: "KRFEC" + lanes: "2:1" + serdes_group: "5" + speed: "25G" + sysport: "27" + type: "eth" + - id: "28" + fec: "KRFEC" + lanes: "3:1" + serdes_group: "5" + speed: "25G" + sysport: "28" + type: "eth" + - id: "29" + fec: "KRFEC" + lanes: "0:1" + serdes_group: "5" + speed: "25G" + sysport: "29" + type: "eth" + - id: "30" + fec: "KRFEC" + lanes: "4:1" + serdes_group: "5" + speed: "25G" + sysport: "30" + type: "eth" + - id: "31" + fec: "KRFEC" + lanes: "7:1" + serdes_group: "5" + speed: "25G" + sysport: "31" + type: "eth" + - id: "32" + fec: "KRFEC" + lanes: "6:1" + serdes_group: "5" + speed: "25G" + sysport: "32" + type: "eth" + - id: "33" + fec: "KRFEC" + lanes: "0:1" + serdes_group: "3" + speed: "25G" + sysport: "33" + type: "eth" + - id: "34" + fec: "KRFEC" + lanes: "1:1" + serdes_group: "3" + speed: "25G" + sysport: "34" + type: "eth" + - id: "35" + fec: "KRFEC" + lanes: "2:1" + serdes_group: "3" + speed: "25G" + sysport: "35" + type: "eth" + - id: "36" + fec: "KRFEC" + lanes: "3:1" + serdes_group: "3" + speed: "25G" + sysport: "36" + type: "eth" + - id: "37" + fec: "KRFEC" + lanes: "4:1" + serdes_group: "3" + speed: "25G" + sysport: "37" + type: "eth" + - id: "38" + fec: "KRFEC" + lanes: "5:1" + serdes_group: "3" + speed: "25G" + sysport: "38" + type: "eth" + - id: "39" + fec: "KRFEC" + lanes: "6:1" + serdes_group: "3" + speed: "25G" + sysport: "39" + type: "eth" + - id: "40" + fec: "KRFEC" + lanes: "7:1" + serdes_group: "3" + speed: "25G" + sysport: "40" + type: "eth" + - id: "41" + fec: "KRFEC" + lanes: "2:1" + serdes_group: "2" + speed: "25G" + sysport: "41" + type: "eth" + - id: "42" + fec: "KRFEC" + lanes: "0:1" + serdes_group: "2" + speed: "25G" + sysport: "42" + type: "eth" + - id: "43" + fec: "KRFEC" + lanes: "4:1" + serdes_group: "2" + speed: "25G" + sysport: "43" + type: "eth" + - id: "44" + fec: "KRFEC" + lanes: "1:1" + serdes_group: "2" + speed: "25G" + sysport: "44" + type: "eth" + - id: "45" + fec: "KRFEC" + lanes: "6:1" + serdes_group: "2" + speed: "25G" + sysport: "45" + type: "eth" + - id: "46" + fec: "KRFEC" + lanes: "3:1" + serdes_group: "2" + speed: "25G" + sysport: "46" + type: "eth" + - id: "47" + fec: "KRFEC" + lanes: "7:1" + serdes_group: "2" + speed: "25G" + sysport: "47" + type: "eth" + - id: "48" + fec: "KRFEC" + lanes: "5:1" + serdes_group: "2" + speed: "25G" + sysport: "48" + type: "eth" + - id: "49" + fec: "KRFEC" + lanes: "4:4" + serdes_group: "9" + speed: "100G" + sysport: "49" + type: "eth" + - id: "50" + fec: "KRFEC" + lanes: "0:4" + serdes_group: "9" + speed: "100G" + sysport: "50" + type: "eth" + - id: "51" + fec: "KRFEC" + lanes: "4:4" + serdes_group: "8" + speed: "100G" + sysport: "51" + type: "eth" + - id: "52" + fec: "KRFEC" + lanes: "0:4" + serdes_group: "8" + speed: "100G" + sysport: "52" + type: "eth" + - id: "53" + fec: "KRFEC" + lanes: "0:4" + serdes_group: "1" + speed: "100G" + sysport: "53" + type: "eth" + - id: "54" + fec: "KRFEC" + lanes: "4:4" + serdes_group: "1" + speed: "100G" + sysport: "54" + type: "eth" + - id: "55" + fec: "KRFEC" + lanes: "0:4" + serdes_group: "0" + speed: "100G" + sysport: "55" + type: "eth" + - id: "56" + fec: "KRFEC" + lanes: "4:4" + serdes_group: "0" + speed: "100G" + sysport: "56" + type: "eth" + - id: "130" + fec: "NONE" + lanes: "0:1" + serdes_group: "16" + speed: "10G" + sysport: "130" + type: "mgmt 0" + - id: "131" + fec: "NONE" + lanes: "1:1" + serdes_group: "16" + speed: "10G" + sysport: "131" + type: "mgmt 1" + isg: + - id: "0" + lane_swap: "01234567" + rx_polarity: "00000111" + tx_polarity: "10011110" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "1" + lane_swap: "01234567" + rx_polarity: "00000111" + tx_polarity: "00010001" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "2" + lane_swap: "01234567" + rx_polarity: "00100000" + tx_polarity: "01101111" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "3" + lane_swap: "01234567" + rx_polarity: "01000001" + tx_polarity: "10101000" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "4" + lane_swap: "01234567" + rx_polarity: "00010000" + tx_polarity: "10100000" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "5" + lane_swap: "01234567" + rx_polarity: "10100000" + tx_polarity: "01100100" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "6" + lane_swap: "01234567" + rx_polarity: "01010000" + tx_polarity: "00000100" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "7" + lane_swap: "01234567" + rx_polarity: "10000011" + tx_polarity: "00010110" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "8" + lane_swap: "01234567" + rx_polarity: "00001000" + tx_polarity: "00001000" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "9" + lane_swap: "01234567" + rx_polarity: "00000000" + tx_polarity: "10100100" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "10" + lane_swap: "01234567" + rx_polarity: "00000000" + tx_polarity: "00100011" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "11" + lane_swap: "01234567" + rx_polarity: "01000001" + tx_polarity: "00100000" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "12" + lane_swap: "01234567" + rx_polarity: "00001010" + tx_polarity: "01010111" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "13" + lane_swap: "01234567" + rx_polarity: "01001011" + tx_polarity: "00111010" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "14" + lane_swap: "01234567" + rx_polarity: "01000000" + tx_polarity: "11010111" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "15" + lane_swap: "01234567" + rx_polarity: "01000010" + tx_polarity: "11011000" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/innovium.55200 b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/innovium.55200 new file mode 100644 index 0000000000..1ceb2ed4a5 --- /dev/null +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/innovium.55200 @@ -0,0 +1,62 @@ +sku: innovium.55200 + +device_id: 0x1b59 + +# Hardware constraint information +hardware: + num_ibs: 2 + ib_active: 0, 1 + + ports_per_ib: 64, 64 + recirc_port_num: 64, 64 + cpu_port_num: 65 + cpu_port_ib: 0 + mgmt_port_num: 65, 66 + mgmt_port_ibs: 1, 1 + + pics_per_ib: 9, 9 + pic_ports_per_pic: 8 + max_serdes_speed: 25 + + num_shared_pics: 0 + + isg [0-7]: + ib: 0 + pic_id: [0-7] + + isg 8: + ib: 1 + pic_id: 7 + + isg 9: + ib: 1 + pic_id: 6 + + isg 10: + ib: 1 + pic_id: 5 + + isg 11: + ib: 1 + pic_id: 4 + + isg 12: + ib: 1 + pic_id: 3 + + isg 13: + ib: 1 + pic_id: 2 + + isg 14: + ib: 1 + pic_id: 1 + + isg 15: + ib: 1 + pic_id: 0 + + isg 16: + mode: 0:2 + ib: 1 + pic_id: 8 diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/ivm.sai.config.yaml b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/ivm.sai.config.yaml new file mode 100755 index 0000000000..313f47fe1f --- /dev/null +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/ivm.sai.config.yaml @@ -0,0 +1,8 @@ +IFCS_INIT_FILE : "/usr/share/sonic/hwsku/config_48x25G_8x100G_Delta-evs-a-32q56.yaml" +IFCS_SKU_FILE : "/usr/share/sonic/hwsku/innovium.55200" +IFCS_INNO_CLI_PORT : "9999" +IFCS_TARGET : "device" +INNOVIUM_DIR : "/innovium" +PYTHONPATH : "$INNOVIUM_DIR:$INNOVIUM_DIR/cmds:$INNOVIUM_DIR/scripts:$INNOVIUM_DIR/test/:$INNOVIUM_DIR/test/utils:$INNOVIUM_DIR/utils:$INNOVIUM_DIR/pyctypes" +IVM_SAI_DATAPATH_CONFIG_FILE: "/usr/share/sonic/hwsku/ivm.sai.datapath.config.yaml" +IVM_SAI_PARAM_A0008: "64" diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/ivm.sai.datapath.config.yaml b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/ivm.sai.datapath.config.yaml new file mode 100644 index 0000000000..ef4bc6d129 --- /dev/null +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/ivm.sai.datapath.config.yaml @@ -0,0 +1,9 @@ +ISAI_PARAM_P0_0_LS : "9216 9216" +ISAI_PARAM_P0_1_LS : "2850 2650" +ISAI_PARAM_P0_1_ALS : "290 90" +ISAI_PARAM_P1_0_LS : "3072 3072" +ISAI_PARAM_P1_0_LL : "6144 6144" +ISAI_PARAM_P1_1_LS : "2210 2010" +ISAI_PARAM_P1_1_LL : "1330 1330" +ISAI_PARAM_P1_1_ALS : "290 90" +ISAI_PARAM_P1_1_ALL : "50 50" diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/pg_profile_lookup.ini b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/pg_profile_lookup.ini new file mode 100644 index 0000000000..adcb52ab2a --- /dev/null +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/pg_profile_lookup.ini @@ -0,0 +1,18 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 25000 5m 1518 0 15680 1 13440 + 50000 5m 1518 0 21248 1 13440 + 100000 5m 1518 0 34624 1 13440 + 400000 5m 1518 0 117536 1 13440 + 25000 40m 1518 0 16928 1 13440 + 50000 40m 1518 0 23392 1 13440 + 100000 40m 1518 0 38816 1 13440 + 400000 40m 1518 0 135520 1 13440 + 25000 100m 1518 0 18848 1 13440 + 50000 100m 1518 0 27264 1 13440 + 100000 100m 1518 0 46496 1 13440 + 400000 100m 1518 0 166688 1 13440 + 25000 300m 1518 0 25184 1 13440 + 50000 300m 1518 0 40128 1 13440 + 100000 300m 1518 0 72384 1 13440 + 400000 300m 1518 0 268640 1 13440 diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/port_config.ini b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/port_config.ini new file mode 100755 index 0000000000..be220fe39a --- /dev/null +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/port_config.ini @@ -0,0 +1,58 @@ +# name lanes speed index mtu fec +Ethernet0 113 25000 0 9126 rs +Ethernet1 114 25000 1 9126 rs +Ethernet2 115 25000 2 9126 rs +Ethernet3 116 25000 3 9126 rs +Ethernet4 117 25000 4 9126 rs +Ethernet5 118 25000 5 9126 rs +Ethernet6 119 25000 6 9126 rs +Ethernet7 120 25000 7 9126 rs +Ethernet8 112 25000 8 9126 rs +Ethernet9 111 25000 9 9126 rs +Ethernet10 110 25000 10 9126 rs +Ethernet11 109 25000 11 9126 rs +Ethernet12 108 25000 12 9126 rs +Ethernet13 107 25000 13 9126 rs +Ethernet14 106 25000 14 9126 rs +Ethernet15 105 25000 15 9126 rs +Ethernet16 96 25000 16 9126 rs +Ethernet17 95 25000 17 9126 rs +Ethernet18 94 25000 18 9126 rs +Ethernet19 93 25000 19 9126 rs +Ethernet20 92 25000 20 9126 rs +Ethernet21 91 25000 21 9126 rs +Ethernet22 90 25000 22 9126 rs +Ethernet23 89 25000 23 9126 rs +Ethernet24 42 25000 24 9126 rs +Ethernet25 46 25000 25 9126 rs +Ethernet26 43 25000 26 9126 rs +Ethernet27 44 25000 27 9126 rs +Ethernet28 41 25000 28 9126 rs +Ethernet29 45 25000 29 9126 rs +Ethernet30 48 25000 30 9126 rs +Ethernet31 47 25000 31 9126 rs +Ethernet32 25 25000 32 9126 rs +Ethernet33 26 25000 33 9126 rs +Ethernet34 27 25000 34 9126 rs +Ethernet35 28 25000 35 9126 rs +Ethernet36 29 25000 36 9126 rs +Ethernet37 30 25000 37 9126 rs +Ethernet38 31 25000 38 9126 rs +Ethernet39 32 25000 39 9126 rs +Ethernet40 19 25000 40 9126 rs +Ethernet41 17 25000 41 9126 rs +Ethernet42 21 25000 42 9126 rs +Ethernet43 18 25000 43 9126 rs +Ethernet44 23 25000 44 9126 rs +Ethernet45 20 25000 45 9126 rs +Ethernet46 24 25000 46 9126 rs +Ethernet47 22 25000 47 9126 rs +Ethernet48 77,78,79,80 100000 48 9126 rs +Ethernet49 73,74,75,76 100000 49 9126 rs +Ethernet50 37,38,39,40 100000 50 9126 rs +Ethernet51 33,34,35,36 100000 51 9126 rs +Ethernet52 9,10,11,12 100000 52 9126 rs +Ethernet53 13,14,15,16 100000 53 9126 rs +Ethernet52 1,2,3,4 100000 54 9126 rs +Ethernet52 5,6,7,8 100000 55 9126 rs + diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/qos.json.j2 b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/qos.json.j2 new file mode 100755 index 0000000000..4b9748c7b5 --- /dev/null +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/qos.json.j2 @@ -0,0 +1,114 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "0":"0", + "1":"1", + "2":"2", + "3":"3", + "4":"4", + "5":"5", + "6":"6", + "7":"7" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "red_min_threshold":"50000" + } + } +} diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/qos_defaults_def_lossy.j2 b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/qos_defaults_def_lossy.j2 new file mode 100755 index 0000000000..104d2d78de --- /dev/null +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/qos_defaults_def_lossy.j2 @@ -0,0 +1,118 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "0":"0", + "1":"1", + "2":"2", + "3":"3", + "4":"4", + "5":"5", + "6":"6", + "7":"7" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"0", + "4":"0", + "5":"0", + "6":"0", + "7":"0", + "8":"0", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]" + } + }, + "SCHEDULER": { + "scheduler.7": { + "type": "STRICT" + } + }, + "QUEUE": { + "{{ port_names }}|7": { + "scheduler": "[SCHEDULER|scheduler.7]" + } + } +} diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/qos_defaults_lossy_t1.j2 b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/qos_defaults_lossy_t1.j2 new file mode 100755 index 0000000000..f1cd38f28d --- /dev/null +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/qos_defaults_lossy_t1.j2 @@ -0,0 +1,118 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "0":"0", + "1":"1", + "2":"2", + "3":"3", + "4":"4", + "5":"5", + "6":"6", + "7":"7" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]" + } + }, + "SCHEDULER": { + "scheduler.7": { + "type": "STRICT" + } + }, + "QUEUE": { + "{{ port_names }}|7": { + "scheduler": "[SCHEDULER|scheduler.7]" + } + } +} diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/qos_defaults_t1.j2 b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/qos_defaults_t1.j2 new file mode 100644 index 0000000000..4b9748c7b5 --- /dev/null +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/qos_defaults_t1.j2 @@ -0,0 +1,114 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "0":"0", + "1":"1", + "2":"2", + "3":"3", + "4":"4", + "5":"5", + "6":"6", + "7":"7" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "red_min_threshold":"50000" + } + } +} diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/sai.profile b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/sai.profile new file mode 100755 index 0000000000..aba4fc81fb --- /dev/null +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_48x25_8x100/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/ivm.sai.config.yaml diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_64x100/buffers.json.j2 b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_64x100/buffers.json.j2 index 1ab009be2d..6f9ed3c7f6 100644 --- a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_64x100/buffers.json.j2 +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_64x100/buffers.json.j2 @@ -93,7 +93,7 @@ "pool":"[BUFFER_POOL|ingress_lossless_pool]", "xoff":"38816", "size":"1518", - "dynamic_th":"3", + "dynamic_th":"1", "xon_offset":"13440" }, "egress_lossless_profile": { @@ -109,7 +109,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_64x100/buffers_defaults_def_lossy.j2 b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_64x100/buffers_defaults_def_lossy.j2 index c61ec1d149..72a618f07f 100644 --- a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_64x100/buffers_defaults_def_lossy.j2 +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_64x100/buffers_defaults_def_lossy.j2 @@ -22,7 +22,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_64x100/buffers_defaults_t1.j2 b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_64x100/buffers_defaults_t1.j2 index 1ab009be2d..6f9ed3c7f6 100644 --- a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_64x100/buffers_defaults_t1.j2 +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_64x100/buffers_defaults_t1.j2 @@ -93,7 +93,7 @@ "pool":"[BUFFER_POOL|ingress_lossless_pool]", "xoff":"38816", "size":"1518", - "dynamic_th":"3", + "dynamic_th":"1", "xon_offset":"13440" }, "egress_lossless_profile": { @@ -109,7 +109,7 @@ "egress_lossy_profile": { "pool":"[BUFFER_POOL|lossy_pool]", "size":"1518", - "dynamic_th":"3" + "dynamic_th":"2" } }, "BUFFER_PG": { diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_64x100/ivm.sai.config.yaml b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_64x100/ivm.sai.config.yaml index 607e2da931..ff1b69d113 100755 --- a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_64x100/ivm.sai.config.yaml +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_64x100/ivm.sai.config.yaml @@ -4,6 +4,5 @@ IFCS_INNO_CLI_PORT : "9999" IFCS_TARGET : "device" INNOVIUM_DIR : "/innovium" PYTHONPATH : "$INNOVIUM_DIR:$INNOVIUM_DIR/cmds:$INNOVIUM_DIR/scripts:$INNOVIUM_DIR/test/:$INNOVIUM_DIR/test/utils:$INNOVIUM_DIR/utils:$INNOVIUM_DIR/pyctypes" -AVG_IPG_RESERVED_SIZE: "1518" -AVG_QUEUE_RESERVED_SIZE: "1518" IVM_SAI_DATAPATH_CONFIG_FILE: "/usr/share/sonic/hwsku/ivm.sai.datapath.config.yaml" +IVM_SAI_PARAM_A0008: "32" diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_64x100/pg_profile_lookup.ini b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_64x100/pg_profile_lookup.ini index 36c3bb0a48..adcb52ab2a 100644 --- a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_64x100/pg_profile_lookup.ini +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_64x100/pg_profile_lookup.ini @@ -1,14 +1,18 @@ # PG lossless profiles. # speed cable size xon xoff threshold xon_offset - 25000 5m 1518 0 17600 3 13440 - 50000 5m 1518 0 23456 3 13440 - 100000 5m 1518 0 36064 3 13440 - 400000 5m 1518 0 118464 3 13440 - 25000 40m 1518 0 18720 3 13440 - 50000 40m 1518 0 25696 3 13440 - 100000 40m 1518 0 40544 3 13440 - 400000 40m 1518 0 136384 3 13440 - 25000 300m 1518 0 27040 3 13440 - 50000 300m 1518 0 42336 3 13440 - 100000 300m 1518 0 73824 3 13440 - 400000 300m 1518 0 269504 3 13440 + 25000 5m 1518 0 15680 1 13440 + 50000 5m 1518 0 21248 1 13440 + 100000 5m 1518 0 34624 1 13440 + 400000 5m 1518 0 117536 1 13440 + 25000 40m 1518 0 16928 1 13440 + 50000 40m 1518 0 23392 1 13440 + 100000 40m 1518 0 38816 1 13440 + 400000 40m 1518 0 135520 1 13440 + 25000 100m 1518 0 18848 1 13440 + 50000 100m 1518 0 27264 1 13440 + 100000 100m 1518 0 46496 1 13440 + 400000 100m 1518 0 166688 1 13440 + 25000 300m 1518 0 25184 1 13440 + 50000 300m 1518 0 40128 1 13440 + 100000 300m 1518 0 72384 1 13440 + 400000 300m 1518 0 268640 1 13440 diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_64x100/qos.json.j2 b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_64x100/qos.json.j2 index 3938fc1a05..4b9748c7b5 100755 --- a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_64x100/qos.json.j2 +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_64x100/qos.json.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", "pfc_enable": "3,4" } }, diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_64x100/qos_defaults_def_lossy.j2 b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_64x100/qos_defaults_def_lossy.j2 index 205242d829..104d2d78de 100755 --- a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_64x100/qos_defaults_def_lossy.j2 +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_64x100/qos_defaults_def_lossy.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]" + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]" } }, "SCHEDULER": { diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_64x100/qos_defaults_t1.j2 b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_64x100/qos_defaults_t1.j2 index 3938fc1a05..4b9748c7b5 100644 --- a/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_64x100/qos_defaults_t1.j2 +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/Delta-evs-a-32q56_64x100/qos_defaults_t1.j2 @@ -23,8 +23,8 @@ "0": "0", "1": "0", "2": "0", - "3": "1", - "4": "2", + "3": "3", + "4": "4", "5": "0", "6": "0", "7": "0" @@ -100,9 +100,9 @@ }, "PORT_QOS_MAP": { "{{ port_names }}": { - "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", - "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", "pfc_enable": "3,4" } }, diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/led_proc_init.soc b/device/delta/x86_64-delta_evs-a-32q56-r0/led_proc_init.soc new file mode 100644 index 0000000000..4173de277f --- /dev/null +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/led_proc_init.soc @@ -0,0 +1,10 @@ +#ET_C032IF Port_Remap +# Vlan set and port enable + +# led0 port order remap + +#ET_C032IF_LED + +#-------------------------------------------------------------------------------------------------- +#LED Auto link/up + diff --git a/device/delta/x86_64-delta_evs-a-32q56-r0/plugins/sfputil.py b/device/delta/x86_64-delta_evs-a-32q56-r0/plugins/sfputil.py index d0ed79f45b..ddb389230e 100644 --- a/device/delta/x86_64-delta_evs-a-32q56-r0/plugins/sfputil.py +++ b/device/delta/x86_64-delta_evs-a-32q56-r0/plugins/sfputil.py @@ -16,11 +16,10 @@ class SfpUtil(SfpUtilBase): PORT_START = 0 PORT_START_SFP = 32 - PORT_END = 33 + PORT_END = 33 PORTS_IN_BLOCK = 34 _port_to_eeprom_mapping = {} - port_dict = {} @property def port_start(self): @@ -29,7 +28,7 @@ class SfpUtil(SfpUtilBase): @property def port_end(self): return self.PORT_END - + @property def port_start_sfp(self): return self.PORT_START_SFP @@ -42,21 +41,6 @@ class SfpUtil(SfpUtilBase): def port_to_eeprom_mapping(self): return self._port_to_eeprom_mapping - @property - def get_transceiver_status(self): - - try: - reg_file = open("/sys/kernel/sfp/sfp_is_present") - - except IOError as e: - print "Error: unable to open file: %s" % str(e) - return False - - content = reg_file.readline().rstrip() - reg_file.close() - - return int(content, 16) - def __init__(self): eeprom_path = "/sys/bus/i2c/devices/{0}-0050/eeprom" @@ -67,8 +51,8 @@ class SfpUtil(SfpUtilBase): else: # QSFP1: 51-0050 ~ QSFP32: 82-0050 self.port_to_eeprom_mapping[x] = eeprom_path.format(x + 51) - - self.modprs_register = self.get_transceiver_status + + # self.modprs_register = self.get_transceiver_status SfpUtilBase.__init__(self) def get_presence(self, port_num): @@ -206,55 +190,6 @@ class SfpUtil(SfpUtilBase): return True - def get_transceiver_change_event(self, timeout=2000): - start_time = time.time() - port_dict = {} - port = self.port_start - forever = False - if timeout == 0: - forever = True - elif timeout > 0: - timeout = timeout / float(1000) # Convert to secs - else: - print "get_transceiver_change_event:Invalid timeout value", timeout - return False, {} + def get_transceiver_change_event(self, timeout=0): - end_time = start_time + timeout - if start_time > end_time: - print 'get_transceiver_change_event:' \ - 'time wrap / invalid timeout value', timeout - - return False, {} # Time wrap or possibly incorrect timeout - while timeout >= 0: - # Check for OIR events and return updated port_dict - reg_value = self.get_transceiver_status - if reg_value != self.modprs_register: - changed_ports = self.modprs_register ^ reg_value - while port >= self.port_start and port <= self.port_end: - - # Mask off the bit corresponding to our port - mask = (1 << port) - if changed_ports & mask: - # ModPrsL is active low - if reg_value & mask == 0: - port_dict[port] = '1' - else: - port_dict[port] = '0' - - port += 1 - - # Update reg value - self.modprs_register = reg_value - return True, port_dict - if forever: - time.sleep(1) - else: - timeout = end_time - time.time() - if timeout >= 1: - time.sleep(1) # We poll at 1 second granularity - else: - if timeout > 0: - time.sleep(timeout) - return True, {} - print "get_transceiver_change_event: Should not reach here." return False, {} diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k/buffers.json.j2 b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k/buffers.json.j2 new file mode 100644 index 0000000000..1a31812c26 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k/buffers.json.j2 @@ -0,0 +1,38 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "BUFFER_POOL": { + "lossy_pool": { + "size": "56985600", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"0", + "static_th":"9497600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"1518", + "dynamic_th":"2" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-7": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|0-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k/buffers_defaults_def_lossy.j2 b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k/buffers_defaults_def_lossy.j2 new file mode 100644 index 0000000000..1a31812c26 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k/buffers_defaults_def_lossy.j2 @@ -0,0 +1,38 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "BUFFER_POOL": { + "lossy_pool": { + "size": "56985600", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"0", + "static_th":"9497600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"1518", + "dynamic_th":"2" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-7": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|0-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k/buffers_defaults_t1.j2 b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k/buffers_defaults_t1.j2 new file mode 100644 index 0000000000..93dac6b199 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k/buffers_defaults_t1.j2 @@ -0,0 +1,137 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '40m' %} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) %} + {%- set cable_len = [] %} + {%- for local_port in DEVICE_NEIGHBOR %} + {%- if local_port == port_name %} + {%- if DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor_role = neighbor.type %} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role %} + {%- set roles1 = roles1 | lower %} + {%- set roles2 = roles2 | lower %} + {%- if roles1 in ports2cable %} + {%- if cable_len.append(ports2cable[roles1]) %}{% endif %} + {%- elif roles2 in ports2cable %} + {%- if cable_len.append(ports2cable[roles2]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else %} + {%- if switch_role.lower() == 'torrouter' %} + {%- for local_port in VLAN_MEMBER %} + {%- if local_port[1] == port_name %} + {%- set roles3 = switch_role + '_' + 'server' %} + {%- set roles3 = roles3 | lower %} + {%- if roles3 in ports2cable %} + {%- if cable_len.append(ports2cable[roles3]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- endif %} +{%- endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "47218432", + "type": "ingress", + "mode": "dynamic", + "xoff": "17708800" + }, + "lossy_pool": { + "size": "18874368", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xoff":"38816", + "size":"1518", + "dynamic_th":"1", + "xon_offset":"13440" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"9497600" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"0", + "static_th":"9497600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"1518", + "dynamic_th":"2" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/alt_cfg/config_32x400G_Delta-et-c032if_aux.yaml b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k/config_32x400G_wistron_sw_to3200k.yaml old mode 100755 new mode 100644 similarity index 59% rename from device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/alt_cfg/config_32x400G_Delta-et-c032if_aux.yaml rename to device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k/config_32x400G_wistron_sw_to3200k.yaml index 2ba23d2a5a..34b1437fa3 --- a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/alt_cfg/config_32x400G_Delta-et-c032if_aux.yaml +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k/config_32x400G_wistron_sw_to3200k.yaml @@ -10,6 +10,12 @@ nodes: multi_interface: "yes" buffer_management_mode: "api_driven" max_lossless_tc: "2" + ilpm_enable: "1" + forward_profile: "IFCS_FORWARD_PROFILE_ID_PROFILE_E" + ecn_stats_enable: "1" + led_cfg_sck_rate: "0x4" + led_refresh_precliff_timer: "0xa" + led_refresh_cliff_timer: "0xc350" txring: - txring_id: "0" desc_count: "1024" @@ -28,26 +34,25 @@ nodes: prio: "1" netdev: "true" rxring: - - rxring_id: "0" - desc_count: "1024" + - rxring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39" + - rxring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40" + - rxring_id: "2" + desc_count: "1024" prio: "1" - netdev: "true" - queues: "0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44" - - rxring_id: "1" - desc_count: "1024" - prio: "1" - netdev: "true" - queues: "1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45" - - rxring_id: "2" - desc_count: "1024" - prio: "1" - netdev: "true" - queues: "2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46" - - rxring_id: "3" - desc_count: "1024" - prio: "1" - netdev: "true" - queues: "3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47" + netdev: "true" + queues: "2, 5, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35, 38, 41, 47" + - rxring_id: "3" + desc_count: "1024" + prio: "1" + queues: "42, 43, 44, 45, 46" sys_clk: "1720" ifc_clk: "1200" mac_clk: "1340" @@ -57,88 +62,60 @@ nodes: sysport: "1000" type: "cpu" - fec: "KPFEC" - id: "249" + id: "89" lanes: "0:8" - serdes_group: "31" + serdes_group: "11" speed: "400G" - sysport: "249" + sysport: "89" type: "eth" - fec: "KPFEC" - id: "241" + id: "81" lanes: "0:8" - serdes_group: "30" + serdes_group: "10" speed: "400G" - sysport: "241" + sysport: "81" type: "eth" - fec: "KPFEC" - id: "233" + id: "73" lanes: "0:8" - serdes_group: "29" + serdes_group: "9" speed: "400G" - sysport: "233" + sysport: "73" type: "eth" - fec: "KPFEC" - id: "225" + id: "65" lanes: "0:8" - serdes_group: "28" + serdes_group: "8" speed: "400G" - sysport: "225" + sysport: "65" type: "eth" - fec: "KPFEC" - id: "217" + id: "57" lanes: "0:8" - serdes_group: "27" + serdes_group: "7" speed: "400G" - sysport: "217" + sysport: "57" type: "eth" - fec: "KPFEC" - id: "209" + id: "49" lanes: "0:8" - serdes_group: "26" + serdes_group: "6" speed: "400G" - sysport: "209" + sysport: "49" type: "eth" - fec: "KPFEC" - id: "201" + id: "41" lanes: "0:8" - serdes_group: "25" + serdes_group: "5" speed: "400G" - sysport: "201" + sysport: "41" type: "eth" - fec: "KPFEC" - id: "193" + id: "33" lanes: "0:8" - serdes_group: "24" + serdes_group: "4" speed: "400G" - sysport: "193" - type: "eth" - - fec: "KPFEC" - id: "185" - lanes: "0:8" - serdes_group: "23" - speed: "400G" - sysport: "185" - type: "eth" - - fec: "KPFEC" - id: "177" - lanes: "0:8" - serdes_group: "22" - speed: "400G" - sysport: "177" - type: "eth" - - fec: "KPFEC" - id: "169" - lanes: "0:8" - serdes_group: "21" - speed: "400G" - sysport: "169" - type: "eth" - - fec: "KPFEC" - id: "161" - lanes: "0:8" - serdes_group: "20" - speed: "400G" - sysport: "161" + sysport: "33" type: "eth" - fec: "KPFEC" id: "153" @@ -182,6 +159,13 @@ nodes: speed: "400G" sysport: "113" type: "eth" + - fec: "KPFEC" + id: "105" + lanes: "0:8" + serdes_group: "13" + speed: "400G" + sysport: "105" + type: "eth" - fec: "KPFEC" id: "97" lanes: "0:8" @@ -190,67 +174,60 @@ nodes: sysport: "97" type: "eth" - fec: "KPFEC" - id: "105" + id: "209" lanes: "0:8" - serdes_group: "13" + serdes_group: "26" speed: "400G" - sysport: "105" - type: "eth" - - fec: "KPFEC" - id: "81" - lanes: "0:8" - serdes_group: "10" - speed: "400G" - sysport: "81" + sysport: "209" type: "eth" - fec: "KPFEC" - id: "89" + id: "217" lanes: "0:8" - serdes_group: "11" + serdes_group: "27" speed: "400G" - sysport: "89" + sysport: "217" type: "eth" - fec: "KPFEC" - id: "65" + id: "193" lanes: "0:8" - serdes_group: "8" + serdes_group: "24" speed: "400G" - sysport: "65" + sysport: "193" type: "eth" - fec: "KPFEC" - id: "73" + id: "201" lanes: "0:8" - serdes_group: "9" + serdes_group: "25" speed: "400G" - sysport: "73" + sysport: "201" type: "eth" - fec: "KPFEC" - id: "49" + id: "177" lanes: "0:8" - serdes_group: "6" + serdes_group: "22" speed: "400G" - sysport: "49" + sysport: "177" type: "eth" - fec: "KPFEC" - id: "57" + id: "185" lanes: "0:8" - serdes_group: "7" + serdes_group: "23" speed: "400G" - sysport: "57" + sysport: "185" type: "eth" - fec: "KPFEC" - id: "33" + id: "161" lanes: "0:8" - serdes_group: "4" + serdes_group: "20" speed: "400G" - sysport: "33" + sysport: "161" type: "eth" - fec: "KPFEC" - id: "41" + id: "169" lanes: "0:8" - serdes_group: "5" + serdes_group: "21" speed: "400G" - sysport: "41" + sysport: "169" type: "eth" - fec: "KPFEC" id: "17" @@ -280,149 +257,163 @@ nodes: speed: "400G" sysport: "9" type: "eth" - - fec: "NONE" - id: "257" - lanes: "0:1" - serdes_group: "32" - speed: "10G" - sysport: "257" - type: "mgmt 0" - - fec: "NONE" - id: "258" - lanes: "1:1" - serdes_group: "32" - speed: "10G" - sysport: "258" - type: "mgmt 1" + - fec: "KPFEC" + id: "241" + lanes: "0:8" + serdes_group: "30" + speed: "400G" + sysport: "241" + type: "eth" + - fec: "KPFEC" + id: "249" + lanes: "0:8" + serdes_group: "31" + speed: "400G" + sysport: "249" + type: "eth" + - fec: "KPFEC" + id: "225" + lanes: "0:8" + serdes_group: "28" + speed: "400G" + sysport: "225" + type: "eth" + - fec: "KPFEC" + id: "233" + lanes: "0:8" + serdes_group: "29" + speed: "400G" + sysport: "233" + type: "eth" isg: - id: "0" - tx_polarity: "01010101" - rx_polarity: "01100000" - lane_swap: "23641075" + tx_polarity: "00000000" + rx_polarity: "10000010" + lane_swap: "57234601" - id: "1" - tx_polarity: "10110000" - rx_polarity: "11111111" - lane_swap: "64317520" + tx_polarity: "01000101" + rx_polarity: "01110011" + lane_swap: "51364072" - id: "2" tx_polarity: "00000000" - rx_polarity: "00000011" - lane_swap: "63147520" + rx_polarity: "00000010" + lane_swap: "57043621" - id: "3" - tx_polarity: "01101000" - rx_polarity: "00001110" - lane_swap: "31572046" + tx_polarity: "00000110" + rx_polarity: "00100111" + lane_swap: "56024371" - id: "4" - tx_polarity: "00111000" - rx_polarity: "00001000" - lane_swap: "46105732" - - id: "5" - tx_polarity: "10111111" - rx_polarity: "11101000" - lane_swap: "27153604" - - id: "6" - tx_polarity: "01101110" - rx_polarity: "00001101" - lane_swap: "46503721" - - id: "7" - tx_polarity: "01000100" - rx_polarity: "10000101" - lane_swap: "03671245" - - id: "8" - tx_polarity: "01110101" + tx_polarity: "00110101" rx_polarity: "00010000" - lane_swap: "12640375" + lane_swap: "65137402" + - id: "5" + tx_polarity: "00000000" + rx_polarity: "00100000" + lane_swap: "61704253" + - id: "6" + tx_polarity: "10010010" + rx_polarity: "00000100" + lane_swap: "64027315" + - id: "7" + tx_polarity: "00000000" + rx_polarity: "10111011" + lane_swap: "60714253" + - id: "8" + tx_polarity: "10100110" + rx_polarity: "00010101" + lane_swap: "67042315" - id: "9" - tx_polarity: "01011100" - rx_polarity: "11001111" - lane_swap: "02561347" - - id: "10" - tx_polarity: "01110110" - rx_polarity: "11000000" - lane_swap: "12740365" - - id: "11" - tx_polarity: "00111000" - rx_polarity: "00010111" - lane_swap: "01572436" - - id: "12" - tx_polarity: "00001111" - rx_polarity: "10111001" - lane_swap: "54320176" - - id: "13" - tx_polarity: "10011101" - rx_polarity: "00111011" - lane_swap: "26153704" - - id: "14" - tx_polarity: "00110000" + tx_polarity: "00000000" rx_polarity: "11010000" - lane_swap: "37452601" + lane_swap: "20716453" + - id: "10" + tx_polarity: "00010000" + rx_polarity: "00000000" + lane_swap: "57026314" + - id: "11" + tx_polarity: "00000000" + rx_polarity: "00010000" + lane_swap: "37014625" + - id: "12" + tx_polarity: "00100001" + rx_polarity: "00110111" + lane_swap: "50473216" + - id: "13" + tx_polarity: "00001000" + rx_polarity: "11010001" + lane_swap: "16345702" + - id: "14" + tx_polarity: "11010110" + rx_polarity: "01100100" + lane_swap: "64107352" - id: "15" - tx_polarity: "11100010" - rx_polarity: "01110011" - lane_swap: "51370462" + tx_polarity: "00100000" + rx_polarity: "01001011" + lane_swap: "46325710" - id: "16" - tx_polarity: "10111010" - rx_polarity: "11010011" - lane_swap: "36152704" - - id: "17" - tx_polarity: "01011101" + tx_polarity: "10011001" rx_polarity: "00110001" - lane_swap: "45621073" + lane_swap: "54216730" + - id: "17" + tx_polarity: "00001001" + rx_polarity: "11000000" + lane_swap: "25176304" - id: "18" - tx_polarity: "11011111" - rx_polarity: "11001011" - lane_swap: "26143705" + tx_polarity: "00001000" + rx_polarity: "01101010" + lane_swap: "73405612" - id: "19" - tx_polarity: "00100110" - rx_polarity: "00001001" - lane_swap: "42730165" + tx_polarity: "00110100" + rx_polarity: "10001010" + lane_swap: "25176304" - id: "20" - tx_polarity: "10011011" - rx_polarity: "01101101" - lane_swap: "54217603" + tx_polarity: "00000000" + rx_polarity: "00100000" + lane_swap: "45617230" - id: "21" - tx_polarity: "00101110" - rx_polarity: "10111111" - lane_swap: "26031745" + tx_polarity: "11100001" + rx_polarity: "00010011" + lane_swap: "46720531" - id: "22" - tx_polarity: "01001110" - rx_polarity: "00111001" - lane_swap: "36024715" + tx_polarity: "00000000" + rx_polarity: "11110111" + lane_swap: "47236501" - id: "23" - tx_polarity: "10101101" - rx_polarity: "01010011" - lane_swap: "45621370" + tx_polarity: "10100001" + rx_polarity: "00000000" + lane_swap: "76245301" - id: "24" - tx_polarity: "11001110" - rx_polarity: "00011111" - lane_swap: "65234701" + tx_polarity: "01000000" + rx_polarity: "00111100" + lane_swap: "47316520" - id: "25" - tx_polarity: "01110001" - rx_polarity: "01010111" - lane_swap: "37601452" + tx_polarity: "10111110" + rx_polarity: "00000001" + lane_swap: "61072543" - id: "26" - tx_polarity: "01000100" - rx_polarity: "00001111" - lane_swap: "65034721" + tx_polarity: "00100000" + rx_polarity: "01111000" + lane_swap: "51627430" - id: "27" - tx_polarity: "10111101" - rx_polarity: "11000101" - lane_swap: "34501672" + tx_polarity: "10101001" + rx_polarity: "00000000" + lane_swap: "24017536" - id: "28" - tx_polarity: "01111000" - rx_polarity: "01110110" - lane_swap: "43061275" + tx_polarity: "00000000" + rx_polarity: "10000010" + lane_swap: "26073514" - id: "29" - tx_polarity: "11110111" - rx_polarity: "11100111" - lane_swap: "57304621" + tx_polarity: "01001000" + rx_polarity: "00000000" + lane_swap: "43027615" - id: "30" - tx_polarity: "10000100" - rx_polarity: "00101111" - lane_swap: "47125603" + tx_polarity: "00000000" + rx_polarity: "11010010" + lane_swap: "47235601" - id: "31" - tx_polarity: "11111111" - rx_polarity: "11100010" - lane_swap: "13460275" + tx_polarity: "11111100" + rx_polarity: "00000010" + lane_swap: "46025713" - id: "32" tx_polarity: "00000000" rx_polarity: "00000000" diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k/innovium.77700_A b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k/innovium.77700_A new file mode 100644 index 0000000000..84aa419836 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k/innovium.77700_A @@ -0,0 +1,59 @@ +sku: innovium.77700_A + +device_id: 0x1b58 + +# Hardware constraint information +hardware: + num_ibs: 6 + + ports_per_ib: 32, 32, 32, 32, 20, 20 + recirc_port_num: 32, 32, 32, 32, 32, 32 + cpu_port_num: 33 + cpu_port_ib: 0 + mgmt_port_num: 33 + mgmt_port_ibs: 1,2 + + pics_per_ib: 6, 7, 6, 5, 5, 5 + pic_ports_per_pic: 8 + max_serdes_speed: 50 + + num_shared_pics: 2 + + isg [0-4]: + ib: 0 + pic_id: [0-4] + + isg [5-9]: + ib: 5 + pic_id: [0-4] + + isg [10-14]: + ib: 1 + pic_id: [0-4] + + isg [16-20]: + ib: 3 + pic_id: [0-4] + + isg [21-25]: + ib: 4 + pic_id: [0-4] + + isg [26-30]: + ib: 2 + pic_id: [0-4] + + isg 15: + mode: 8:0 + ib: 1 + pic_id: 5 + + isg 31: + mode: 8:0 + ib: 0 + pic_id: 5 + + isg 32: + mode: 1:1 + ib: 1, 2 + pic_id: 6 diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k/innovium.77700_B b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k/innovium.77700_B new file mode 100644 index 0000000000..27297b3139 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k/innovium.77700_B @@ -0,0 +1,59 @@ +sku: innovium.77700_B + +device_id: 0x1b58 + +# Hardware constraint information +hardware: + num_ibs: 6 + + ports_per_ib: 32, 32, 32, 32, 20, 20 + recirc_port_num: 32, 32, 32, 32, 32, 32 + cpu_port_num: 33 + cpu_port_ib: 0 + mgmt_port_num: 33 + mgmt_port_ibs: 1,2 + + pics_per_ib: 6, 7, 7, 6, 5, 5 + pic_ports_per_pic: 8 + max_serdes_speed: 50 + + num_shared_pics: 2 + + isg [0-4]: + ib: 0 + pic_id: [0-4] + + isg [5-9]: + ib: 5 + pic_id: [0-4] + + isg [10-14]: + ib: 1 + pic_id: [0-4] + + isg [16-20]: + ib: 3 + pic_id: [0-4] + + isg [21-25]: + ib: 4 + pic_id: [0-4] + + isg [26-30]: + ib: 2 + pic_id: [0-4] + + isg 15: + mode: 4:4 + ib: 1, 3 + pic_id: 5 + + isg 31: + mode: 4:4 + ib: 0, 2 + pic_id: 5 + + isg 32: + mode: 1:1 + ib: 1, 2 + pic_id: 6 diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k/ivm.sai.config.yaml b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k/ivm.sai.config.yaml new file mode 100755 index 0000000000..d306017f5f --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k/ivm.sai.config.yaml @@ -0,0 +1,9 @@ +IFCS_INIT_FILE : "/usr/share/sonic/hwsku/config_32x400G_wistron_sw_to3200k.yaml" +IFCS_SKU_FILE : "/usr/share/sonic/hwsku/innovium.77700_A" +IFCS_INNO_CLI_PORT : "9999" +IFCS_TARGET : "device" +INNOVIUM_DIR : "/innovium" +PYTHONPATH : "$INNOVIUM_DIR:$INNOVIUM_DIR/cmds:$INNOVIUM_DIR/scripts:$INNOVIUM_DIR/test/:$INNOVIUM_DIR/test/utils:$INNOVIUM_DIR/utils:$INNOVIUM_DIR/pyctypes" +PLATFORM_LIBRARY: "/usr/share/sonic/platform/libplatform.so" +IVM_SAI_DATAPATH_CONFIG_FILE: "/usr/share/sonic/hwsku/ivm.sai.datapath.config.yaml" +IVM_SAI_PARAM_A0008: "32" diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k/ivm.sai.datapath.config.yaml b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k/ivm.sai.datapath.config.yaml new file mode 100644 index 0000000000..891b0b3e28 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k/ivm.sai.datapath.config.yaml @@ -0,0 +1,9 @@ +ISAI_PARAM_P0_0_LS : "4608 4608 4608 4608 2880 2880" +ISAI_PARAM_P0_1_LS : "2226 1946 1946 1890 1218 1218" +ISAI_PARAM_P0_1_ALS : "434 154 154 98 98 98" +ISAI_PARAM_P1_0_LS : "1536 1536 1536 1536 960 960" +ISAI_PARAM_P1_0_LL : "3072 3072 3072 3072 1920 1920" +ISAI_PARAM_P1_1_LS : "1778 1498 1498 1442 938 938" +ISAI_PARAM_P1_1_LL : "2478 2478 2478 2478 2478 2478" +ISAI_PARAM_P1_1_ALS : "434 154 154 98 98 98" +ISAI_PARAM_P1_1_ALL : "126 126 126 126 126 126" diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k/pg_profile_lookup.ini b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k/pg_profile_lookup.ini new file mode 100644 index 0000000000..adcb52ab2a --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k/pg_profile_lookup.ini @@ -0,0 +1,18 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 25000 5m 1518 0 15680 1 13440 + 50000 5m 1518 0 21248 1 13440 + 100000 5m 1518 0 34624 1 13440 + 400000 5m 1518 0 117536 1 13440 + 25000 40m 1518 0 16928 1 13440 + 50000 40m 1518 0 23392 1 13440 + 100000 40m 1518 0 38816 1 13440 + 400000 40m 1518 0 135520 1 13440 + 25000 100m 1518 0 18848 1 13440 + 50000 100m 1518 0 27264 1 13440 + 100000 100m 1518 0 46496 1 13440 + 400000 100m 1518 0 166688 1 13440 + 25000 300m 1518 0 25184 1 13440 + 50000 300m 1518 0 40128 1 13440 + 100000 300m 1518 0 72384 1 13440 + 400000 300m 1518 0 268640 1 13440 diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k/port_config.ini b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k/port_config.ini new file mode 100644 index 0000000000..66220e66a8 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k/port_config.ini @@ -0,0 +1,33 @@ +# name lanes alias speed index mtu fec +Ethernet0 89,90,91,92,93,94,95,96 Eth1 400000 0 9126 rs +Ethernet8 81,82,83,84,85,86,87,88 Eth2 400000 1 9126 rs +Ethernet16 73,74,75,76,77,78,79,80 Eth3 400000 2 9126 rs +Ethernet24 65,66,67,68,69,70,71,72 Eth4 400000 3 9126 rs +Ethernet32 57,58,59,60,61,62,63,64 Eth5 400000 4 9126 rs +Ethernet40 49,50,51,52,53,54,55,56 Eth6 400000 5 9126 rs +Ethernet48 41,42,43,44,45,46,47,48 Eth7 400000 6 9126 rs +Ethernet56 33,34,35,36,37,38,39,40 Eth8 400000 7 9126 rs +Ethernet64 153,154,155,156,157,158,159,160 Eth9 400000 8 9126 rs +Ethernet72 145,146,147,148,149,150,151,152 Eth10 400000 9 9126 rs +Ethernet80 137,138,139,140,141,142,143,144 Eth11 400000 10 9126 rs +Ethernet88 129,130,131,132,133,134,135,136 Eth12 400000 11 9126 rs +Ethernet96 121,122,123,124,125,126,127,128 Eth13 400000 12 9126 rs +Ethernet104 113,114,115,116,117,118,119,120 Eth14 400000 13 9126 rs +Ethernet112 105,106,107,108,109,110,111,112 Eth15 400000 14 9126 rs +Ethernet120 97,98,99,100,101,102,103,104 Eth16 400000 15 9126 rs +Ethernet128 209,210,211,212,213,214,215,216 Eth17 400000 16 9126 rs +Ethernet136 217,218,219,220,221,222,223,224 Eth18 400000 17 9126 rs +Ethernet144 193,194,195,196,197,198,199,200 Eth19 400000 18 9126 rs +Ethernet152 201,202,203,204,205,206,207,208 Eth20 400000 19 9126 rs +Ethernet160 177,178,179,180,181,182,183,184 Eth21 400000 20 9126 rs +Ethernet168 185,186,187,188,189,190,191,192 Eth22 400000 21 9126 rs +Ethernet176 161,162,163,164,165,166,167,168 Eth23 400000 22 9126 rs +Ethernet184 169,170,171,172,173,174,175,176 Eth24 400000 23 9126 rs +Ethernet192 17,18,19,20,21,22,23,24 Eth25 400000 24 9126 rs +Ethernet200 25,26,27,28,29,30,31,32 Eth26 400000 25 9126 rs +Ethernet208 1,2,3,4,5,6,7,8 Eth27 400000 26 9126 rs +Ethernet216 9,10,11,12,13,14,15,16 Eth28 400000 27 9126 rs +Ethernet224 241,242,243,244,245,246,247,248 Eth29 400000 28 9126 rs +Ethernet232 249,250,251,252,253,254,255,256 Eth30 400000 29 9126 rs +Ethernet240 225,226,227,228,229,230,231,232 Eth31 400000 30 9126 rs +Ethernet248 233,234,235,236,237,238,239,240 Eth32 400000 31 9126 rs diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k/qos.json.j2 b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k/qos.json.j2 new file mode 100755 index 0000000000..104d2d78de --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k/qos.json.j2 @@ -0,0 +1,118 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "0":"0", + "1":"1", + "2":"2", + "3":"3", + "4":"4", + "5":"5", + "6":"6", + "7":"7" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"0", + "4":"0", + "5":"0", + "6":"0", + "7":"0", + "8":"0", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]" + } + }, + "SCHEDULER": { + "scheduler.7": { + "type": "STRICT" + } + }, + "QUEUE": { + "{{ port_names }}|7": { + "scheduler": "[SCHEDULER|scheduler.7]" + } + } +} diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k/qos_defaults_def_lossy.j2 b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k/qos_defaults_def_lossy.j2 new file mode 100755 index 0000000000..104d2d78de --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k/qos_defaults_def_lossy.j2 @@ -0,0 +1,118 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "0":"0", + "1":"1", + "2":"2", + "3":"3", + "4":"4", + "5":"5", + "6":"6", + "7":"7" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"0", + "4":"0", + "5":"0", + "6":"0", + "7":"0", + "8":"0", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]" + } + }, + "SCHEDULER": { + "scheduler.7": { + "type": "STRICT" + } + }, + "QUEUE": { + "{{ port_names }}|7": { + "scheduler": "[SCHEDULER|scheduler.7]" + } + } +} diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k/qos_defaults_t1.j2 b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k/qos_defaults_t1.j2 new file mode 100755 index 0000000000..4b9748c7b5 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k/qos_defaults_t1.j2 @@ -0,0 +1,114 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "0":"0", + "1":"1", + "2":"2", + "3":"3", + "4":"4", + "5":"5", + "6":"6", + "7":"7" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "red_min_threshold":"50000" + } + } +} diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k/sai.profile b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k/sai.profile new file mode 100644 index 0000000000..aba4fc81fb --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/ivm.sai.config.yaml diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_104x1025_6x100/buffers.json.j2 b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_104x1025_6x100/buffers.json.j2 new file mode 100644 index 0000000000..1a31812c26 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_104x1025_6x100/buffers.json.j2 @@ -0,0 +1,38 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "BUFFER_POOL": { + "lossy_pool": { + "size": "56985600", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"0", + "static_th":"9497600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"1518", + "dynamic_th":"2" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-7": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|0-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_104x1025_6x100/buffers_defaults_def_lossy.j2 b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_104x1025_6x100/buffers_defaults_def_lossy.j2 new file mode 100644 index 0000000000..1a31812c26 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_104x1025_6x100/buffers_defaults_def_lossy.j2 @@ -0,0 +1,38 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "BUFFER_POOL": { + "lossy_pool": { + "size": "56985600", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"0", + "static_th":"9497600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"1518", + "dynamic_th":"2" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-7": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|0-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_104x1025_6x100/buffers_defaults_t1.j2 b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_104x1025_6x100/buffers_defaults_t1.j2 new file mode 100644 index 0000000000..93dac6b199 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_104x1025_6x100/buffers_defaults_t1.j2 @@ -0,0 +1,137 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '40m' %} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) %} + {%- set cable_len = [] %} + {%- for local_port in DEVICE_NEIGHBOR %} + {%- if local_port == port_name %} + {%- if DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor_role = neighbor.type %} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role %} + {%- set roles1 = roles1 | lower %} + {%- set roles2 = roles2 | lower %} + {%- if roles1 in ports2cable %} + {%- if cable_len.append(ports2cable[roles1]) %}{% endif %} + {%- elif roles2 in ports2cable %} + {%- if cable_len.append(ports2cable[roles2]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else %} + {%- if switch_role.lower() == 'torrouter' %} + {%- for local_port in VLAN_MEMBER %} + {%- if local_port[1] == port_name %} + {%- set roles3 = switch_role + '_' + 'server' %} + {%- set roles3 = roles3 | lower %} + {%- if roles3 in ports2cable %} + {%- if cable_len.append(ports2cable[roles3]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- endif %} +{%- endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "47218432", + "type": "ingress", + "mode": "dynamic", + "xoff": "17708800" + }, + "lossy_pool": { + "size": "18874368", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xoff":"38816", + "size":"1518", + "dynamic_th":"1", + "xon_offset":"13440" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"9497600" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"0", + "static_th":"9497600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"1518", + "dynamic_th":"2" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_104x1025_6x100/config_104x1025G_6x100G_wistron_sw_to3200k.yaml b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_104x1025_6x100/config_104x1025G_6x100G_wistron_sw_to3200k.yaml new file mode 100644 index 0000000000..41dea285a6 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_104x1025_6x100/config_104x1025G_6x100G_wistron_sw_to3200k.yaml @@ -0,0 +1,966 @@ +ifcs: + options: + log_level: "info" +nodes: +- node_id: "0" + options: + sku: "configs/sku/innovium.77700_B" + netdev: + - auto_create: "no" + multi_interface: "yes" + buffer_management_mode: "api_driven" + max_lossless_tc: "2" + ilpm_enable: "1" + forward_profile: "IFCS_FORWARD_PROFILE_ID_PROFILE_E" + ecn_stats_enable: "1" + led_cfg_sck_rate: "0x4" + led_refresh_precliff_timer: "0xa" + led_refresh_cliff_timer: "0xc350" + txring: + - txring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "3" + desc_count: "1024" + prio: "1" + netdev: "true" + rxring: + - rxring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39" + - rxring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40" + - rxring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "2, 5, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35, 38, 41, 47" + - rxring_id: "3" + desc_count: "1024" + prio: "1" + queues: "42, 43, 44, 45, 46" + sys_clk: "1720" + ifc_clk: "1200" + mac_clk: "1340" + + devports: + - id: "0" + sysport: "1000" + type: "cpu" + - fec: "KRFEC" + id: "89" + lanes: "0:1" + serdes_group: "11" + speed: "25G" + sysport: "89" + type: "eth" + - fec: "KRFEC" + id: "90" + lanes: "1:1" + serdes_group: "11" + speed: "25G" + sysport: "90" + type: "eth" + - fec: "KRFEC" + id: "91" + lanes: "2:1" + serdes_group: "11" + speed: "25G" + sysport: "91" + type: "eth" + - fec: "KRFEC" + id: "92" + lanes: "3:1" + serdes_group: "11" + speed: "25G" + sysport: "92" + type: "eth" + - fec: "KRFEC" + id: "81" + lanes: "0:1" + serdes_group: "10" + speed: "25G" + sysport: "81" + type: "eth" + - fec: "KRFEC" + id: "82" + lanes: "1:1" + serdes_group: "10" + speed: "25G" + sysport: "82" + type: "eth" + - fec: "KRFEC" + id: "83" + lanes: "2:1" + serdes_group: "10" + speed: "25G" + sysport: "83" + type: "eth" + - fec: "KRFEC" + id: "84" + lanes: "3:1" + serdes_group: "10" + speed: "25G" + sysport: "84" + type: "eth" + - fec: "KRFEC" + id: "73" + lanes: "0:1" + serdes_group: "9" + speed: "25G" + sysport: "73" + type: "eth" + - fec: "KRFEC" + id: "74" + lanes: "1:1" + serdes_group: "9" + speed: "25G" + sysport: "74" + type: "eth" + - fec: "KRFEC" + id: "75" + lanes: "2:1" + serdes_group: "9" + speed: "25G" + sysport: "75" + type: "eth" + - fec: "KRFEC" + id: "76" + lanes: "3:1" + serdes_group: "9" + speed: "25G" + sysport: "76" + type: "eth" + - fec: "KRFEC" + id: "65" + lanes: "0:1" + serdes_group: "8" + speed: "25G" + sysport: "65" + type: "eth" + - fec: "KRFEC" + id: "66" + lanes: "1:1" + serdes_group: "8" + speed: "25G" + sysport: "66" + type: "eth" + - fec: "KRFEC" + id: "67" + lanes: "2:1" + serdes_group: "8" + speed: "25G" + sysport: "67" + type: "eth" + - fec: "KRFEC" + id: "68" + lanes: "3:1" + serdes_group: "8" + speed: "25G" + sysport: "68" + type: "eth" + - fec: "KRFEC" + id: "57" + lanes: "0:1" + serdes_group: "7" + speed: "25G" + sysport: "57" + type: "eth" + - fec: "KRFEC" + id: "58" + lanes: "1:1" + serdes_group: "7" + speed: "25G" + sysport: "58" + type: "eth" + - fec: "KRFEC" + id: "59" + lanes: "2:1" + serdes_group: "7" + speed: "25G" + sysport: "59" + type: "eth" + - fec: "KRFEC" + id: "60" + lanes: "3:1" + serdes_group: "7" + speed: "25G" + sysport: "60" + type: "eth" + - fec: "KRFEC" + id: "49" + lanes: "0:1" + serdes_group: "6" + speed: "25G" + sysport: "49" + type: "eth" + - fec: "KRFEC" + id: "50" + lanes: "1:1" + serdes_group: "6" + speed: "25G" + sysport: "50" + type: "eth" + - fec: "KRFEC" + id: "51" + lanes: "2:1" + serdes_group: "6" + speed: "25G" + sysport: "51" + type: "eth" + - fec: "KRFEC" + id: "52" + lanes: "3:1" + serdes_group: "6" + speed: "25G" + sysport: "52" + type: "eth" + - fec: "KRFEC" + id: "41" + lanes: "0:1" + serdes_group: "5" + speed: "25G" + sysport: "41" + type: "eth" + - fec: "KRFEC" + id: "42" + lanes: "1:1" + serdes_group: "5" + speed: "25G" + sysport: "42" + type: "eth" + - fec: "KRFEC" + id: "43" + lanes: "2:1" + serdes_group: "5" + speed: "25G" + sysport: "43" + type: "eth" + - fec: "KRFEC" + id: "44" + lanes: "3:1" + serdes_group: "5" + speed: "25G" + sysport: "44" + type: "eth" + - fec: "KRFEC" + id: "33" + lanes: "0:1" + serdes_group: "4" + speed: "25G" + sysport: "33" + type: "eth" + - fec: "KRFEC" + id: "34" + lanes: "1:1" + serdes_group: "4" + speed: "25G" + sysport: "34" + type: "eth" + - fec: "KRFEC" + id: "35" + lanes: "2:1" + serdes_group: "4" + speed: "25G" + sysport: "35" + type: "eth" + - fec: "KRFEC" + id: "36" + lanes: "3:1" + serdes_group: "4" + speed: "25G" + sysport: "36" + type: "eth" + - fec: "KRFEC" + id: "153" + lanes: "0:1" + serdes_group: "19" + speed: "25G" + sysport: "153" + type: "eth" + - fec: "KRFEC" + id: "154" + lanes: "1:1" + serdes_group: "19" + speed: "25G" + sysport: "154" + type: "eth" + - fec: "KRFEC" + id: "155" + lanes: "2:1" + serdes_group: "19" + speed: "25G" + sysport: "155" + type: "eth" + - fec: "KRFEC" + id: "156" + lanes: "3:1" + serdes_group: "19" + speed: "25G" + sysport: "156" + type: "eth" + - fec: "KRFEC" + id: "145" + lanes: "0:1" + serdes_group: "18" + speed: "25G" + sysport: "145" + type: "eth" + - fec: "KRFEC" + id: "146" + lanes: "1:1" + serdes_group: "18" + speed: "25G" + sysport: "146" + type: "eth" + - fec: "KRFEC" + id: "147" + lanes: "2:1" + serdes_group: "18" + speed: "25G" + sysport: "147" + type: "eth" + - fec: "KRFEC" + id: "148" + lanes: "3:1" + serdes_group: "18" + speed: "25G" + sysport: "148" + type: "eth" + - fec: "KRFEC" + id: "137" + lanes: "0:1" + serdes_group: "17" + speed: "25G" + sysport: "137" + type: "eth" + - fec: "KRFEC" + id: "138" + lanes: "1:1" + serdes_group: "17" + speed: "25G" + sysport: "138" + type: "eth" + - fec: "KRFEC" + id: "139" + lanes: "2:1" + serdes_group: "17" + speed: "25G" + sysport: "139" + type: "eth" + - fec: "KRFEC" + id: "140" + lanes: "3:1" + serdes_group: "17" + speed: "25G" + sysport: "140" + type: "eth" + - fec: "KRFEC" + id: "129" + lanes: "0:1" + serdes_group: "16" + speed: "25G" + sysport: "129" + type: "eth" + - fec: "KRFEC" + id: "130" + lanes: "1:1" + serdes_group: "16" + speed: "25G" + sysport: "130" + type: "eth" + - fec: "KRFEC" + id: "131" + lanes: "2:1" + serdes_group: "16" + speed: "25G" + sysport: "131" + type: "eth" + - fec: "KRFEC" + id: "132" + lanes: "3:1" + serdes_group: "16" + speed: "25G" + sysport: "132" + type: "eth" + - fec: "KRFEC" + id: "121" + lanes: "0:1" + serdes_group: "15" + speed: "25G" + sysport: "121" + type: "eth" + - fec: "KRFEC" + id: "122" + lanes: "1:1" + serdes_group: "15" + speed: "25G" + sysport: "122" + type: "eth" + - fec: "KRFEC" + id: "123" + lanes: "2:1" + serdes_group: "15" + speed: "25G" + sysport: "123" + type: "eth" + - fec: "KRFEC" + id: "124" + lanes: "3:1" + serdes_group: "15" + speed: "25G" + sysport: "124" + type: "eth" + - fec: "KRFEC" + id: "113" + lanes: "0:1" + serdes_group: "14" + speed: "25G" + sysport: "113" + type: "eth" + - fec: "KRFEC" + id: "114" + lanes: "1:1" + serdes_group: "14" + speed: "25G" + sysport: "114" + type: "eth" + - fec: "KRFEC" + id: "115" + lanes: "2:1" + serdes_group: "14" + speed: "25G" + sysport: "115" + type: "eth" + - fec: "KRFEC" + id: "116" + lanes: "3:1" + serdes_group: "14" + speed: "25G" + sysport: "116" + type: "eth" + - fec: "KRFEC" + id: "105" + lanes: "0:1" + serdes_group: "13" + speed: "25G" + sysport: "105" + type: "eth" + - fec: "KRFEC" + id: "106" + lanes: "1:1" + serdes_group: "13" + speed: "25G" + sysport: "106" + type: "eth" + - fec: "KRFEC" + id: "107" + lanes: "2:1" + serdes_group: "13" + speed: "25G" + sysport: "107" + type: "eth" + - fec: "KRFEC" + id: "108" + lanes: "3:1" + serdes_group: "13" + speed: "25G" + sysport: "108" + type: "eth" + - fec: "KRFEC" + id: "97" + lanes: "0:1" + serdes_group: "12" + speed: "25G" + sysport: "97" + type: "eth" + - fec: "KRFEC" + id: "98" + lanes: "1:1" + serdes_group: "12" + speed: "25G" + sysport: "98" + type: "eth" + - fec: "KRFEC" + id: "99" + lanes: "2:1" + serdes_group: "12" + speed: "25G" + sysport: "99" + type: "eth" + - fec: "KRFEC" + id: "100" + lanes: "3:1" + serdes_group: "12" + speed: "25G" + sysport: "100" + type: "eth" + - fec: "KRFEC" + id: "209" + lanes: "0:1" + serdes_group: "26" + speed: "25G" + sysport: "209" + type: "eth" + - fec: "KRFEC" + id: "210" + lanes: "1:1" + serdes_group: "26" + speed: "25G" + sysport: "210" + type: "eth" + - fec: "KRFEC" + id: "211" + lanes: "2:1" + serdes_group: "26" + speed: "25G" + sysport: "211" + type: "eth" + - fec: "KRFEC" + id: "212" + lanes: "3:1" + serdes_group: "26" + speed: "25G" + sysport: "212" + type: "eth" + - fec: "KRFEC" + id: "217" + lanes: "0:1" + serdes_group: "27" + speed: "25G" + sysport: "217" + type: "eth" + - fec: "KRFEC" + id: "218" + lanes: "1:1" + serdes_group: "27" + speed: "25G" + sysport: "218" + type: "eth" + - fec: "KRFEC" + id: "219" + lanes: "2:1" + serdes_group: "27" + speed: "25G" + sysport: "219" + type: "eth" + - fec: "KRFEC" + id: "220" + lanes: "3:1" + serdes_group: "27" + speed: "25G" + sysport: "220" + type: "eth" + - fec: "NONE" + id: "193" + lanes: "0:1" + serdes_group: "24" + speed: "10G" + sysport: "193" + type: "eth" + - fec: "NONE" + id: "194" + lanes: "1:1" + serdes_group: "24" + speed: "10G" + sysport: "194" + type: "eth" + - fec: "NONE" + id: "195" + lanes: "2:1" + serdes_group: "24" + speed: "10G" + sysport: "195" + type: "eth" + - fec: "NONE" + id: "196" + lanes: "3:1" + serdes_group: "24" + speed: "10G" + sysport: "196" + type: "eth" + - fec: "NONE" + id: "201" + lanes: "0:1" + serdes_group: "25" + speed: "10G" + sysport: "201" + type: "eth" + - fec: "NONE" + id: "202" + lanes: "1:1" + serdes_group: "25" + speed: "10G" + sysport: "202" + type: "eth" + - fec: "NONE" + id: "203" + lanes: "2:1" + serdes_group: "25" + speed: "10G" + sysport: "203" + type: "eth" + - fec: "NONE" + id: "204" + lanes: "3:1" + serdes_group: "25" + speed: "10G" + sysport: "204" + type: "eth" + - fec: "NONE" + id: "177" + lanes: "0:1" + serdes_group: "22" + speed: "10G" + sysport: "177" + type: "eth" + - fec: "NONE" + id: "178" + lanes: "1:1" + serdes_group: "22" + speed: "10G" + sysport: "178" + type: "eth" + - fec: "NONE" + id: "179" + lanes: "2:1" + serdes_group: "22" + speed: "10G" + sysport: "179" + type: "eth" + - fec: "NONE" + id: "180" + lanes: "3:1" + serdes_group: "22" + speed: "10G" + sysport: "180" + type: "eth" + - fec: "NONE" + id: "185" + lanes: "0:1" + serdes_group: "23" + speed: "10G" + sysport: "185" + type: "eth" + - fec: "NONE" + id: "186" + lanes: "1:1" + serdes_group: "23" + speed: "10G" + sysport: "186" + type: "eth" + - fec: "NONE" + id: "187" + lanes: "2:1" + serdes_group: "23" + speed: "10G" + sysport: "187" + type: "eth" + - fec: "NONE" + id: "188" + lanes: "3:1" + serdes_group: "23" + speed: "10G" + sysport: "188" + type: "eth" + - fec: "NONE" + id: "161" + lanes: "0:1" + serdes_group: "20" + speed: "10G" + sysport: "161" + type: "eth" + - fec: "NONE" + id: "162" + lanes: "1:1" + serdes_group: "20" + speed: "10G" + sysport: "162" + type: "eth" + - fec: "NONE" + id: "163" + lanes: "2:1" + serdes_group: "20" + speed: "10G" + sysport: "163" + type: "eth" + - fec: "NONE" + id: "164" + lanes: "3:1" + serdes_group: "20" + speed: "10G" + sysport: "164" + type: "eth" + - fec: "NONE" + id: "169" + lanes: "0:1" + serdes_group: "21" + speed: "10G" + sysport: "169" + type: "eth" + - fec: "NONE" + id: "170" + lanes: "1:1" + serdes_group: "21" + speed: "10G" + sysport: "170" + type: "eth" + - fec: "NONE" + id: "171" + lanes: "2:1" + serdes_group: "21" + speed: "10G" + sysport: "171" + type: "eth" + - fec: "NONE" + id: "172" + lanes: "3:1" + serdes_group: "21" + speed: "10G" + sysport: "172" + type: "eth" + - fec: "NONE" + id: "17" + lanes: "0:1" + serdes_group: "2" + speed: "10G" + sysport: "17" + type: "eth" + - fec: "NONE" + id: "18" + lanes: "1:1" + serdes_group: "2" + speed: "10G" + sysport: "18" + type: "eth" + - fec: "NONE" + id: "19" + lanes: "2:1" + serdes_group: "2" + speed: "10G" + sysport: "19" + type: "eth" + - fec: "NONE" + id: "20" + lanes: "3:1" + serdes_group: "2" + speed: "10G" + sysport: "20" + type: "eth" + - fec: "NONE" + id: "25" + lanes: "0:1" + serdes_group: "3" + speed: "10G" + sysport: "25" + type: "eth" + - fec: "NONE" + id: "26" + lanes: "1:1" + serdes_group: "3" + speed: "10G" + sysport: "26" + type: "eth" + - fec: "NONE" + id: "27" + lanes: "2:1" + serdes_group: "3" + speed: "10G" + sysport: "27" + type: "eth" + - fec: "NONE" + id: "28" + lanes: "3:1" + serdes_group: "3" + speed: "10G" + sysport: "28" + type: "eth" + - fec: "KRFEC" + id: "1" + lanes: "0:4" + serdes_group: "0" + speed: "100G" + sysport: "1" + type: "eth" + - fec: "KRFEC" + id: "9" + lanes: "0:4" + serdes_group: "1" + speed: "100G" + sysport: "9" + type: "eth" + - fec: "NONE" + id: "241" + lanes: "0:4" + serdes_group: "30" + speed: "100G" + sysport: "241" + type: "eth" + - fec: "NONE" + id: "249" + lanes: "0:4" + serdes_group: "31" + speed: "100G" + sysport: "249" + type: "eth" + - fec: "NONE" + id: "225" + lanes: "0:4" + serdes_group: "28" + speed: "100G" + sysport: "225" + type: "eth" + - fec: "NONE" + id: "233" + lanes: "0:4" + serdes_group: "29" + speed: "100G" + sysport: "233" + type: "eth" + isg: + - id: "0" + tx_polarity: "00000000" + rx_polarity: "10000010" + lane_swap: "57234601" + - id: "1" + tx_polarity: "01000101" + rx_polarity: "01110011" + lane_swap: "51364072" + - id: "2" + tx_polarity: "00000000" + rx_polarity: "00000010" + lane_swap: "57043621" + - id: "3" + tx_polarity: "00000110" + rx_polarity: "00100111" + lane_swap: "56024371" + - id: "4" + tx_polarity: "00110101" + rx_polarity: "00010000" + lane_swap: "65137402" + - id: "5" + tx_polarity: "00000000" + rx_polarity: "00100000" + lane_swap: "61704253" + - id: "6" + tx_polarity: "10010010" + rx_polarity: "00000100" + lane_swap: "64027315" + - id: "7" + tx_polarity: "00000000" + rx_polarity: "10111011" + lane_swap: "60714253" + - id: "8" + tx_polarity: "10100110" + rx_polarity: "00010101" + lane_swap: "67042315" + - id: "9" + tx_polarity: "00000000" + rx_polarity: "11010000" + lane_swap: "20716453" + - id: "10" + tx_polarity: "00010000" + rx_polarity: "00000000" + lane_swap: "57026314" + - id: "11" + tx_polarity: "00000000" + rx_polarity: "00010000" + lane_swap: "37014625" + - id: "12" + tx_polarity: "00100001" + rx_polarity: "00110111" + lane_swap: "50473216" + - id: "13" + tx_polarity: "00001000" + rx_polarity: "11010001" + lane_swap: "16345702" + - id: "14" + tx_polarity: "11010110" + rx_polarity: "01100100" + lane_swap: "64107352" + - id: "15" + tx_polarity: "00100000" + rx_polarity: "01001011" + lane_swap: "46325710" + - id: "16" + tx_polarity: "10011001" + rx_polarity: "00110001" + lane_swap: "54216730" + - id: "17" + tx_polarity: "00001001" + rx_polarity: "11000000" + lane_swap: "25176304" + - id: "18" + tx_polarity: "00001000" + rx_polarity: "01101010" + lane_swap: "73405612" + - id: "19" + tx_polarity: "00110100" + rx_polarity: "10001010" + lane_swap: "25176304" + - id: "20" + tx_polarity: "00000000" + rx_polarity: "00100000" + lane_swap: "45617230" + - id: "21" + tx_polarity: "11100001" + rx_polarity: "00010011" + lane_swap: "46720531" + - id: "22" + tx_polarity: "00000000" + rx_polarity: "11110111" + lane_swap: "47236501" + - id: "23" + tx_polarity: "10100001" + rx_polarity: "00000000" + lane_swap: "76245301" + - id: "24" + tx_polarity: "01000000" + rx_polarity: "00111100" + lane_swap: "47316520" + - id: "25" + tx_polarity: "10111110" + rx_polarity: "00000001" + lane_swap: "61072543" + - id: "26" + tx_polarity: "00100000" + rx_polarity: "01111000" + lane_swap: "51627430" + - id: "27" + tx_polarity: "10101001" + rx_polarity: "00000000" + lane_swap: "24017536" + - id: "28" + tx_polarity: "00000000" + rx_polarity: "10000010" + lane_swap: "26073514" + - id: "29" + tx_polarity: "01001000" + rx_polarity: "00000000" + lane_swap: "43027615" + - id: "30" + tx_polarity: "00000000" + rx_polarity: "11010010" + lane_swap: "47235601" + - id: "31" + tx_polarity: "11111100" + rx_polarity: "00000010" + lane_swap: "46025713" + - id: "32" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_104x1025_6x100/innovium.77700_A b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_104x1025_6x100/innovium.77700_A new file mode 100644 index 0000000000..84aa419836 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_104x1025_6x100/innovium.77700_A @@ -0,0 +1,59 @@ +sku: innovium.77700_A + +device_id: 0x1b58 + +# Hardware constraint information +hardware: + num_ibs: 6 + + ports_per_ib: 32, 32, 32, 32, 20, 20 + recirc_port_num: 32, 32, 32, 32, 32, 32 + cpu_port_num: 33 + cpu_port_ib: 0 + mgmt_port_num: 33 + mgmt_port_ibs: 1,2 + + pics_per_ib: 6, 7, 6, 5, 5, 5 + pic_ports_per_pic: 8 + max_serdes_speed: 50 + + num_shared_pics: 2 + + isg [0-4]: + ib: 0 + pic_id: [0-4] + + isg [5-9]: + ib: 5 + pic_id: [0-4] + + isg [10-14]: + ib: 1 + pic_id: [0-4] + + isg [16-20]: + ib: 3 + pic_id: [0-4] + + isg [21-25]: + ib: 4 + pic_id: [0-4] + + isg [26-30]: + ib: 2 + pic_id: [0-4] + + isg 15: + mode: 8:0 + ib: 1 + pic_id: 5 + + isg 31: + mode: 8:0 + ib: 0 + pic_id: 5 + + isg 32: + mode: 1:1 + ib: 1, 2 + pic_id: 6 diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_104x1025_6x100/innovium.77700_B b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_104x1025_6x100/innovium.77700_B new file mode 100644 index 0000000000..27297b3139 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_104x1025_6x100/innovium.77700_B @@ -0,0 +1,59 @@ +sku: innovium.77700_B + +device_id: 0x1b58 + +# Hardware constraint information +hardware: + num_ibs: 6 + + ports_per_ib: 32, 32, 32, 32, 20, 20 + recirc_port_num: 32, 32, 32, 32, 32, 32 + cpu_port_num: 33 + cpu_port_ib: 0 + mgmt_port_num: 33 + mgmt_port_ibs: 1,2 + + pics_per_ib: 6, 7, 7, 6, 5, 5 + pic_ports_per_pic: 8 + max_serdes_speed: 50 + + num_shared_pics: 2 + + isg [0-4]: + ib: 0 + pic_id: [0-4] + + isg [5-9]: + ib: 5 + pic_id: [0-4] + + isg [10-14]: + ib: 1 + pic_id: [0-4] + + isg [16-20]: + ib: 3 + pic_id: [0-4] + + isg [21-25]: + ib: 4 + pic_id: [0-4] + + isg [26-30]: + ib: 2 + pic_id: [0-4] + + isg 15: + mode: 4:4 + ib: 1, 3 + pic_id: 5 + + isg 31: + mode: 4:4 + ib: 0, 2 + pic_id: 5 + + isg 32: + mode: 1:1 + ib: 1, 2 + pic_id: 6 diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_104x1025_6x100/ivm.sai.config.yaml b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_104x1025_6x100/ivm.sai.config.yaml new file mode 100755 index 0000000000..441aec9fba --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_104x1025_6x100/ivm.sai.config.yaml @@ -0,0 +1,9 @@ +IFCS_INIT_FILE : "/usr/share/sonic/hwsku/config_104x1025G_6x100G_wistron_sw_to3200k.yaml" +IFCS_SKU_FILE : "/usr/share/sonic/hwsku/innovium.77700_B" +IFCS_INNO_CLI_PORT : "9999" +IFCS_TARGET : "device" +INNOVIUM_DIR : "/innovium" +PYTHONPATH : "$INNOVIUM_DIR:$INNOVIUM_DIR/cmds:$INNOVIUM_DIR/scripts:$INNOVIUM_DIR/test/:$INNOVIUM_DIR/test/utils:$INNOVIUM_DIR/utils:$INNOVIUM_DIR/pyctypes" +PLATFORM_LIBRARY: "/usr/share/sonic/platform/libplatform.so" +IVM_SAI_DATAPATH_CONFIG_FILE: "/usr/share/sonic/hwsku/ivm.sai.datapath.config.yaml" +IVM_SAI_PARAM_A0008: "32" diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_104x1025_6x100/ivm.sai.datapath.config.yaml b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_104x1025_6x100/ivm.sai.datapath.config.yaml new file mode 100644 index 0000000000..891b0b3e28 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_104x1025_6x100/ivm.sai.datapath.config.yaml @@ -0,0 +1,9 @@ +ISAI_PARAM_P0_0_LS : "4608 4608 4608 4608 2880 2880" +ISAI_PARAM_P0_1_LS : "2226 1946 1946 1890 1218 1218" +ISAI_PARAM_P0_1_ALS : "434 154 154 98 98 98" +ISAI_PARAM_P1_0_LS : "1536 1536 1536 1536 960 960" +ISAI_PARAM_P1_0_LL : "3072 3072 3072 3072 1920 1920" +ISAI_PARAM_P1_1_LS : "1778 1498 1498 1442 938 938" +ISAI_PARAM_P1_1_LL : "2478 2478 2478 2478 2478 2478" +ISAI_PARAM_P1_1_ALS : "434 154 154 98 98 98" +ISAI_PARAM_P1_1_ALL : "126 126 126 126 126 126" diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_104x1025_6x100/pg_profile_lookup.ini b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_104x1025_6x100/pg_profile_lookup.ini new file mode 100644 index 0000000000..adcb52ab2a --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_104x1025_6x100/pg_profile_lookup.ini @@ -0,0 +1,18 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 25000 5m 1518 0 15680 1 13440 + 50000 5m 1518 0 21248 1 13440 + 100000 5m 1518 0 34624 1 13440 + 400000 5m 1518 0 117536 1 13440 + 25000 40m 1518 0 16928 1 13440 + 50000 40m 1518 0 23392 1 13440 + 100000 40m 1518 0 38816 1 13440 + 400000 40m 1518 0 135520 1 13440 + 25000 100m 1518 0 18848 1 13440 + 50000 100m 1518 0 27264 1 13440 + 100000 100m 1518 0 46496 1 13440 + 400000 100m 1518 0 166688 1 13440 + 25000 300m 1518 0 25184 1 13440 + 50000 300m 1518 0 40128 1 13440 + 100000 300m 1518 0 72384 1 13440 + 400000 300m 1518 0 268640 1 13440 diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_104x1025_6x100/port_config.ini b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_104x1025_6x100/port_config.ini new file mode 100644 index 0000000000..43e568f6ef --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_104x1025_6x100/port_config.ini @@ -0,0 +1,111 @@ +# name lanes alias speed index mtu fec +Ethernet0 89 Eth1-1 25000 0 9126 rs +Ethernet1 90 Eth1-2 25000 0 9126 rs +Ethernet2 91 Eth1-3 25000 0 9126 rs +Ethernet3 92 Eth1-4 25000 0 9126 rs +Ethernet8 81 Eth2-1 25000 1 9126 rs +Ethernet9 82 Eth2-2 25000 1 9126 rs +Ethernet10 83 Eth2-3 25000 1 9126 rs +Ethernet11 84 Eth2-4 25000 1 9126 rs +Ethernet16 73 Eth3-1 25000 2 9126 rs +Ethernet17 74 Eth3-2 25000 2 9126 rs +Ethernet18 75 Eth3-3 25000 2 9126 rs +Ethernet19 76 Eth3-4 25000 2 9126 rs +Ethernet24 65 Eth4-1 25000 3 9126 rs +Ethernet25 66 Eth4-2 25000 3 9126 rs +Ethernet26 67 Eth4-3 25000 3 9126 rs +Ethernet27 68 Eth4-4 25000 3 9126 rs +Ethernet32 57 Eth5-1 25000 4 9126 rs +Ethernet33 58 Eth5-2 25000 4 9126 rs +Ethernet34 59 Eth5-3 25000 4 9126 rs +Ethernet35 60 Eth5-4 25000 4 9126 rs +Ethernet40 49 Eth6-1 25000 5 9126 rs +Ethernet41 50 Eth6-2 25000 5 9126 rs +Ethernet42 51 Eth6-3 25000 5 9126 rs +Ethernet43 52 Eth6-4 25000 5 9126 rs +Ethernet48 41 Eth7-1 25000 6 9126 rs +Ethernet49 42 Eth7-2 25000 6 9126 rs +Ethernet50 43 Eth7-3 25000 6 9126 rs +Ethernet51 44 Eth7-4 25000 6 9126 rs +Ethernet56 33 Eth8-1 25000 7 9126 rs +Ethernet57 34 Eth8-2 25000 7 9126 rs +Ethernet58 35 Eth8-3 25000 7 9126 rs +Ethernet59 36 Eth8-4 25000 7 9126 rs +Ethernet64 153 Eth9-1 25000 8 9126 rs +Ethernet65 154 Eth9-2 25000 8 9126 rs +Ethernet66 155 Eth9-3 25000 8 9126 rs +Ethernet67 156 Eth9-4 25000 8 9126 rs +Ethernet72 145 Eth10-1 25000 9 9126 rs +Ethernet73 146 Eth10-2 25000 9 9126 rs +Ethernet74 147 Eth10-3 25000 9 9126 rs +Ethernet75 148 Eth10-4 25000 9 9126 rs +Ethernet80 137 Eth11-1 25000 10 9126 rs +Ethernet81 138 Eth11-2 25000 10 9126 rs +Ethernet82 139 Eth11-3 25000 10 9126 rs +Ethernet83 140 Eth11-4 25000 10 9126 rs +Ethernet88 129 Eth12-1 25000 11 9126 rs +Ethernet89 130 Eth12-2 25000 11 9126 rs +Ethernet90 131 Eth12-3 25000 11 9126 rs +Ethernet91 132 Eth12-4 25000 11 9126 rs +Ethernet96 121 Eth13-1 25000 12 9126 rs +Ethernet97 122 Eth13-2 25000 12 9126 rs +Ethernet98 123 Eth13-3 25000 12 9126 rs +Ethernet99 124 Eth13-4 25000 12 9126 rs +Ethernet104 113 Eth14-1 25000 13 9126 rs +Ethernet105 114 Eth14-2 25000 13 9126 rs +Ethernet106 115 Eth14-3 25000 13 9126 rs +Ethernet107 116 Eth14-4 25000 13 9126 rs +Ethernet112 105 Eth15-1 25000 14 9126 rs +Ethernet113 106 Eth15-2 25000 14 9126 rs +Ethernet114 107 Eth15-3 25000 14 9126 rs +Ethernet115 108 Eth15-4 25000 14 9126 rs +Ethernet120 97 Eth16-1 25000 15 9126 rs +Ethernet121 98 Eth16-2 25000 15 9126 rs +Ethernet122 99 Eth16-3 25000 15 9126 rs +Ethernet123 100 Eth16-4 25000 15 9126 rs +Ethernet128 209 Eth17-1 25000 16 9126 rs +Ethernet129 210 Eth17-2 25000 16 9126 rs +Ethernet130 211 Eth17-3 25000 16 9126 rs +Ethernet131 212 Eth17-4 25000 16 9126 rs +Ethernet136 217 Eth18-1 25000 17 9126 rs +Ethernet137 218 Eth18-2 25000 17 9126 rs +Ethernet138 219 Eth18-3 25000 17 9126 rs +Ethernet139 220 Eth18-4 25000 17 9126 rs +Ethernet144 193 Eth19-1 10000 18 9126 none +Ethernet145 194 Eth19-2 10000 18 9126 none +Ethernet146 195 Eth19-3 10000 18 9126 none +Ethernet147 196 Eth19-4 10000 18 9126 none +Ethernet152 201 Eth20-1 10000 19 9126 none +Ethernet153 202 Eth20-2 10000 19 9126 none +Ethernet154 203 Eth20-3 10000 19 9126 none +Ethernet155 204 Eth20-4 10000 19 9126 none +Ethernet160 177 Eth21-1 10000 20 9126 none +Ethernet161 178 Eth21-2 10000 20 9126 none +Ethernet162 179 Eth21-3 10000 20 9126 none +Ethernet163 180 Eth21-4 10000 20 9126 none +Ethernet168 185 Eth22-1 10000 21 9126 none +Ethernet169 186 Eth22-2 10000 21 9126 none +Ethernet170 187 Eth22-3 10000 21 9126 none +Ethernet171 188 Eth22-4 10000 21 9126 none +Ethernet176 161 Eth23-1 10000 22 9126 none +Ethernet177 162 Eth23-2 10000 22 9126 none +Ethernet178 163 Eth23-3 10000 22 9126 none +Ethernet179 164 Eth23-4 10000 22 9126 none +Ethernet184 169 Eth24-1 10000 23 9126 none +Ethernet185 170 Eth24-2 10000 23 9126 none +Ethernet186 171 Eth24-3 10000 23 9126 none +Ethernet187 172 Eth24-4 10000 23 9126 none +Ethernet192 17 Eth25-1 10000 24 9126 none +Ethernet193 18 Eth25-2 10000 24 9126 none +Ethernet194 19 Eth25-3 10000 24 9126 none +Ethernet195 20 Eth25-4 10000 24 9126 none +Ethernet200 25 Eth26-1 10000 25 9126 none +Ethernet201 26 Eth26-2 10000 25 9126 none +Ethernet202 27 Eth26-3 10000 25 9126 none +Ethernet203 28 Eth26-4 10000 25 9126 none +Ethernet208 1,2,3,4 Eth27 100000 26 9126 rs +Ethernet216 9,10,11,12 Eth28 100000 27 9126 rs +Ethernet224 241,242,243,244 Eth29 100000 28 9126 none +Ethernet232 249,250,251,252 Eth30 100000 29 9126 none +Ethernet240 225,226,227,228 Eth31 100000 30 9126 none +Ethernet248 233,234,235,236 Eth32 100000 31 9126 none diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_104x1025_6x100/qos.json.j2 b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_104x1025_6x100/qos.json.j2 new file mode 100755 index 0000000000..104d2d78de --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_104x1025_6x100/qos.json.j2 @@ -0,0 +1,118 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "0":"0", + "1":"1", + "2":"2", + "3":"3", + "4":"4", + "5":"5", + "6":"6", + "7":"7" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"0", + "4":"0", + "5":"0", + "6":"0", + "7":"0", + "8":"0", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]" + } + }, + "SCHEDULER": { + "scheduler.7": { + "type": "STRICT" + } + }, + "QUEUE": { + "{{ port_names }}|7": { + "scheduler": "[SCHEDULER|scheduler.7]" + } + } +} diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_104x1025_6x100/qos_defaults_def_lossy.j2 b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_104x1025_6x100/qos_defaults_def_lossy.j2 new file mode 100755 index 0000000000..104d2d78de --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_104x1025_6x100/qos_defaults_def_lossy.j2 @@ -0,0 +1,118 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "0":"0", + "1":"1", + "2":"2", + "3":"3", + "4":"4", + "5":"5", + "6":"6", + "7":"7" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"0", + "4":"0", + "5":"0", + "6":"0", + "7":"0", + "8":"0", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]" + } + }, + "SCHEDULER": { + "scheduler.7": { + "type": "STRICT" + } + }, + "QUEUE": { + "{{ port_names }}|7": { + "scheduler": "[SCHEDULER|scheduler.7]" + } + } +} diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_104x1025_6x100/qos_defaults_t1.j2 b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_104x1025_6x100/qos_defaults_t1.j2 new file mode 100755 index 0000000000..4b9748c7b5 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_104x1025_6x100/qos_defaults_t1.j2 @@ -0,0 +1,114 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "0":"0", + "1":"1", + "2":"2", + "3":"3", + "4":"4", + "5":"5", + "6":"6", + "7":"7" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "red_min_threshold":"50000" + } + } +} diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_104x1025_6x100/sai.profile b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_104x1025_6x100/sai.profile new file mode 100644 index 0000000000..aba4fc81fb --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_104x1025_6x100/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/ivm.sai.config.yaml diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_24x400_8x100/buffers.json.j2 b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_24x400_8x100/buffers.json.j2 new file mode 100644 index 0000000000..1a31812c26 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_24x400_8x100/buffers.json.j2 @@ -0,0 +1,38 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "BUFFER_POOL": { + "lossy_pool": { + "size": "56985600", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"0", + "static_th":"9497600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"1518", + "dynamic_th":"2" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-7": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|0-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_24x400_8x100/buffers_defaults_def_lossy.j2 b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_24x400_8x100/buffers_defaults_def_lossy.j2 new file mode 100644 index 0000000000..1a31812c26 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_24x400_8x100/buffers_defaults_def_lossy.j2 @@ -0,0 +1,38 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "BUFFER_POOL": { + "lossy_pool": { + "size": "56985600", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"0", + "static_th":"9497600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"1518", + "dynamic_th":"2" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-7": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|0-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_24x400_8x100/buffers_defaults_t1.j2 b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_24x400_8x100/buffers_defaults_t1.j2 new file mode 100644 index 0000000000..93dac6b199 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_24x400_8x100/buffers_defaults_t1.j2 @@ -0,0 +1,137 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '40m' %} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) %} + {%- set cable_len = [] %} + {%- for local_port in DEVICE_NEIGHBOR %} + {%- if local_port == port_name %} + {%- if DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor_role = neighbor.type %} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role %} + {%- set roles1 = roles1 | lower %} + {%- set roles2 = roles2 | lower %} + {%- if roles1 in ports2cable %} + {%- if cable_len.append(ports2cable[roles1]) %}{% endif %} + {%- elif roles2 in ports2cable %} + {%- if cable_len.append(ports2cable[roles2]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else %} + {%- if switch_role.lower() == 'torrouter' %} + {%- for local_port in VLAN_MEMBER %} + {%- if local_port[1] == port_name %} + {%- set roles3 = switch_role + '_' + 'server' %} + {%- set roles3 = roles3 | lower %} + {%- if roles3 in ports2cable %} + {%- if cable_len.append(ports2cable[roles3]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- endif %} +{%- endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "47218432", + "type": "ingress", + "mode": "dynamic", + "xoff": "17708800" + }, + "lossy_pool": { + "size": "18874368", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xoff":"38816", + "size":"1518", + "dynamic_th":"1", + "xon_offset":"13440" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"9497600" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"0", + "static_th":"9497600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"1518", + "dynamic_th":"2" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_24x400_8x100/config_24x400G_8x100G_wistron_sw_to3200k.yaml b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_24x400_8x100/config_24x400G_8x100G_wistron_sw_to3200k.yaml new file mode 100644 index 0000000000..b81b3c6912 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_24x400_8x100/config_24x400G_8x100G_wistron_sw_to3200k.yaml @@ -0,0 +1,420 @@ +ifcs: + options: + log_level: "info" +nodes: +- node_id: "0" + options: + sku: "configs/sku/innovium.77700_A" + netdev: + - auto_create: "no" + multi_interface: "yes" + buffer_management_mode: "api_driven" + max_lossless_tc: "2" + ilpm_enable: "1" + forward_profile: "IFCS_FORWARD_PROFILE_ID_PROFILE_E" + ecn_stats_enable: "1" + led_cfg_sck_rate: "0x4" + led_refresh_precliff_timer: "0xa" + led_refresh_cliff_timer: "0xc350" + txring: + - txring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "3" + desc_count: "1024" + prio: "1" + netdev: "true" + rxring: + - rxring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39" + - rxring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40" + - rxring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "2, 5, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35, 38, 41, 47" + - rxring_id: "3" + desc_count: "1024" + prio: "1" + queues: "42, 43, 44, 45, 46" + sys_clk: "1720" + ifc_clk: "1200" + mac_clk: "1340" + + devports: + - id: "0" + sysport: "1000" + type: "cpu" + - fec: "KPFEC" + id: "89" + lanes: "0:8" + serdes_group: "11" + speed: "400G" + sysport: "89" + type: "eth" + - fec: "KPFEC" + id: "81" + lanes: "0:8" + serdes_group: "10" + speed: "400G" + sysport: "81" + type: "eth" + - fec: "KPFEC" + id: "73" + lanes: "0:8" + serdes_group: "9" + speed: "400G" + sysport: "73" + type: "eth" + - fec: "KPFEC" + id: "65" + lanes: "0:8" + serdes_group: "8" + speed: "400G" + sysport: "65" + type: "eth" + - fec: "KPFEC" + id: "57" + lanes: "0:8" + serdes_group: "7" + speed: "400G" + sysport: "57" + type: "eth" + - fec: "KPFEC" + id: "49" + lanes: "0:8" + serdes_group: "6" + speed: "400G" + sysport: "49" + type: "eth" + - fec: "KPFEC" + id: "41" + lanes: "0:8" + serdes_group: "5" + speed: "400G" + sysport: "41" + type: "eth" + - fec: "KPFEC" + id: "33" + lanes: "0:8" + serdes_group: "4" + speed: "400G" + sysport: "33" + type: "eth" + - fec: "KPFEC" + id: "153" + lanes: "0:8" + serdes_group: "19" + speed: "400G" + sysport: "153" + type: "eth" + - fec: "KPFEC" + id: "145" + lanes: "0:8" + serdes_group: "18" + speed: "400G" + sysport: "145" + type: "eth" + - fec: "KPFEC" + id: "137" + lanes: "0:8" + serdes_group: "17" + speed: "400G" + sysport: "137" + type: "eth" + - fec: "KPFEC" + id: "129" + lanes: "0:8" + serdes_group: "16" + speed: "400G" + sysport: "129" + type: "eth" + - fec: "KPFEC" + id: "121" + lanes: "0:8" + serdes_group: "15" + speed: "400G" + sysport: "121" + type: "eth" + - fec: "KPFEC" + id: "113" + lanes: "0:8" + serdes_group: "14" + speed: "400G" + sysport: "113" + type: "eth" + - fec: "KPFEC" + id: "105" + lanes: "0:8" + serdes_group: "13" + speed: "400G" + sysport: "105" + type: "eth" + - fec: "KPFEC" + id: "97" + lanes: "0:8" + serdes_group: "12" + speed: "400G" + sysport: "97" + type: "eth" + - fec: "KPFEC" + id: "209" + lanes: "0:8" + serdes_group: "26" + speed: "400G" + sysport: "209" + type: "eth" + - fec: "KPFEC" + id: "217" + lanes: "0:8" + serdes_group: "27" + speed: "400G" + sysport: "217" + type: "eth" + - fec: "KPFEC" + id: "193" + lanes: "0:8" + serdes_group: "24" + speed: "400G" + sysport: "193" + type: "eth" + - fec: "KPFEC" + id: "201" + lanes: "0:8" + serdes_group: "25" + speed: "400G" + sysport: "201" + type: "eth" + - fec: "KPFEC" + id: "177" + lanes: "0:8" + serdes_group: "22" + speed: "400G" + sysport: "177" + type: "eth" + - fec: "KPFEC" + id: "185" + lanes: "0:8" + serdes_group: "23" + speed: "400G" + sysport: "185" + type: "eth" + - fec: "KPFEC" + id: "161" + lanes: "0:8" + serdes_group: "20" + speed: "400G" + sysport: "161" + type: "eth" + - fec: "KPFEC" + id: "169" + lanes: "0:8" + serdes_group: "21" + speed: "400G" + sysport: "169" + type: "eth" + - fec: "NONE" + id: "17" + lanes: "0:4" + serdes_group: "2" + speed: "100G" + sysport: "17" + type: "eth" + - fec: "NONE" + id: "25" + lanes: "0:4" + serdes_group: "3" + speed: "100G" + sysport: "25" + type: "eth" + - fec: "NONE" + id: "1" + lanes: "0:4" + serdes_group: "0" + speed: "100G" + sysport: "1" + type: "eth" + - fec: "NONE" + id: "9" + lanes: "0:4" + serdes_group: "1" + speed: "100G" + sysport: "9" + type: "eth" + - fec: "NONE" + id: "241" + lanes: "0:4" + serdes_group: "30" + speed: "100G" + sysport: "241" + type: "eth" + - fec: "NONE" + id: "249" + lanes: "0:4" + serdes_group: "31" + speed: "100G" + sysport: "249" + type: "eth" + - fec: "NONE" + id: "225" + lanes: "0:4" + serdes_group: "28" + speed: "100G" + sysport: "225" + type: "eth" + - fec: "NONE" + id: "233" + lanes: "0:4" + serdes_group: "29" + speed: "100G" + sysport: "233" + type: "eth" + isg: + - id: "0" + tx_polarity: "00000000" + rx_polarity: "10000010" + lane_swap: "57234601" + - id: "1" + tx_polarity: "01000101" + rx_polarity: "01110011" + lane_swap: "51364072" + - id: "2" + tx_polarity: "00000000" + rx_polarity: "00000010" + lane_swap: "57043621" + - id: "3" + tx_polarity: "00000110" + rx_polarity: "00100111" + lane_swap: "56024371" + - id: "4" + tx_polarity: "00110101" + rx_polarity: "00010000" + lane_swap: "65137402" + - id: "5" + tx_polarity: "00000000" + rx_polarity: "00100000" + lane_swap: "61704253" + - id: "6" + tx_polarity: "10010010" + rx_polarity: "00000100" + lane_swap: "64027315" + - id: "7" + tx_polarity: "00000000" + rx_polarity: "10111011" + lane_swap: "60714253" + - id: "8" + tx_polarity: "10100110" + rx_polarity: "00010101" + lane_swap: "67042315" + - id: "9" + tx_polarity: "00000000" + rx_polarity: "11010000" + lane_swap: "20716453" + - id: "10" + tx_polarity: "00010000" + rx_polarity: "00000000" + lane_swap: "57026314" + - id: "11" + tx_polarity: "00000000" + rx_polarity: "00010000" + lane_swap: "37014625" + - id: "12" + tx_polarity: "00100001" + rx_polarity: "00110111" + lane_swap: "50473216" + - id: "13" + tx_polarity: "00001000" + rx_polarity: "11010001" + lane_swap: "16345702" + - id: "14" + tx_polarity: "11010110" + rx_polarity: "01100100" + lane_swap: "64107352" + - id: "15" + tx_polarity: "00100000" + rx_polarity: "01001011" + lane_swap: "46325710" + - id: "16" + tx_polarity: "10011001" + rx_polarity: "00110001" + lane_swap: "54216730" + - id: "17" + tx_polarity: "00001001" + rx_polarity: "11000000" + lane_swap: "25176304" + - id: "18" + tx_polarity: "00001000" + rx_polarity: "01101010" + lane_swap: "73405612" + - id: "19" + tx_polarity: "00110100" + rx_polarity: "10001010" + lane_swap: "25176304" + - id: "20" + tx_polarity: "00000000" + rx_polarity: "00100000" + lane_swap: "45617230" + - id: "21" + tx_polarity: "11100001" + rx_polarity: "00010011" + lane_swap: "46720531" + - id: "22" + tx_polarity: "00000000" + rx_polarity: "11110111" + lane_swap: "47236501" + - id: "23" + tx_polarity: "10100001" + rx_polarity: "00000000" + lane_swap: "76245301" + - id: "24" + tx_polarity: "01000000" + rx_polarity: "00111100" + lane_swap: "47316520" + - id: "25" + tx_polarity: "10111110" + rx_polarity: "00000001" + lane_swap: "61072543" + - id: "26" + tx_polarity: "00100000" + rx_polarity: "01111000" + lane_swap: "51627430" + - id: "27" + tx_polarity: "10101001" + rx_polarity: "00000000" + lane_swap: "24017536" + - id: "28" + tx_polarity: "00000000" + rx_polarity: "10000010" + lane_swap: "26073514" + - id: "29" + tx_polarity: "01001000" + rx_polarity: "00000000" + lane_swap: "43027615" + - id: "30" + tx_polarity: "00000000" + rx_polarity: "11010010" + lane_swap: "47235601" + - id: "31" + tx_polarity: "11111100" + rx_polarity: "00000010" + lane_swap: "46025713" + - id: "32" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_24x400_8x100/innovium.77700_A b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_24x400_8x100/innovium.77700_A new file mode 100644 index 0000000000..84aa419836 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_24x400_8x100/innovium.77700_A @@ -0,0 +1,59 @@ +sku: innovium.77700_A + +device_id: 0x1b58 + +# Hardware constraint information +hardware: + num_ibs: 6 + + ports_per_ib: 32, 32, 32, 32, 20, 20 + recirc_port_num: 32, 32, 32, 32, 32, 32 + cpu_port_num: 33 + cpu_port_ib: 0 + mgmt_port_num: 33 + mgmt_port_ibs: 1,2 + + pics_per_ib: 6, 7, 6, 5, 5, 5 + pic_ports_per_pic: 8 + max_serdes_speed: 50 + + num_shared_pics: 2 + + isg [0-4]: + ib: 0 + pic_id: [0-4] + + isg [5-9]: + ib: 5 + pic_id: [0-4] + + isg [10-14]: + ib: 1 + pic_id: [0-4] + + isg [16-20]: + ib: 3 + pic_id: [0-4] + + isg [21-25]: + ib: 4 + pic_id: [0-4] + + isg [26-30]: + ib: 2 + pic_id: [0-4] + + isg 15: + mode: 8:0 + ib: 1 + pic_id: 5 + + isg 31: + mode: 8:0 + ib: 0 + pic_id: 5 + + isg 32: + mode: 1:1 + ib: 1, 2 + pic_id: 6 diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_24x400_8x100/innovium.77700_B b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_24x400_8x100/innovium.77700_B new file mode 100644 index 0000000000..27297b3139 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_24x400_8x100/innovium.77700_B @@ -0,0 +1,59 @@ +sku: innovium.77700_B + +device_id: 0x1b58 + +# Hardware constraint information +hardware: + num_ibs: 6 + + ports_per_ib: 32, 32, 32, 32, 20, 20 + recirc_port_num: 32, 32, 32, 32, 32, 32 + cpu_port_num: 33 + cpu_port_ib: 0 + mgmt_port_num: 33 + mgmt_port_ibs: 1,2 + + pics_per_ib: 6, 7, 7, 6, 5, 5 + pic_ports_per_pic: 8 + max_serdes_speed: 50 + + num_shared_pics: 2 + + isg [0-4]: + ib: 0 + pic_id: [0-4] + + isg [5-9]: + ib: 5 + pic_id: [0-4] + + isg [10-14]: + ib: 1 + pic_id: [0-4] + + isg [16-20]: + ib: 3 + pic_id: [0-4] + + isg [21-25]: + ib: 4 + pic_id: [0-4] + + isg [26-30]: + ib: 2 + pic_id: [0-4] + + isg 15: + mode: 4:4 + ib: 1, 3 + pic_id: 5 + + isg 31: + mode: 4:4 + ib: 0, 2 + pic_id: 5 + + isg 32: + mode: 1:1 + ib: 1, 2 + pic_id: 6 diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_24x400_8x100/ivm.sai.config.yaml b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_24x400_8x100/ivm.sai.config.yaml new file mode 100755 index 0000000000..8ba5cfd54d --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_24x400_8x100/ivm.sai.config.yaml @@ -0,0 +1,9 @@ +IFCS_INIT_FILE : "/usr/share/sonic/hwsku/config_24x400G_8x100G_wistron_sw_to3200k.yaml" +IFCS_SKU_FILE : "/usr/share/sonic/hwsku/innovium.77700_A" +IFCS_INNO_CLI_PORT : "9999" +IFCS_TARGET : "device" +INNOVIUM_DIR : "/innovium" +PYTHONPATH : "$INNOVIUM_DIR:$INNOVIUM_DIR/cmds:$INNOVIUM_DIR/scripts:$INNOVIUM_DIR/test/:$INNOVIUM_DIR/test/utils:$INNOVIUM_DIR/utils:$INNOVIUM_DIR/pyctypes" +PLATFORM_LIBRARY: "/usr/share/sonic/platform/libplatform.so" +IVM_SAI_DATAPATH_CONFIG_FILE: "/usr/share/sonic/hwsku/ivm.sai.datapath.config.yaml" +IVM_SAI_PARAM_A0008: "32" diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_24x400_8x100/ivm.sai.datapath.config.yaml b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_24x400_8x100/ivm.sai.datapath.config.yaml new file mode 100644 index 0000000000..891b0b3e28 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_24x400_8x100/ivm.sai.datapath.config.yaml @@ -0,0 +1,9 @@ +ISAI_PARAM_P0_0_LS : "4608 4608 4608 4608 2880 2880" +ISAI_PARAM_P0_1_LS : "2226 1946 1946 1890 1218 1218" +ISAI_PARAM_P0_1_ALS : "434 154 154 98 98 98" +ISAI_PARAM_P1_0_LS : "1536 1536 1536 1536 960 960" +ISAI_PARAM_P1_0_LL : "3072 3072 3072 3072 1920 1920" +ISAI_PARAM_P1_1_LS : "1778 1498 1498 1442 938 938" +ISAI_PARAM_P1_1_LL : "2478 2478 2478 2478 2478 2478" +ISAI_PARAM_P1_1_ALS : "434 154 154 98 98 98" +ISAI_PARAM_P1_1_ALL : "126 126 126 126 126 126" diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_24x400_8x100/pg_profile_lookup.ini b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_24x400_8x100/pg_profile_lookup.ini new file mode 100644 index 0000000000..adcb52ab2a --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_24x400_8x100/pg_profile_lookup.ini @@ -0,0 +1,18 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 25000 5m 1518 0 15680 1 13440 + 50000 5m 1518 0 21248 1 13440 + 100000 5m 1518 0 34624 1 13440 + 400000 5m 1518 0 117536 1 13440 + 25000 40m 1518 0 16928 1 13440 + 50000 40m 1518 0 23392 1 13440 + 100000 40m 1518 0 38816 1 13440 + 400000 40m 1518 0 135520 1 13440 + 25000 100m 1518 0 18848 1 13440 + 50000 100m 1518 0 27264 1 13440 + 100000 100m 1518 0 46496 1 13440 + 400000 100m 1518 0 166688 1 13440 + 25000 300m 1518 0 25184 1 13440 + 50000 300m 1518 0 40128 1 13440 + 100000 300m 1518 0 72384 1 13440 + 400000 300m 1518 0 268640 1 13440 diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_24x400_8x100/port_config.ini b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_24x400_8x100/port_config.ini new file mode 100644 index 0000000000..c9e1c968c3 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_24x400_8x100/port_config.ini @@ -0,0 +1,33 @@ +# name lanes alias speed index mtu fec +Ethernet0 89,90,91,92,93,94,95,96 Eth1 400000 0 9126 rs +Ethernet8 81,82,83,84,85,86,87,88 Eth2 400000 1 9126 rs +Ethernet16 73,74,75,76,77,78,79,80 Eth3 400000 2 9126 rs +Ethernet24 65,66,67,68,69,70,71,72 Eth4 400000 3 9126 rs +Ethernet32 57,58,59,60,61,62,63,64 Eth5 400000 4 9126 rs +Ethernet40 49,50,51,52,53,54,55,56 Eth6 400000 5 9126 rs +Ethernet48 41,42,43,44,45,46,47,48 Eth7 400000 6 9126 rs +Ethernet56 33,34,35,36,37,38,39,40 Eth8 400000 7 9126 rs +Ethernet64 153,154,155,156,157,158,159,160 Eth9 400000 8 9126 rs +Ethernet72 145,146,147,148,149,150,151,152 Eth10 400000 9 9126 rs +Ethernet80 137,138,139,140,141,142,143,144 Eth11 400000 10 9126 rs +Ethernet88 129,130,131,132,133,134,135,136 Eth12 400000 11 9126 rs +Ethernet96 121,122,123,124,125,126,127,128 Eth13 400000 12 9126 rs +Ethernet104 113,114,115,116,117,118,119,120 Eth14 400000 13 9126 rs +Ethernet112 105,106,107,108,109,110,111,112 Eth15 400000 14 9126 rs +Ethernet120 97,98,99,100,101,102,103,104 Eth16 400000 15 9126 rs +Ethernet128 209,210,211,212,213,214,215,216 Eth17 400000 16 9126 rs +Ethernet136 217,218,219,220,221,222,223,224 Eth18 400000 17 9126 rs +Ethernet144 193,194,195,196,197,198,199,200 Eth19 400000 18 9126 rs +Ethernet152 201,202,203,204,205,206,207,208 Eth20 400000 19 9126 rs +Ethernet160 177,178,179,180,181,182,183,184 Eth21 400000 20 9126 rs +Ethernet168 185,186,187,188,189,190,191,192 Eth22 400000 21 9126 rs +Ethernet176 161,162,163,164,165,166,167,168 Eth23 400000 22 9126 rs +Ethernet184 169,170,171,172,173,174,175,176 Eth24 400000 23 9126 rs +Ethernet192 17,18,19,20 Eth25 100000 24 9126 none +Ethernet200 25,26,27,28 Eth26 100000 25 9126 none +Ethernet208 1,2,3,4 Eth27 100000 26 9126 none +Ethernet216 9,10,11,12 Eth28 100000 27 9126 none +Ethernet224 241,242,243,244 Eth29 100000 28 9126 none +Ethernet232 249,250,251,252 Eth30 100000 29 9126 none +Ethernet240 225,226,227,228 Eth31 100000 30 9126 none +Ethernet248 233,234,235,236 Eth32 100000 31 9126 none diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_24x400_8x100/qos.json.j2 b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_24x400_8x100/qos.json.j2 new file mode 100755 index 0000000000..104d2d78de --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_24x400_8x100/qos.json.j2 @@ -0,0 +1,118 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "0":"0", + "1":"1", + "2":"2", + "3":"3", + "4":"4", + "5":"5", + "6":"6", + "7":"7" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"0", + "4":"0", + "5":"0", + "6":"0", + "7":"0", + "8":"0", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]" + } + }, + "SCHEDULER": { + "scheduler.7": { + "type": "STRICT" + } + }, + "QUEUE": { + "{{ port_names }}|7": { + "scheduler": "[SCHEDULER|scheduler.7]" + } + } +} diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_24x400_8x100/qos_defaults_def_lossy.j2 b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_24x400_8x100/qos_defaults_def_lossy.j2 new file mode 100755 index 0000000000..104d2d78de --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_24x400_8x100/qos_defaults_def_lossy.j2 @@ -0,0 +1,118 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "0":"0", + "1":"1", + "2":"2", + "3":"3", + "4":"4", + "5":"5", + "6":"6", + "7":"7" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"0", + "4":"0", + "5":"0", + "6":"0", + "7":"0", + "8":"0", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]" + } + }, + "SCHEDULER": { + "scheduler.7": { + "type": "STRICT" + } + }, + "QUEUE": { + "{{ port_names }}|7": { + "scheduler": "[SCHEDULER|scheduler.7]" + } + } +} diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_24x400_8x100/qos_defaults_t1.j2 b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_24x400_8x100/qos_defaults_t1.j2 new file mode 100755 index 0000000000..4b9748c7b5 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_24x400_8x100/qos_defaults_t1.j2 @@ -0,0 +1,114 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "0":"0", + "1":"1", + "2":"2", + "3":"3", + "4":"4", + "5":"5", + "6":"6", + "7":"7" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "red_min_threshold":"50000" + } + } +} diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_24x400_8x100/sai.profile b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_24x400_8x100/sai.profile new file mode 100644 index 0000000000..aba4fc81fb --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_24x400_8x100/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/ivm.sai.config.yaml diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_32x100/buffers.json.j2 b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_32x100/buffers.json.j2 new file mode 100644 index 0000000000..93dac6b199 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_32x100/buffers.json.j2 @@ -0,0 +1,137 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '40m' %} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) %} + {%- set cable_len = [] %} + {%- for local_port in DEVICE_NEIGHBOR %} + {%- if local_port == port_name %} + {%- if DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor_role = neighbor.type %} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role %} + {%- set roles1 = roles1 | lower %} + {%- set roles2 = roles2 | lower %} + {%- if roles1 in ports2cable %} + {%- if cable_len.append(ports2cable[roles1]) %}{% endif %} + {%- elif roles2 in ports2cable %} + {%- if cable_len.append(ports2cable[roles2]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else %} + {%- if switch_role.lower() == 'torrouter' %} + {%- for local_port in VLAN_MEMBER %} + {%- if local_port[1] == port_name %} + {%- set roles3 = switch_role + '_' + 'server' %} + {%- set roles3 = roles3 | lower %} + {%- if roles3 in ports2cable %} + {%- if cable_len.append(ports2cable[roles3]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- endif %} +{%- endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "47218432", + "type": "ingress", + "mode": "dynamic", + "xoff": "17708800" + }, + "lossy_pool": { + "size": "18874368", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xoff":"38816", + "size":"1518", + "dynamic_th":"1", + "xon_offset":"13440" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"9497600" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"0", + "static_th":"9497600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"1518", + "dynamic_th":"2" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_32x100/buffers_defaults_def_lossy.j2 b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_32x100/buffers_defaults_def_lossy.j2 new file mode 100644 index 0000000000..1a31812c26 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_32x100/buffers_defaults_def_lossy.j2 @@ -0,0 +1,38 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "BUFFER_POOL": { + "lossy_pool": { + "size": "56985600", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"0", + "static_th":"9497600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"1518", + "dynamic_th":"2" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-7": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|0-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_32x100/buffers_defaults_t1.j2 b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_32x100/buffers_defaults_t1.j2 new file mode 100644 index 0000000000..93dac6b199 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_32x100/buffers_defaults_t1.j2 @@ -0,0 +1,137 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '40m' %} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) %} + {%- set cable_len = [] %} + {%- for local_port in DEVICE_NEIGHBOR %} + {%- if local_port == port_name %} + {%- if DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor_role = neighbor.type %} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role %} + {%- set roles1 = roles1 | lower %} + {%- set roles2 = roles2 | lower %} + {%- if roles1 in ports2cable %} + {%- if cable_len.append(ports2cable[roles1]) %}{% endif %} + {%- elif roles2 in ports2cable %} + {%- if cable_len.append(ports2cable[roles2]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else %} + {%- if switch_role.lower() == 'torrouter' %} + {%- for local_port in VLAN_MEMBER %} + {%- if local_port[1] == port_name %} + {%- set roles3 = switch_role + '_' + 'server' %} + {%- set roles3 = roles3 | lower %} + {%- if roles3 in ports2cable %} + {%- if cable_len.append(ports2cable[roles3]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- endif %} +{%- endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "47218432", + "type": "ingress", + "mode": "dynamic", + "xoff": "17708800" + }, + "lossy_pool": { + "size": "18874368", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xoff":"38816", + "size":"1518", + "dynamic_th":"1", + "xon_offset":"13440" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"9497600" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"0", + "static_th":"9497600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"1518", + "dynamic_th":"2" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_32x100/config_32x100G_wistron_sw_to3200k.yaml b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_32x100/config_32x100G_wistron_sw_to3200k.yaml new file mode 100644 index 0000000000..65111d3480 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_32x100/config_32x100G_wistron_sw_to3200k.yaml @@ -0,0 +1,419 @@ +ifcs: + options: + log_level: "info" +nodes: +- node_id: "0" + options: + sku: "configs/sku/innovium.77700_B" + netdev: + - auto_create: "no" + multi_interface: "yes" + buffer_management_mode: "api_driven" + max_lossless_tc: "2" + ilpm_enable: "1" + forward_profile: "IFCS_FORWARD_PROFILE_ID_PROFILE_E" + led_cfg_sck_rate: "0x4" + led_refresh_precliff_timer: "0xa" + led_refresh_cliff_timer: "0xc350" + txring: + - txring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "3" + desc_count: "1024" + prio: "1" + netdev: "true" + rxring: + - rxring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39" + - rxring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40" + - rxring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "2, 5, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35, 38, 41, 47" + - rxring_id: "3" + desc_count: "1024" + prio: "1" + queues: "42, 43, 44, 45, 46" + sys_clk: "1720" + ifc_clk: "1200" + mac_clk: "1340" + + devports: + - id: "0" + sysport: "1000" + type: "cpu" + - fec: "KRFEC" + id: "89" + lanes: "0:4" + serdes_group: "11" + speed: "100G" + sysport: "89" + type: "eth" + - fec: "KRFEC" + id: "81" + lanes: "0:4" + serdes_group: "10" + speed: "100G" + sysport: "81" + type: "eth" + - fec: "KRFEC" + id: "73" + lanes: "0:4" + serdes_group: "9" + speed: "100G" + sysport: "73" + type: "eth" + - fec: "KRFEC" + id: "65" + lanes: "0:4" + serdes_group: "8" + speed: "100G" + sysport: "65" + type: "eth" + - fec: "KRFEC" + id: "57" + lanes: "0:4" + serdes_group: "7" + speed: "100G" + sysport: "57" + type: "eth" + - fec: "KRFEC" + id: "49" + lanes: "0:4" + serdes_group: "6" + speed: "100G" + sysport: "49" + type: "eth" + - fec: "KRFEC" + id: "41" + lanes: "0:4" + serdes_group: "5" + speed: "100G" + sysport: "41" + type: "eth" + - fec: "KRFEC" + id: "33" + lanes: "0:4" + serdes_group: "4" + speed: "100G" + sysport: "33" + type: "eth" + - fec: "KRFEC" + id: "153" + lanes: "0:4" + serdes_group: "19" + speed: "100G" + sysport: "153" + type: "eth" + - fec: "KRFEC" + id: "145" + lanes: "0:4" + serdes_group: "18" + speed: "100G" + sysport: "145" + type: "eth" + - fec: "KRFEC" + id: "137" + lanes: "0:4" + serdes_group: "17" + speed: "100G" + sysport: "137" + type: "eth" + - fec: "KRFEC" + id: "129" + lanes: "0:4" + serdes_group: "16" + speed: "100G" + sysport: "129" + type: "eth" + - fec: "KRFEC" + id: "121" + lanes: "0:4" + serdes_group: "15" + speed: "100G" + sysport: "121" + type: "eth" + - fec: "KRFEC" + id: "113" + lanes: "0:4" + serdes_group: "14" + speed: "100G" + sysport: "113" + type: "eth" + - fec: "KRFEC" + id: "105" + lanes: "0:4" + serdes_group: "13" + speed: "100G" + sysport: "105" + type: "eth" + - fec: "KRFEC" + id: "97" + lanes: "0:4" + serdes_group: "12" + speed: "100G" + sysport: "97" + type: "eth" + - fec: "KRFEC" + id: "209" + lanes: "0:4" + serdes_group: "26" + speed: "100G" + sysport: "209" + type: "eth" + - fec: "KRFEC" + id: "217" + lanes: "0:4" + serdes_group: "27" + speed: "100G" + sysport: "217" + type: "eth" + - fec: "KRFEC" + id: "193" + lanes: "0:4" + serdes_group: "24" + speed: "100G" + sysport: "193" + type: "eth" + - fec: "KRFEC" + id: "201" + lanes: "0:4" + serdes_group: "25" + speed: "100G" + sysport: "201" + type: "eth" + - fec: "KRFEC" + id: "177" + lanes: "0:4" + serdes_group: "22" + speed: "100G" + sysport: "177" + type: "eth" + - fec: "KRFEC" + id: "185" + lanes: "0:4" + serdes_group: "23" + speed: "100G" + sysport: "185" + type: "eth" + - fec: "KRFEC" + id: "161" + lanes: "0:4" + serdes_group: "20" + speed: "100G" + sysport: "161" + type: "eth" + - fec: "KRFEC" + id: "169" + lanes: "0:4" + serdes_group: "21" + speed: "100G" + sysport: "169" + type: "eth" + - fec: "KRFEC" + id: "17" + lanes: "0:4" + serdes_group: "2" + speed: "100G" + sysport: "17" + type: "eth" + - fec: "KRFEC" + id: "25" + lanes: "0:4" + serdes_group: "3" + speed: "100G" + sysport: "25" + type: "eth" + - fec: "KRFEC" + id: "1" + lanes: "0:4" + serdes_group: "0" + speed: "100G" + sysport: "1" + type: "eth" + - fec: "KRFEC" + id: "9" + lanes: "0:4" + serdes_group: "1" + speed: "100G" + sysport: "9" + type: "eth" + - fec: "KRFEC" + id: "241" + lanes: "0:4" + serdes_group: "30" + speed: "100G" + sysport: "241" + type: "eth" + - fec: "KRFEC" + id: "249" + lanes: "0:4" + serdes_group: "31" + speed: "100G" + sysport: "249" + type: "eth" + - fec: "KRFEC" + id: "225" + lanes: "0:4" + serdes_group: "28" + speed: "100G" + sysport: "225" + type: "eth" + - fec: "KRFEC" + id: "233" + lanes: "0:4" + serdes_group: "29" + speed: "100G" + sysport: "233" + type: "eth" + isg: + - id: "0" + tx_polarity: "00000000" + rx_polarity: "10000010" + lane_swap: "57234601" + - id: "1" + tx_polarity: "01000101" + rx_polarity: "01110011" + lane_swap: "51364072" + - id: "2" + tx_polarity: "00000000" + rx_polarity: "00000010" + lane_swap: "57043621" + - id: "3" + tx_polarity: "00000110" + rx_polarity: "00100111" + lane_swap: "56024371" + - id: "4" + tx_polarity: "00110101" + rx_polarity: "00010000" + lane_swap: "65137402" + - id: "5" + tx_polarity: "00000000" + rx_polarity: "00100000" + lane_swap: "61704253" + - id: "6" + tx_polarity: "10010010" + rx_polarity: "00000100" + lane_swap: "64027315" + - id: "7" + tx_polarity: "00000000" + rx_polarity: "10111011" + lane_swap: "60714253" + - id: "8" + tx_polarity: "10100110" + rx_polarity: "00010101" + lane_swap: "67042315" + - id: "9" + tx_polarity: "00000000" + rx_polarity: "11010000" + lane_swap: "20716453" + - id: "10" + tx_polarity: "00010000" + rx_polarity: "00000000" + lane_swap: "57026314" + - id: "11" + tx_polarity: "00000000" + rx_polarity: "00010000" + lane_swap: "37014625" + - id: "12" + tx_polarity: "00100001" + rx_polarity: "00110111" + lane_swap: "50473216" + - id: "13" + tx_polarity: "00001000" + rx_polarity: "11010001" + lane_swap: "16345702" + - id: "14" + tx_polarity: "11010110" + rx_polarity: "01100100" + lane_swap: "64107352" + - id: "15" + tx_polarity: "00100000" + rx_polarity: "01001011" + lane_swap: "46325710" + - id: "16" + tx_polarity: "10011001" + rx_polarity: "00110001" + lane_swap: "54216730" + - id: "17" + tx_polarity: "00001001" + rx_polarity: "11000000" + lane_swap: "25176304" + - id: "18" + tx_polarity: "00001000" + rx_polarity: "01101010" + lane_swap: "73405612" + - id: "19" + tx_polarity: "00110100" + rx_polarity: "10001010" + lane_swap: "25176304" + - id: "20" + tx_polarity: "00000000" + rx_polarity: "00100000" + lane_swap: "45617230" + - id: "21" + tx_polarity: "11100001" + rx_polarity: "00010011" + lane_swap: "46720531" + - id: "22" + tx_polarity: "00000000" + rx_polarity: "11110111" + lane_swap: "47236501" + - id: "23" + tx_polarity: "10100001" + rx_polarity: "00000000" + lane_swap: "76245301" + - id: "24" + tx_polarity: "01000000" + rx_polarity: "00111100" + lane_swap: "47316520" + - id: "25" + tx_polarity: "10111110" + rx_polarity: "00000001" + lane_swap: "61072543" + - id: "26" + tx_polarity: "00100000" + rx_polarity: "01111000" + lane_swap: "51627430" + - id: "27" + tx_polarity: "10101001" + rx_polarity: "00000000" + lane_swap: "24017536" + - id: "28" + tx_polarity: "00000000" + rx_polarity: "10000010" + lane_swap: "26073514" + - id: "29" + tx_polarity: "01001000" + rx_polarity: "00000000" + lane_swap: "43027615" + - id: "30" + tx_polarity: "00000000" + rx_polarity: "11010010" + lane_swap: "47235601" + - id: "31" + tx_polarity: "11111100" + rx_polarity: "00000010" + lane_swap: "46025713" + - id: "32" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_32x100/innovium.77700_B b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_32x100/innovium.77700_B new file mode 100644 index 0000000000..27297b3139 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_32x100/innovium.77700_B @@ -0,0 +1,59 @@ +sku: innovium.77700_B + +device_id: 0x1b58 + +# Hardware constraint information +hardware: + num_ibs: 6 + + ports_per_ib: 32, 32, 32, 32, 20, 20 + recirc_port_num: 32, 32, 32, 32, 32, 32 + cpu_port_num: 33 + cpu_port_ib: 0 + mgmt_port_num: 33 + mgmt_port_ibs: 1,2 + + pics_per_ib: 6, 7, 7, 6, 5, 5 + pic_ports_per_pic: 8 + max_serdes_speed: 50 + + num_shared_pics: 2 + + isg [0-4]: + ib: 0 + pic_id: [0-4] + + isg [5-9]: + ib: 5 + pic_id: [0-4] + + isg [10-14]: + ib: 1 + pic_id: [0-4] + + isg [16-20]: + ib: 3 + pic_id: [0-4] + + isg [21-25]: + ib: 4 + pic_id: [0-4] + + isg [26-30]: + ib: 2 + pic_id: [0-4] + + isg 15: + mode: 4:4 + ib: 1, 3 + pic_id: 5 + + isg 31: + mode: 4:4 + ib: 0, 2 + pic_id: 5 + + isg 32: + mode: 1:1 + ib: 1, 2 + pic_id: 6 diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_32x100/ivm.sai.config.yaml b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_32x100/ivm.sai.config.yaml new file mode 100755 index 0000000000..47931e341c --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_32x100/ivm.sai.config.yaml @@ -0,0 +1,9 @@ +IFCS_INIT_FILE : "/usr/share/sonic/hwsku/config_32x100G_wistron_sw_to3200k.yaml" +IFCS_SKU_FILE : "/usr/share/sonic/hwsku/innovium.77700_B" +IFCS_INNO_CLI_PORT : "9999" +IFCS_TARGET : "device" +INNOVIUM_DIR : "/innovium" +PYTHONPATH : "$INNOVIUM_DIR:$INNOVIUM_DIR/cmds:$INNOVIUM_DIR/scripts:$INNOVIUM_DIR/test/:$INNOVIUM_DIR/test/utils:$INNOVIUM_DIR/utils:$INNOVIUM_DIR/pyctypes" +PLATFORM_LIBRARY: "/usr/share/sonic/platform/libplatform.so" +IVM_SAI_DATAPATH_CONFIG_FILE: "/usr/share/sonic/hwsku/ivm.sai.datapath.config.yaml" +IVM_SAI_PARAM_A0008: "32" diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_32x100/ivm.sai.datapath.config.yaml b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_32x100/ivm.sai.datapath.config.yaml new file mode 100644 index 0000000000..891b0b3e28 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_32x100/ivm.sai.datapath.config.yaml @@ -0,0 +1,9 @@ +ISAI_PARAM_P0_0_LS : "4608 4608 4608 4608 2880 2880" +ISAI_PARAM_P0_1_LS : "2226 1946 1946 1890 1218 1218" +ISAI_PARAM_P0_1_ALS : "434 154 154 98 98 98" +ISAI_PARAM_P1_0_LS : "1536 1536 1536 1536 960 960" +ISAI_PARAM_P1_0_LL : "3072 3072 3072 3072 1920 1920" +ISAI_PARAM_P1_1_LS : "1778 1498 1498 1442 938 938" +ISAI_PARAM_P1_1_LL : "2478 2478 2478 2478 2478 2478" +ISAI_PARAM_P1_1_ALS : "434 154 154 98 98 98" +ISAI_PARAM_P1_1_ALL : "126 126 126 126 126 126" diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_32x100/pg_profile_lookup.ini b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_32x100/pg_profile_lookup.ini new file mode 100644 index 0000000000..adcb52ab2a --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_32x100/pg_profile_lookup.ini @@ -0,0 +1,18 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 25000 5m 1518 0 15680 1 13440 + 50000 5m 1518 0 21248 1 13440 + 100000 5m 1518 0 34624 1 13440 + 400000 5m 1518 0 117536 1 13440 + 25000 40m 1518 0 16928 1 13440 + 50000 40m 1518 0 23392 1 13440 + 100000 40m 1518 0 38816 1 13440 + 400000 40m 1518 0 135520 1 13440 + 25000 100m 1518 0 18848 1 13440 + 50000 100m 1518 0 27264 1 13440 + 100000 100m 1518 0 46496 1 13440 + 400000 100m 1518 0 166688 1 13440 + 25000 300m 1518 0 25184 1 13440 + 50000 300m 1518 0 40128 1 13440 + 100000 300m 1518 0 72384 1 13440 + 400000 300m 1518 0 268640 1 13440 diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_32x100/port_config.ini b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_32x100/port_config.ini new file mode 100644 index 0000000000..9507616bd5 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_32x100/port_config.ini @@ -0,0 +1,33 @@ +# name lanes alias speed index mtu fec +Ethernet0 89,90,91,92 Eth1 100000 0 9126 rs +Ethernet8 81,82,83,84 Eth2 100000 1 9126 rs +Ethernet16 73,74,75,76 Eth3 100000 2 9126 rs +Ethernet24 65,66,67,68 Eth4 100000 3 9126 rs +Ethernet32 57,58,59,60 Eth5 100000 4 9126 rs +Ethernet40 49,50,51,52 Eth6 100000 5 9126 rs +Ethernet48 41,42,43,44 Eth7 100000 6 9126 rs +Ethernet56 33,34,35,36 Eth8 100000 7 9126 rs +Ethernet64 153,154,155,156 Eth9 100000 8 9126 rs +Ethernet72 145,146,147,148 Eth10 100000 9 9126 rs +Ethernet80 137,138,139,140 Eth11 100000 10 9126 rs +Ethernet88 129,130,131,132 Eth12 100000 11 9126 rs +Ethernet96 121,122,123,124 Eth13 100000 12 9126 rs +Ethernet104 113,114,115,116 Eth14 100000 13 9126 rs +Ethernet112 105,106,107,108 Eth15 100000 14 9126 rs +Ethernet120 97,98,99,100 Eth16 100000 15 9126 rs +Ethernet128 209,210,211,212 Eth17 100000 16 9126 rs +Ethernet136 217,218,219,220 Eth18 100000 17 9126 rs +Ethernet144 193,194,195,196 Eth19 100000 18 9126 rs +Ethernet152 201,202,203,204 Eth20 100000 19 9126 rs +Ethernet160 177,178,179,180 Eth21 100000 20 9126 rs +Ethernet168 185,186,187,188 Eth22 100000 21 9126 rs +Ethernet176 161,162,163,164 Eth23 100000 22 9126 rs +Ethernet184 169,170,171,172 Eth24 100000 23 9126 rs +Ethernet192 17,18,19,20 Eth25 100000 24 9126 rs +Ethernet200 25,26,27,28 Eth26 100000 25 9126 rs +Ethernet208 1,2,3,4 Eth27 100000 26 9126 rs +Ethernet216 9,10,11,12 Eth28 100000 27 9126 rs +Ethernet224 241,242,243,244 Eth29 100000 28 9126 rs +Ethernet232 249,250,251,252 Eth30 100000 29 9126 rs +Ethernet240 225,226,227,228 Eth31 100000 30 9126 rs +Ethernet248 233,234,235,236 Eth32 100000 31 9126 rs diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_32x100/qos.json.j2 b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_32x100/qos.json.j2 new file mode 100755 index 0000000000..4b9748c7b5 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_32x100/qos.json.j2 @@ -0,0 +1,114 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "0":"0", + "1":"1", + "2":"2", + "3":"3", + "4":"4", + "5":"5", + "6":"6", + "7":"7" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "red_min_threshold":"50000" + } + } +} diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_32x100/qos_defaults_def_lossy.j2 b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_32x100/qos_defaults_def_lossy.j2 new file mode 100755 index 0000000000..104d2d78de --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_32x100/qos_defaults_def_lossy.j2 @@ -0,0 +1,118 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "0":"0", + "1":"1", + "2":"2", + "3":"3", + "4":"4", + "5":"5", + "6":"6", + "7":"7" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"0", + "4":"0", + "5":"0", + "6":"0", + "7":"0", + "8":"0", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]" + } + }, + "SCHEDULER": { + "scheduler.7": { + "type": "STRICT" + } + }, + "QUEUE": { + "{{ port_names }}|7": { + "scheduler": "[SCHEDULER|scheduler.7]" + } + } +} diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_32x100/qos_defaults_t1.j2 b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_32x100/qos_defaults_t1.j2 new file mode 100755 index 0000000000..4b9748c7b5 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_32x100/qos_defaults_t1.j2 @@ -0,0 +1,114 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "0":"0", + "1":"1", + "2":"2", + "3":"3", + "4":"4", + "5":"5", + "6":"6", + "7":"7" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "red_min_threshold":"50000" + } + } +} diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_32x100/sai.profile b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_32x100/sai.profile new file mode 100644 index 0000000000..aba4fc81fb --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_32x100/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/ivm.sai.config.yaml diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_72x25_6x400/buffers.json.j2 b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_72x25_6x400/buffers.json.j2 new file mode 100644 index 0000000000..1a31812c26 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_72x25_6x400/buffers.json.j2 @@ -0,0 +1,38 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "BUFFER_POOL": { + "lossy_pool": { + "size": "56985600", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"0", + "static_th":"9497600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"1518", + "dynamic_th":"2" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-7": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|0-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_72x25_6x400/buffers_defaults_def_lossy.j2 b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_72x25_6x400/buffers_defaults_def_lossy.j2 new file mode 100644 index 0000000000..1a31812c26 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_72x25_6x400/buffers_defaults_def_lossy.j2 @@ -0,0 +1,38 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "BUFFER_POOL": { + "lossy_pool": { + "size": "56985600", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"0", + "static_th":"9497600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"1518", + "dynamic_th":"2" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-7": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|0-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_72x25_6x400/buffers_defaults_t1.j2 b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_72x25_6x400/buffers_defaults_t1.j2 new file mode 100644 index 0000000000..93dac6b199 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_72x25_6x400/buffers_defaults_t1.j2 @@ -0,0 +1,137 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '40m' %} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) %} + {%- set cable_len = [] %} + {%- for local_port in DEVICE_NEIGHBOR %} + {%- if local_port == port_name %} + {%- if DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor_role = neighbor.type %} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role %} + {%- set roles1 = roles1 | lower %} + {%- set roles2 = roles2 | lower %} + {%- if roles1 in ports2cable %} + {%- if cable_len.append(ports2cable[roles1]) %}{% endif %} + {%- elif roles2 in ports2cable %} + {%- if cable_len.append(ports2cable[roles2]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else %} + {%- if switch_role.lower() == 'torrouter' %} + {%- for local_port in VLAN_MEMBER %} + {%- if local_port[1] == port_name %} + {%- set roles3 = switch_role + '_' + 'server' %} + {%- set roles3 = roles3 | lower %} + {%- if roles3 in ports2cable %} + {%- if cable_len.append(ports2cable[roles3]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- endif %} +{%- endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "47218432", + "type": "ingress", + "mode": "dynamic", + "xoff": "17708800" + }, + "lossy_pool": { + "size": "18874368", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xoff":"38816", + "size":"1518", + "dynamic_th":"1", + "xon_offset":"13440" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"9497600" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"0", + "static_th":"9497600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"1518", + "dynamic_th":"2" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_72x25_6x400/config_72x25G_6x400G_wistron_sw_to3200k.yaml b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_72x25_6x400/config_72x25G_6x400G_wistron_sw_to3200k.yaml new file mode 100644 index 0000000000..f01ef1f495 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_72x25_6x400/config_72x25G_6x400G_wistron_sw_to3200k.yaml @@ -0,0 +1,798 @@ +ifcs: + options: + log_level: "info" +nodes: +- node_id: "0" + options: + sku: "configs/sku/innovium.77700_A" + netdev: + - auto_create: "no" + multi_interface: "yes" + buffer_management_mode: "api_driven" + max_lossless_tc: "2" + ilpm_enable: "1" + forward_profile: "IFCS_FORWARD_PROFILE_ID_PROFILE_E" + ecn_stats_enable: "1" + led_cfg_sck_rate: "0x4" + led_refresh_precliff_timer: "0xa" + led_refresh_cliff_timer: "0xc350" + txring: + - txring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "3" + desc_count: "1024" + prio: "1" + netdev: "true" + rxring: + - rxring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39" + - rxring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40" + - rxring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "2, 5, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35, 38, 41, 47" + - rxring_id: "3" + desc_count: "1024" + prio: "1" + queues: "42, 43, 44, 45, 46" + sys_clk: "1720" + ifc_clk: "1200" + mac_clk: "1340" + + devports: + - id: "0" + sysport: "1000" + type: "cpu" + - fec: "KRFEC" + id: "89" + lanes: "0:1" + serdes_group: "11" + speed: "25G" + sysport: "89" + type: "eth" + - fec: "KRFEC" + id: "90" + lanes: "1:1" + serdes_group: "11" + speed: "25G" + sysport: "90" + type: "eth" + - fec: "KRFEC" + id: "91" + lanes: "2:1" + serdes_group: "11" + speed: "25G" + sysport: "91" + type: "eth" + - fec: "KRFEC" + id: "92" + lanes: "3:1" + serdes_group: "11" + speed: "25G" + sysport: "92" + type: "eth" + - fec: "KRFEC" + id: "81" + lanes: "0:1" + serdes_group: "10" + speed: "25G" + sysport: "81" + type: "eth" + - fec: "KRFEC" + id: "82" + lanes: "1:1" + serdes_group: "10" + speed: "25G" + sysport: "82" + type: "eth" + - fec: "KRFEC" + id: "83" + lanes: "2:1" + serdes_group: "10" + speed: "25G" + sysport: "83" + type: "eth" + - fec: "KRFEC" + id: "84" + lanes: "3:1" + serdes_group: "10" + speed: "25G" + sysport: "84" + type: "eth" + - fec: "KRFEC" + id: "73" + lanes: "0:1" + serdes_group: "9" + speed: "25G" + sysport: "73" + type: "eth" + - fec: "KRFEC" + id: "74" + lanes: "1:1" + serdes_group: "9" + speed: "25G" + sysport: "74" + type: "eth" + - fec: "KRFEC" + id: "75" + lanes: "2:1" + serdes_group: "9" + speed: "25G" + sysport: "75" + type: "eth" + - fec: "KRFEC" + id: "76" + lanes: "3:1" + serdes_group: "9" + speed: "25G" + sysport: "76" + type: "eth" + - fec: "KRFEC" + id: "65" + lanes: "0:1" + serdes_group: "8" + speed: "25G" + sysport: "65" + type: "eth" + - fec: "KRFEC" + id: "66" + lanes: "1:1" + serdes_group: "8" + speed: "25G" + sysport: "66" + type: "eth" + - fec: "KRFEC" + id: "67" + lanes: "2:1" + serdes_group: "8" + speed: "25G" + sysport: "67" + type: "eth" + - fec: "KRFEC" + id: "68" + lanes: "3:1" + serdes_group: "8" + speed: "25G" + sysport: "68" + type: "eth" + - fec: "KRFEC" + id: "57" + lanes: "0:1" + serdes_group: "7" + speed: "25G" + sysport: "57" + type: "eth" + - fec: "KRFEC" + id: "58" + lanes: "1:1" + serdes_group: "7" + speed: "25G" + sysport: "58" + type: "eth" + - fec: "KRFEC" + id: "59" + lanes: "2:1" + serdes_group: "7" + speed: "25G" + sysport: "59" + type: "eth" + - fec: "KRFEC" + id: "60" + lanes: "3:1" + serdes_group: "7" + speed: "25G" + sysport: "60" + type: "eth" + - fec: "KRFEC" + id: "49" + lanes: "0:1" + serdes_group: "6" + speed: "25G" + sysport: "49" + type: "eth" + - fec: "KRFEC" + id: "50" + lanes: "1:1" + serdes_group: "6" + speed: "25G" + sysport: "50" + type: "eth" + - fec: "KRFEC" + id: "51" + lanes: "2:1" + serdes_group: "6" + speed: "25G" + sysport: "51" + type: "eth" + - fec: "KRFEC" + id: "52" + lanes: "3:1" + serdes_group: "6" + speed: "25G" + sysport: "52" + type: "eth" + - fec: "KRFEC" + id: "41" + lanes: "0:1" + serdes_group: "5" + speed: "25G" + sysport: "41" + type: "eth" + - fec: "KRFEC" + id: "42" + lanes: "1:1" + serdes_group: "5" + speed: "25G" + sysport: "42" + type: "eth" + - fec: "KRFEC" + id: "43" + lanes: "2:1" + serdes_group: "5" + speed: "25G" + sysport: "43" + type: "eth" + - fec: "KRFEC" + id: "44" + lanes: "3:1" + serdes_group: "5" + speed: "25G" + sysport: "44" + type: "eth" + - fec: "KRFEC" + id: "33" + lanes: "0:1" + serdes_group: "4" + speed: "25G" + sysport: "33" + type: "eth" + - fec: "KRFEC" + id: "34" + lanes: "1:1" + serdes_group: "4" + speed: "25G" + sysport: "34" + type: "eth" + - fec: "KRFEC" + id: "35" + lanes: "2:1" + serdes_group: "4" + speed: "25G" + sysport: "35" + type: "eth" + - fec: "KRFEC" + id: "36" + lanes: "3:1" + serdes_group: "4" + speed: "25G" + sysport: "36" + type: "eth" + - fec: "KRFEC" + id: "153" + lanes: "0:1" + serdes_group: "19" + speed: "25G" + sysport: "153" + type: "eth" + - fec: "KRFEC" + id: "154" + lanes: "1:1" + serdes_group: "19" + speed: "25G" + sysport: "154" + type: "eth" + - fec: "KRFEC" + id: "155" + lanes: "2:1" + serdes_group: "19" + speed: "25G" + sysport: "155" + type: "eth" + - fec: "KRFEC" + id: "156" + lanes: "3:1" + serdes_group: "19" + speed: "25G" + sysport: "156" + type: "eth" + - fec: "KRFEC" + id: "145" + lanes: "0:1" + serdes_group: "18" + speed: "25G" + sysport: "145" + type: "eth" + - fec: "KRFEC" + id: "146" + lanes: "1:1" + serdes_group: "18" + speed: "25G" + sysport: "146" + type: "eth" + - fec: "KRFEC" + id: "147" + lanes: "2:1" + serdes_group: "18" + speed: "25G" + sysport: "147" + type: "eth" + - fec: "KRFEC" + id: "148" + lanes: "3:1" + serdes_group: "18" + speed: "25G" + sysport: "148" + type: "eth" + - fec: "KRFEC" + id: "137" + lanes: "0:1" + serdes_group: "17" + speed: "25G" + sysport: "137" + type: "eth" + - fec: "KRFEC" + id: "138" + lanes: "1:1" + serdes_group: "17" + speed: "25G" + sysport: "138" + type: "eth" + - fec: "KRFEC" + id: "139" + lanes: "2:1" + serdes_group: "17" + speed: "25G" + sysport: "139" + type: "eth" + - fec: "KRFEC" + id: "140" + lanes: "3:1" + serdes_group: "17" + speed: "25G" + sysport: "140" + type: "eth" + - fec: "KRFEC" + id: "129" + lanes: "0:1" + serdes_group: "16" + speed: "25G" + sysport: "129" + type: "eth" + - fec: "KRFEC" + id: "130" + lanes: "1:1" + serdes_group: "16" + speed: "25G" + sysport: "130" + type: "eth" + - fec: "KRFEC" + id: "131" + lanes: "2:1" + serdes_group: "16" + speed: "25G" + sysport: "131" + type: "eth" + - fec: "KRFEC" + id: "132" + lanes: "3:1" + serdes_group: "16" + speed: "25G" + sysport: "132" + type: "eth" + - fec: "KRFEC" + id: "121" + lanes: "0:1" + serdes_group: "15" + speed: "25G" + sysport: "121" + type: "eth" + - fec: "KRFEC" + id: "122" + lanes: "1:1" + serdes_group: "15" + speed: "25G" + sysport: "122" + type: "eth" + - fec: "KRFEC" + id: "123" + lanes: "2:1" + serdes_group: "15" + speed: "25G" + sysport: "123" + type: "eth" + - fec: "KRFEC" + id: "124" + lanes: "3:1" + serdes_group: "15" + speed: "25G" + sysport: "124" + type: "eth" + - fec: "KRFEC" + id: "113" + lanes: "0:1" + serdes_group: "14" + speed: "25G" + sysport: "113" + type: "eth" + - fec: "KRFEC" + id: "114" + lanes: "1:1" + serdes_group: "14" + speed: "25G" + sysport: "114" + type: "eth" + - fec: "KRFEC" + id: "115" + lanes: "2:1" + serdes_group: "14" + speed: "25G" + sysport: "115" + type: "eth" + - fec: "KRFEC" + id: "116" + lanes: "3:1" + serdes_group: "14" + speed: "25G" + sysport: "116" + type: "eth" + - fec: "KRFEC" + id: "105" + lanes: "0:1" + serdes_group: "13" + speed: "25G" + sysport: "105" + type: "eth" + - fec: "KRFEC" + id: "106" + lanes: "1:1" + serdes_group: "13" + speed: "25G" + sysport: "106" + type: "eth" + - fec: "KRFEC" + id: "107" + lanes: "2:1" + serdes_group: "13" + speed: "25G" + sysport: "107" + type: "eth" + - fec: "KRFEC" + id: "108" + lanes: "3:1" + serdes_group: "13" + speed: "25G" + sysport: "108" + type: "eth" + - fec: "KRFEC" + id: "97" + lanes: "0:1" + serdes_group: "12" + speed: "25G" + sysport: "97" + type: "eth" + - fec: "KRFEC" + id: "98" + lanes: "1:1" + serdes_group: "12" + speed: "25G" + sysport: "98" + type: "eth" + - fec: "KRFEC" + id: "99" + lanes: "2:1" + serdes_group: "12" + speed: "25G" + sysport: "99" + type: "eth" + - fec: "KRFEC" + id: "100" + lanes: "3:1" + serdes_group: "12" + speed: "25G" + sysport: "100" + type: "eth" + - fec: "KRFEC" + id: "209" + lanes: "0:1" + serdes_group: "26" + speed: "25G" + sysport: "209" + type: "eth" + - fec: "KRFEC" + id: "210" + lanes: "1:1" + serdes_group: "26" + speed: "25G" + sysport: "210" + type: "eth" + - fec: "KRFEC" + id: "211" + lanes: "2:1" + serdes_group: "26" + speed: "25G" + sysport: "211" + type: "eth" + - fec: "KRFEC" + id: "212" + lanes: "3:1" + serdes_group: "26" + speed: "25G" + sysport: "212" + type: "eth" + - fec: "KRFEC" + id: "217" + lanes: "0:1" + serdes_group: "27" + speed: "25G" + sysport: "217" + type: "eth" + - fec: "KRFEC" + id: "218" + lanes: "1:1" + serdes_group: "27" + speed: "25G" + sysport: "218" + type: "eth" + - fec: "KRFEC" + id: "219" + lanes: "2:1" + serdes_group: "27" + speed: "25G" + sysport: "219" + type: "eth" + - fec: "KRFEC" + id: "220" + lanes: "3:1" + serdes_group: "27" + speed: "25G" + sysport: "220" + type: "eth" + - fec: "KRFEC" + id: "193" + lanes: "0:4" + serdes_group: "24" + speed: "100G" + sysport: "193" + type: "eth" + - fec: "KRFEC" + id: "201" + lanes: "0:4" + serdes_group: "25" + speed: "100G" + sysport: "201" + type: "eth" + - fec: "KRFEC" + id: "177" + lanes: "0:4" + serdes_group: "22" + speed: "100G" + sysport: "177" + type: "eth" + - fec: "KRFEC" + id: "185" + lanes: "0:4" + serdes_group: "23" + speed: "100G" + sysport: "185" + type: "eth" + - fec: "KRFEC" + id: "161" + lanes: "0:4" + serdes_group: "20" + speed: "100G" + sysport: "161" + type: "eth" + - fec: "KRFEC" + id: "169" + lanes: "0:4" + serdes_group: "21" + speed: "100G" + sysport: "169" + type: "eth" + - fec: "KRFEC" + id: "17" + lanes: "0:4" + serdes_group: "2" + speed: "100G" + sysport: "17" + type: "eth" + - fec: "KRFEC" + id: "25" + lanes: "0:4" + serdes_group: "3" + speed: "100G" + sysport: "25" + type: "eth" + - fec: "KPFEC" + id: "1" + lanes: "0:8" + serdes_group: "0" + speed: "400G" + sysport: "1" + type: "eth" + - fec: "KPFEC" + id: "9" + lanes: "0:8" + serdes_group: "1" + speed: "400G" + sysport: "9" + type: "eth" + - fec: "KPFEC" + id: "241" + lanes: "0:8" + serdes_group: "30" + speed: "400G" + sysport: "241" + type: "eth" + - fec: "KPFEC" + id: "249" + lanes: "0:8" + serdes_group: "31" + speed: "400G" + sysport: "249" + type: "eth" + - fec: "KPFEC" + id: "225" + lanes: "0:8" + serdes_group: "28" + speed: "400G" + sysport: "225" + type: "eth" + - fec: "KPFEC" + id: "233" + lanes: "0:8" + serdes_group: "29" + speed: "400G" + sysport: "233" + type: "eth" + isg: + - id: "0" + tx_polarity: "00000000" + rx_polarity: "10000010" + lane_swap: "57234601" + - id: "1" + tx_polarity: "01000101" + rx_polarity: "01110011" + lane_swap: "51364072" + - id: "2" + tx_polarity: "00000000" + rx_polarity: "00000010" + lane_swap: "57043621" + - id: "3" + tx_polarity: "00000110" + rx_polarity: "00100111" + lane_swap: "56024371" + - id: "4" + tx_polarity: "00110101" + rx_polarity: "00010000" + lane_swap: "65137402" + - id: "5" + tx_polarity: "00000000" + rx_polarity: "00100000" + lane_swap: "61704253" + - id: "6" + tx_polarity: "10010010" + rx_polarity: "00000100" + lane_swap: "64027315" + - id: "7" + tx_polarity: "00000000" + rx_polarity: "10111011" + lane_swap: "60714253" + - id: "8" + tx_polarity: "10100110" + rx_polarity: "00010101" + lane_swap: "67042315" + - id: "9" + tx_polarity: "00000000" + rx_polarity: "11010000" + lane_swap: "20716453" + - id: "10" + tx_polarity: "00010000" + rx_polarity: "00000000" + lane_swap: "57026314" + - id: "11" + tx_polarity: "00000000" + rx_polarity: "00010000" + lane_swap: "37014625" + - id: "12" + tx_polarity: "00100001" + rx_polarity: "00110111" + lane_swap: "50473216" + - id: "13" + tx_polarity: "00001000" + rx_polarity: "11010001" + lane_swap: "16345702" + - id: "14" + tx_polarity: "11010110" + rx_polarity: "01100100" + lane_swap: "64107352" + - id: "15" + tx_polarity: "00100000" + rx_polarity: "01001011" + lane_swap: "46325710" + - id: "16" + tx_polarity: "10011001" + rx_polarity: "00110001" + lane_swap: "54216730" + - id: "17" + tx_polarity: "00001001" + rx_polarity: "11000000" + lane_swap: "25176304" + - id: "18" + tx_polarity: "00001000" + rx_polarity: "01101010" + lane_swap: "73405612" + - id: "19" + tx_polarity: "00110100" + rx_polarity: "10001010" + lane_swap: "25176304" + - id: "20" + tx_polarity: "00000000" + rx_polarity: "00100000" + lane_swap: "45617230" + - id: "21" + tx_polarity: "11100001" + rx_polarity: "00010011" + lane_swap: "46720531" + - id: "22" + tx_polarity: "00000000" + rx_polarity: "11110111" + lane_swap: "47236501" + - id: "23" + tx_polarity: "10100001" + rx_polarity: "00000000" + lane_swap: "76245301" + - id: "24" + tx_polarity: "01000000" + rx_polarity: "00111100" + lane_swap: "47316520" + - id: "25" + tx_polarity: "10111110" + rx_polarity: "00000001" + lane_swap: "61072543" + - id: "26" + tx_polarity: "00100000" + rx_polarity: "01111000" + lane_swap: "51627430" + - id: "27" + tx_polarity: "10101001" + rx_polarity: "00000000" + lane_swap: "24017536" + - id: "28" + tx_polarity: "00000000" + rx_polarity: "10000010" + lane_swap: "26073514" + - id: "29" + tx_polarity: "01001000" + rx_polarity: "00000000" + lane_swap: "43027615" + - id: "30" + tx_polarity: "00000000" + rx_polarity: "11010010" + lane_swap: "47235601" + - id: "31" + tx_polarity: "11111100" + rx_polarity: "00000010" + lane_swap: "46025713" + - id: "32" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_72x25_6x400/innovium.77700_A b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_72x25_6x400/innovium.77700_A new file mode 100644 index 0000000000..84aa419836 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_72x25_6x400/innovium.77700_A @@ -0,0 +1,59 @@ +sku: innovium.77700_A + +device_id: 0x1b58 + +# Hardware constraint information +hardware: + num_ibs: 6 + + ports_per_ib: 32, 32, 32, 32, 20, 20 + recirc_port_num: 32, 32, 32, 32, 32, 32 + cpu_port_num: 33 + cpu_port_ib: 0 + mgmt_port_num: 33 + mgmt_port_ibs: 1,2 + + pics_per_ib: 6, 7, 6, 5, 5, 5 + pic_ports_per_pic: 8 + max_serdes_speed: 50 + + num_shared_pics: 2 + + isg [0-4]: + ib: 0 + pic_id: [0-4] + + isg [5-9]: + ib: 5 + pic_id: [0-4] + + isg [10-14]: + ib: 1 + pic_id: [0-4] + + isg [16-20]: + ib: 3 + pic_id: [0-4] + + isg [21-25]: + ib: 4 + pic_id: [0-4] + + isg [26-30]: + ib: 2 + pic_id: [0-4] + + isg 15: + mode: 8:0 + ib: 1 + pic_id: 5 + + isg 31: + mode: 8:0 + ib: 0 + pic_id: 5 + + isg 32: + mode: 1:1 + ib: 1, 2 + pic_id: 6 diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_72x25_6x400/innovium.77700_B b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_72x25_6x400/innovium.77700_B new file mode 100644 index 0000000000..27297b3139 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_72x25_6x400/innovium.77700_B @@ -0,0 +1,59 @@ +sku: innovium.77700_B + +device_id: 0x1b58 + +# Hardware constraint information +hardware: + num_ibs: 6 + + ports_per_ib: 32, 32, 32, 32, 20, 20 + recirc_port_num: 32, 32, 32, 32, 32, 32 + cpu_port_num: 33 + cpu_port_ib: 0 + mgmt_port_num: 33 + mgmt_port_ibs: 1,2 + + pics_per_ib: 6, 7, 7, 6, 5, 5 + pic_ports_per_pic: 8 + max_serdes_speed: 50 + + num_shared_pics: 2 + + isg [0-4]: + ib: 0 + pic_id: [0-4] + + isg [5-9]: + ib: 5 + pic_id: [0-4] + + isg [10-14]: + ib: 1 + pic_id: [0-4] + + isg [16-20]: + ib: 3 + pic_id: [0-4] + + isg [21-25]: + ib: 4 + pic_id: [0-4] + + isg [26-30]: + ib: 2 + pic_id: [0-4] + + isg 15: + mode: 4:4 + ib: 1, 3 + pic_id: 5 + + isg 31: + mode: 4:4 + ib: 0, 2 + pic_id: 5 + + isg 32: + mode: 1:1 + ib: 1, 2 + pic_id: 6 diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_72x25_6x400/ivm.sai.config.yaml b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_72x25_6x400/ivm.sai.config.yaml new file mode 100755 index 0000000000..c7943895f8 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_72x25_6x400/ivm.sai.config.yaml @@ -0,0 +1,9 @@ +IFCS_INIT_FILE : "/usr/share/sonic/hwsku/config_72x25G_6x400G_wistron_sw_to3200k.yaml" +IFCS_SKU_FILE : "/usr/share/sonic/hwsku/innovium.77700_A" +IFCS_INNO_CLI_PORT : "9999" +IFCS_TARGET : "device" +INNOVIUM_DIR : "/innovium" +PYTHONPATH : "$INNOVIUM_DIR:$INNOVIUM_DIR/cmds:$INNOVIUM_DIR/scripts:$INNOVIUM_DIR/test/:$INNOVIUM_DIR/test/utils:$INNOVIUM_DIR/utils:$INNOVIUM_DIR/pyctypes" +PLATFORM_LIBRARY: "/usr/share/sonic/platform/libplatform.so" +IVM_SAI_DATAPATH_CONFIG_FILE: "/usr/share/sonic/hwsku/ivm.sai.datapath.config.yaml" +IVM_SAI_PARAM_A0008: "32" diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_72x25_6x400/ivm.sai.datapath.config.yaml b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_72x25_6x400/ivm.sai.datapath.config.yaml new file mode 100644 index 0000000000..891b0b3e28 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_72x25_6x400/ivm.sai.datapath.config.yaml @@ -0,0 +1,9 @@ +ISAI_PARAM_P0_0_LS : "4608 4608 4608 4608 2880 2880" +ISAI_PARAM_P0_1_LS : "2226 1946 1946 1890 1218 1218" +ISAI_PARAM_P0_1_ALS : "434 154 154 98 98 98" +ISAI_PARAM_P1_0_LS : "1536 1536 1536 1536 960 960" +ISAI_PARAM_P1_0_LL : "3072 3072 3072 3072 1920 1920" +ISAI_PARAM_P1_1_LS : "1778 1498 1498 1442 938 938" +ISAI_PARAM_P1_1_LL : "2478 2478 2478 2478 2478 2478" +ISAI_PARAM_P1_1_ALS : "434 154 154 98 98 98" +ISAI_PARAM_P1_1_ALL : "126 126 126 126 126 126" diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_72x25_6x400/pg_profile_lookup.ini b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_72x25_6x400/pg_profile_lookup.ini new file mode 100644 index 0000000000..adcb52ab2a --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_72x25_6x400/pg_profile_lookup.ini @@ -0,0 +1,18 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 25000 5m 1518 0 15680 1 13440 + 50000 5m 1518 0 21248 1 13440 + 100000 5m 1518 0 34624 1 13440 + 400000 5m 1518 0 117536 1 13440 + 25000 40m 1518 0 16928 1 13440 + 50000 40m 1518 0 23392 1 13440 + 100000 40m 1518 0 38816 1 13440 + 400000 40m 1518 0 135520 1 13440 + 25000 100m 1518 0 18848 1 13440 + 50000 100m 1518 0 27264 1 13440 + 100000 100m 1518 0 46496 1 13440 + 400000 100m 1518 0 166688 1 13440 + 25000 300m 1518 0 25184 1 13440 + 50000 300m 1518 0 40128 1 13440 + 100000 300m 1518 0 72384 1 13440 + 400000 300m 1518 0 268640 1 13440 diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_72x25_6x400/port_config.ini b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_72x25_6x400/port_config.ini new file mode 100644 index 0000000000..4f3e8d2bd3 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_72x25_6x400/port_config.ini @@ -0,0 +1,87 @@ +# name lanes alias speed index mtu fec +Ethernet0 89 Eth1-1 25000 0 9126 rs +Ethernet1 90 Eth1-2 25000 0 9126 rs +Ethernet2 91 Eth1-3 25000 0 9126 rs +Ethernet3 92 Eth1-4 25000 0 9126 rs +Ethernet8 81 Eth2-1 25000 1 9126 rs +Ethernet9 82 Eth2-2 25000 1 9126 rs +Ethernet10 83 Eth2-3 25000 1 9126 rs +Ethernet11 84 Eth2-4 25000 1 9126 rs +Ethernet16 73 Eth3-1 25000 2 9126 rs +Ethernet17 74 Eth3-2 25000 2 9126 rs +Ethernet18 75 Eth3-3 25000 2 9126 rs +Ethernet19 76 Eth3-4 25000 2 9126 rs +Ethernet24 65 Eth4-1 25000 3 9126 rs +Ethernet25 66 Eth4-2 25000 3 9126 rs +Ethernet26 67 Eth4-3 25000 3 9126 rs +Ethernet27 68 Eth4-4 25000 3 9126 rs +Ethernet32 57 Eth5-1 25000 4 9126 rs +Ethernet33 58 Eth5-2 25000 4 9126 rs +Ethernet34 59 Eth5-3 25000 4 9126 rs +Ethernet35 60 Eth5-4 25000 4 9126 rs +Ethernet40 49 Eth6-1 25000 5 9126 rs +Ethernet41 50 Eth6-2 25000 5 9126 rs +Ethernet42 51 Eth6-3 25000 5 9126 rs +Ethernet43 52 Eth6-4 25000 5 9126 rs +Ethernet48 41 Eth7-1 25000 6 9126 rs +Ethernet49 42 Eth7-2 25000 6 9126 rs +Ethernet50 43 Eth7-3 25000 6 9126 rs +Ethernet51 44 Eth7-4 25000 6 9126 rs +Ethernet56 33 Eth8-1 25000 7 9126 rs +Ethernet57 34 Eth8-2 25000 7 9126 rs +Ethernet58 35 Eth8-3 25000 7 9126 rs +Ethernet59 36 Eth8-4 25000 7 9126 rs +Ethernet64 153 Eth9-1 25000 8 9126 rs +Ethernet65 154 Eth9-2 25000 8 9126 rs +Ethernet66 155 Eth9-3 25000 8 9126 rs +Ethernet67 156 Eth9-4 25000 8 9126 rs +Ethernet72 145 Eth10-1 25000 9 9126 rs +Ethernet73 146 Eth10-2 25000 9 9126 rs +Ethernet74 147 Eth10-3 25000 9 9126 rs +Ethernet75 148 Eth10-4 25000 9 9126 rs +Ethernet80 137 Eth11-1 25000 10 9126 rs +Ethernet81 138 Eth11-2 25000 10 9126 rs +Ethernet82 139 Eth11-3 25000 10 9126 rs +Ethernet83 140 Eth11-4 25000 10 9126 rs +Ethernet88 129 Eth12-1 25000 11 9126 rs +Ethernet89 130 Eth12-2 25000 11 9126 rs +Ethernet90 131 Eth12-3 25000 11 9126 rs +Ethernet91 132 Eth12-4 25000 11 9126 rs +Ethernet96 121 Eth13-1 25000 12 9126 rs +Ethernet97 122 Eth13-2 25000 12 9126 rs +Ethernet98 123 Eth13-3 25000 12 9126 rs +Ethernet99 124 Eth13-4 25000 12 9126 rs +Ethernet104 113 Eth14-1 25000 13 9126 rs +Ethernet105 114 Eth14-2 25000 13 9126 rs +Ethernet106 115 Eth14-3 25000 13 9126 rs +Ethernet107 116 Eth14-4 25000 13 9126 rs +Ethernet112 105 Eth15-1 25000 14 9126 rs +Ethernet113 106 Eth15-2 25000 14 9126 rs +Ethernet114 107 Eth15-3 25000 14 9126 rs +Ethernet115 108 Eth15-4 25000 14 9126 rs +Ethernet120 97 Eth16-1 25000 15 9126 rs +Ethernet121 98 Eth16-2 25000 15 9126 rs +Ethernet122 99 Eth16-3 25000 15 9126 rs +Ethernet123 100 Eth16-4 25000 15 9126 rs +Ethernet128 209 Eth17-1 25000 16 9126 rs +Ethernet129 210 Eth17-2 25000 16 9126 rs +Ethernet130 211 Eth17-3 25000 16 9126 rs +Ethernet131 212 Eth17-4 25000 16 9126 rs +Ethernet136 217 Eth18-1 25000 17 9126 rs +Ethernet137 218 Eth18-2 25000 17 9126 rs +Ethernet138 219 Eth18-3 25000 17 9126 rs +Ethernet139 220 Eth18-4 25000 17 9126 rs +Ethernet144 193,194,195,196 Eth19 100000 18 9126 rs +Ethernet152 201,202,203,204 Eth20 100000 19 9126 rs +Ethernet160 177,178,179,180 Eth21 100000 20 9126 rs +Ethernet168 185,186,187,188 Eth22 100000 21 9126 rs +Ethernet176 161,162,163,164 Eth23 100000 22 9126 rs +Ethernet184 169,170,171,172 Eth24 100000 23 9126 rs +Ethernet192 17,18,19,20 Eth25 100000 24 9126 rs +Ethernet200 25,26,27,28 Eth26 100000 25 9126 rs +Ethernet208 1,2,3,4,5,6,7,8 Eth27 400000 26 9126 rs +Ethernet216 9,10,11,12,13,14,15,16 Eth28 400000 27 9126 rs +Ethernet224 241,242,243,244,245,246,247,248 Eth29 400000 28 9126 rs +Ethernet232 249,250,251,252,253,254,255,256 Eth30 400000 29 9126 rs +Ethernet240 225,226,227,228,229,230,231,232 Eth31 400000 30 9126 rs +Ethernet248 233,234,235,236,237,238,239,240 Eth32 400000 31 9126 rs diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_72x25_6x400/qos.json.j2 b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_72x25_6x400/qos.json.j2 new file mode 100755 index 0000000000..104d2d78de --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_72x25_6x400/qos.json.j2 @@ -0,0 +1,118 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "0":"0", + "1":"1", + "2":"2", + "3":"3", + "4":"4", + "5":"5", + "6":"6", + "7":"7" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"0", + "4":"0", + "5":"0", + "6":"0", + "7":"0", + "8":"0", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]" + } + }, + "SCHEDULER": { + "scheduler.7": { + "type": "STRICT" + } + }, + "QUEUE": { + "{{ port_names }}|7": { + "scheduler": "[SCHEDULER|scheduler.7]" + } + } +} diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_72x25_6x400/qos_defaults_def_lossy.j2 b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_72x25_6x400/qos_defaults_def_lossy.j2 new file mode 100755 index 0000000000..104d2d78de --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_72x25_6x400/qos_defaults_def_lossy.j2 @@ -0,0 +1,118 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "0":"0", + "1":"1", + "2":"2", + "3":"3", + "4":"4", + "5":"5", + "6":"6", + "7":"7" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"0", + "4":"0", + "5":"0", + "6":"0", + "7":"0", + "8":"0", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]" + } + }, + "SCHEDULER": { + "scheduler.7": { + "type": "STRICT" + } + }, + "QUEUE": { + "{{ port_names }}|7": { + "scheduler": "[SCHEDULER|scheduler.7]" + } + } +} diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_72x25_6x400/qos_defaults_t1.j2 b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_72x25_6x400/qos_defaults_t1.j2 new file mode 100755 index 0000000000..4b9748c7b5 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_72x25_6x400/qos_defaults_t1.j2 @@ -0,0 +1,114 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "0":"0", + "1":"1", + "2":"2", + "3":"3", + "4":"4", + "5":"5", + "6":"6", + "7":"7" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "red_min_threshold":"50000" + } + } +} diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_72x25_6x400/sai.profile b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_72x25_6x400/sai.profile new file mode 100644 index 0000000000..aba4fc81fb --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/Wistron_sw_to3200k_72x25_6x400/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/ivm.sai.config.yaml diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/default_sku b/device/wistron/x86_64-wistron_sw_to3200k-r0/default_sku new file mode 100644 index 0000000000..041c1629fc --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/default_sku @@ -0,0 +1 @@ +Wistron_sw_to3200k t1 diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/installer.conf b/device/wistron/x86_64-wistron_sw_to3200k-r0/installer.conf new file mode 100644 index 0000000000..d5f9419d77 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/installer.conf @@ -0,0 +1,4 @@ +CONSOLE_PORT=0x3f8 +CONSOLE_DEV=0 +CONSOLE_SPEED=115200 +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="pcie_aspm=off" diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/libplatform.so b/device/wistron/x86_64-wistron_sw_to3200k-r0/libplatform.so new file mode 100644 index 0000000000..1ca41771ff Binary files /dev/null and b/device/wistron/x86_64-wistron_sw_to3200k-r0/libplatform.so differ diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/plugins/eeprom.py b/device/wistron/x86_64-wistron_sw_to3200k-r0/plugins/eeprom.py new file mode 100755 index 0000000000..9f59510eac --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/plugins/eeprom.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python + +try: + import os + from sonic_eeprom import eeprom_tlvinfo +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +def eeprom_check(): + filepath="/sys/bus/i2c/devices/0-0056/eeprom" + if os.path.isfile(filepath): + return 1 #now board, 0x56 + else: + return 0 #now board, 0x57 + +class board(eeprom_tlvinfo.TlvInfoDecoder): + _TLV_INFO_MAX_LEN = 256 + def __init__(self, name, path, cpld_root, ro): + ret=eeprom_check() + if ret==1: + self.eeprom_path = "/sys/bus/i2c/devices/0-0056/eeprom" + else: + self.eeprom_path = "/sys/bus/i2c/devices/47-0057/eeprom" + + super(board, self).__init__(self.eeprom_path, 0, '', True) + diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/plugins/psuutil.py b/device/wistron/x86_64-wistron_sw_to3200k-r0/plugins/psuutil.py new file mode 100755 index 0000000000..2d00aa6282 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/plugins/psuutil.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python + +############################################################################# +# Accton +# +# Module contains an implementation of SONiC PSU Base API and +# provides the PSUs status which are available in the platform +# +############################################################################# + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + self.psu_path = "/sys/bus/i2c/devices/" + self.psu_presence = "/psu_present" + self.psu_oper_status = "/psu_power_good" + self.psu_mapping = { + 2: "0-0051", + 1: "0-0052", + } + + def get_num_psus(self): + return len(self.psu_mapping) + + def get_psu_status(self, index): + if index is None: + return False + + status = 0 + node = self.psu_path + self.psu_mapping[index]+self.psu_oper_status + try: + with open(node, 'r') as power_status: + status = int(power_status.read()) + except IOError: + return False + + return status == 1 + + def get_psu_presence(self, index): + if index is None: + return False + + status = 0 + node = self.psu_path + self.psu_mapping[index] + self.psu_presence + try: + with open(node, 'r') as presence_status: + status = int(presence_status.read()) + except IOError: + return False + + return status == 1 diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/plugins/sfputil.py b/device/wistron/x86_64-wistron_sw_to3200k-r0/plugins/sfputil.py new file mode 100755 index 0000000000..fe59dc7d8c --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/plugins/sfputil.py @@ -0,0 +1,186 @@ +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# + +try: + import time + from sonic_sfp.sfputilbase import SfpUtilBase +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + + +class SfpUtil(SfpUtilBase): + """Platform-specific SfpUtil class""" + SONIC_PORT_NAME_PREFIX = "Ethernet" + PORT_START = 0 + PORT_END = 31 + PORTS_IN_BLOCK = 32 + + BASE_OOM_PATH = "/sys/bus/i2c/devices/0-00{0}/" + BASE_CPLD1_PATH = "/sys/bus/i2c/devices/0-0061/" + BASE_CPLD2_PATH = "/sys/bus/i2c/devices/0-0062/" + + _port_to_is_present = {} + _port_to_lp_mode = {} + + _port_to_eeprom_mapping = {} + _port_to_i2c_mapping = { + 0: [1, 10], + 1: [2, 11], + 2: [3, 12], + 3: [4, 13], + 4: [5, 14], + 5: [6, 15], + 6: [7, 16], + 7: [8, 17], + 8: [9, 18], + 9: [10, 19], + 10: [11, 20], + 11: [12, 21], + 12: [13, 22], + 13: [14, 23], + 14: [15, 24], + 15: [16, 25], + 16: [17, 26], + 17: [18, 27], + 18: [19, 28], + 19: [20, 29], + 20: [21, 30], + 21: [22, 31], + 22: [23, 32], + 23: [24, 33], + 24: [25, 34], + 25: [26, 35], + 26: [27, 36], + 27: [28, 37], + 28: [29, 38], + 29: [30, 39], + 30: [31, 40], + 31: [32, 41], + } + + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_ports(self): + return range(self.PORT_START, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def is_logical_port(self, port_name): + return True + + def get_logical_to_physical(self, port_name): + if not port_name.startswith(self.SONIC_PORT_NAME_PREFIX): + return None + + port_idx = int(port_name[len(self.SONIC_PORT_NAME_PREFIX):]) + port_idx = port_idx // 8 + return [port_idx] + + def __init__(self): + eeprom_path = self.BASE_OOM_PATH + "eeprom1" + + for x in range(0, self.port_end+1): + self.port_to_eeprom_mapping[x] = eeprom_path.format(self._port_to_i2c_mapping[x][1]) + + self._transceiver_presence = self._get_sfp_presence() + SfpUtilBase.__init__(self) + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + if port_num < 16 : + present_path = self.BASE_CPLD1_PATH + "module_present_" + str(port_num+1) + else: + present_path = self.BASE_CPLD2_PATH + "module_present_" + str(port_num+1) + self.__port_to_is_present = present_path + + try: + val_file = open(self.__port_to_is_present) + content = val_file.readline().rstrip() + val_file.close() + except IOError as e: + print "Error: unable to access file: %s" % str(e) + return False + + if content == "1": + return True + + return False + + def get_low_power_mode(self, port_num): + raise NotImplementedError + + def set_low_power_mode(self, port_num, lpmode): + raise NotImplementedError + + def reset(self, port_num): + raise NotImplementedError + + def _get_sfp_presence(self): + port_pres = {} + for port in range(0, self.port_end+1): + port_pres[port] = self.get_presence(port) + + return port_pres + + def get_transceiver_change_event(self, timeout=0): + start_time = time.time() + port_dict = {} + forever = False + + if timeout == 0: + forever = True + elif timeout > 0: + timeout = timeout / float(1000) # Convert to secs + else: + print "get_transceiver_change_event:Invalid timeout value", timeout + return False, {} + + end_time = start_time + timeout + if start_time > end_time: + print 'get_transceiver_change_event:' \ + 'time wrap / invalid timeout value', timeout + + return False, {} # Time wrap or possibly incorrect timeout + + while timeout >= 0: + change_status = False + + cur_presence = self._get_sfp_presence() + for port in range(0, self.port_end+1): + if cur_presence[port] == 1: + port_dict[port]='1' + else: + port_dict[port]='0' + + if cur_presence[port] != self._transceiver_presence[port]: + change_status = True + + self._transceiver_presence = cur_presence + if change_status: + return True, port_dict + + if forever: + time.sleep(1) + else: + timeout = end_time - time.time() + if timeout >= 1: + time.sleep(1) # We poll at 1 second granularity + else: + if timeout > 0: + time.sleep(timeout) + return True, {} + print "get_evt_change_event: Should not reach here." + return False, {} diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/pmon_daemon_control.json b/device/wistron/x86_64-wistron_sw_to3200k-r0/pmon_daemon_control.json new file mode 100644 index 0000000000..94592fa8ce --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/pmon_daemon_control.json @@ -0,0 +1,3 @@ +{ + "skip_ledd": true +} diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/sw-to3200k_sonic_serdes.config b/device/wistron/x86_64-wistron_sw_to3200k-r0/sw-to3200k_sonic_serdes.config new file mode 100644 index 0000000000..9a16887e3a --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/sw-to3200k_sonic_serdes.config @@ -0,0 +1,5135 @@ + + + - id: "0" + pre1: "4, 4, 4, 4, 2, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 0, 2, 2, 0, 4, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "1" + pre1: "4, 4, 4, 4, 4, 4, 2, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 2, 4, 2, 4, 0, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "2" + pre1: "4, 2, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 2, 0, 4, 2, 2, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "3" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 2, 2, 0, 0, 2, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "4" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, -1, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 2, 0, 0, 0, 4" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "5" + pre1: "4, 4, 4, 4, 4, 4, 2, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 2, 2, 2, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "6" + pre1: "4, 4, 4, 4, 4, 2, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 2, 0, 2, 4, 2, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "7" + pre1: "4, 2, 2, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 0, 2, 2, 0, 0, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "8" + pre1: "4, 4, 4, 4, 4, 4, 2, 4" + pre2: "0, 0, 0, 0, -1, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 0, 2, 0, 2, 4, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "9" + pre1: "4, 2, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, -2, 0, 0, 4, 2, 2, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "10" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 0, 2, 2, 2, 4, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "11" + pre1: "4, 4, 4, 4, 2, 4, 4, 4" + pre2: "0, -1, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "4, 2, 0, 4, 0, 4, 2, 4" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "12" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, -1, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "13" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 2, 0, 0, 4, 2, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "14" + pre1: "2, 4, 4, 2, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, -1" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "4, 0, 0, 2, 2, 4, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "15" + pre1: "4, 4, 4, 2, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 2, 0, 0, 2, 2, 4, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "16" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 2, 0, 0, 4, 4, 2, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "17" + pre1: "4, 4, 2, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, -1, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "4, 4, 2, 2, 4, 4, 4, 4" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "18" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "1, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 0, 2, 0, 4, 4, 2, 4" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "19" + pre1: "4, 4, 4, 4, 4, 4, 2, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "4, 4, 0, 2, 4, 4, 4, 4" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "20" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, -1, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "4, 2, 2, 4, 4, 4, 4, 4" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "21" + pre1: "2, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 4, 2, 0, 2, 2, 2, 4" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "22" + pre1: "4, 2, 4, 4, 2, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 4, 0, 2, 2, 4, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "23" + pre1: "4, 4, 4, 4, 4, 4, 2, 4" + pre2: "0, -1, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 2, 2, 2, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "24" + pre1: "4, 4, 4, 4, 2, 2, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 0, 2, 0, 2, 2, 4" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "25" + pre1: "2, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 2, 0, -2, 0, 0, 2, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "26" + pre1: "2, 4, 4, 4, 4, 2, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 2, 0, 2, 0, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "27" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 1, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 2, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "28" + pre1: "4, 4, 4, 2, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 2, 2, 2, 4, 4, 4" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "29" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, -1, 0, 0, 0" + pre3: "0, -1, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "4, 2, 2, 4, 4, 2, 2, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "30" + pre1: "4, 4, 4, 4, 4, 2, 2, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 2, 0, 2, 2, 2, 2, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "31" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "4, 4, 2, 2, 2, 4, 2, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + + - id: "0" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "1" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "2" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "3" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "4" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "5" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "6" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "7" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "8" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "9" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "10" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "11" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "12" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "13" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "14" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "15" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "16" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "17" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "18" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "19" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "20" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "21" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "22" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "23" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "24" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "25" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "26" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "27" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "28" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "29" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "30" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "31" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + + - id: "0" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "1" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "2" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "3" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "4" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "5" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "6" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "7" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "8" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "9" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "10" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "11" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "12" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "13" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "14" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "15" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "16" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "17" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "18" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "19" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "20" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "21" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "22" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "23" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "24" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "25" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "26" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "27" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "28" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "29" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "30" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "31" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + + - id: "0" + pre1: "4, 4, 4, 4, 2, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 0, 2, 2, 0, 4, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "1" + pre1: "4, 4, 4, 4, 4, 4, 2, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 2, 4, 2, 4, 0, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "2" + pre1: "4, 2, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 2, 0, 4, 2, 2, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "3" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 2, 2, 0, 0, 2, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "4" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, -1, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 2, 0, 0, 0, 4" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "5" + pre1: "4, 4, 4, 4, 4, 4, 2, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 2, 2, 2, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "6" + pre1: "4, 4, 4, 4, 4, 2, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 2, 0, 2, 4, 2, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "7" + pre1: "4, 2, 2, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 0, 2, 2, 0, 0, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "8" + pre1: "4, 4, 4, 4, 4, 4, 2, 4" + pre2: "0, 0, 0, 0, -1, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 0, 2, 0, 2, 4, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "9" + pre1: "4, 2, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, -2, 0, 0, 4, 2, 2, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "10" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 0, 2, 2, 2, 4, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "11" + pre1: "4, 4, 4, 4, 2, 4, 4, 4" + pre2: "0, -1, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "4, 2, 0, 4, 0, 4, 2, 4" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "12" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, -1, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "13" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 2, 0, 0, 4, 2, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "14" + pre1: "2, 4, 4, 2, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, -1" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "4, 0, 0, 2, 2, 4, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "15" + pre1: "4, 4, 4, 2, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 2, 0, 0, 2, 2, 4, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "16" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 2, 0, 0, 4, 4, 2, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "17" + pre1: "4, 4, 2, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, -1, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "4, 4, 2, 2, 4, 4, 4, 4" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "18" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "1, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 0, 2, 0, 4, 4, 2, 4" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "19" + pre1: "4, 4, 4, 4, 4, 4, 2, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "4, 4, 0, 2, 4, 4, 4, 4" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "20" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, -1, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "4, 2, 2, 4, 4, 4, 4, 4" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "21" + pre1: "2, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 4, 2, 0, 2, 2, 2, 4" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "22" + pre1: "4, 2, 4, 4, 2, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 4, 0, 2, 2, 4, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "23" + pre1: "4, 4, 4, 4, 4, 4, 2, 4" + pre2: "0, -1, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 2, 2, 2, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "24" + pre1: "4, 4, 4, 4, 2, 2, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 0, 2, 0, 2, 2, 4" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "25" + pre1: "2, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 2, 0, -2, 0, 0, 2, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "26" + pre1: "2, 4, 4, 4, 4, 2, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 2, 0, 2, 0, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "27" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 1, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 2, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "28" + pre1: "4, 4, 4, 2, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 2, 2, 2, 4, 4, 4" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "29" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, -1, 0, 0, 0" + pre3: "0, -1, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "4, 2, 2, 4, 4, 2, 2, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "30" + pre1: "4, 4, 4, 4, 4, 2, 2, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 2, 0, 2, 2, 2, 2, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "31" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "4, 4, 2, 2, 2, 4, 2, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + + + - id: "0" + pre1: "4, 4, 4, 2, 2, 2, 2, 4" + pre2: "0, 0, 0, 0, 0, 0, -1, 0" + pre3: "-1, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 0, 2, 2, 2, 2, 0" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "1" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 0, 2, 2, 2, 2, 2" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "2" + pre1: "4, 4, 4, 4, 2, 2, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 0, 2, 2, 2, 0, 0" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "3" + pre1: "4, 4, 4, 4, 2, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, -1, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 2, 0, 2, 0" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "4" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "5" + pre1: "4, 4, 4, 2, 2, 2, 2, 4" + pre2: "0, 0, -1, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 1, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 0, 2, 2, 2, 2, 2" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "6" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 2, 0, 0, 0, 2, 2" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "7" + pre1: "4, 4, 2, 4, 2, 2, 2, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "1, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 2, 2, 2, 2, 2, 0" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "8" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 2, 2, 4, 2, 2, 2" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "9" + pre1: "2, 2, 2, 4, 2, 4, 2, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "4, 4, 2, 2, 2, 2, 4, 2" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "10" + pre1: "4, 2, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, -1, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 2, 2, 2, 4, 2, 6, 2" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "11" + pre1: "4, 4, 4, 4, 4, 2, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "4, 4, 4, 4, 4, 4, 4, 4" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "12" + pre1: "4, 4, 4, 4, 4, 4, 4, 2" + pre2: "0, 0, 0, 0, 0, -1, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 2, 0, 0, 0, 0, 2" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "13" + pre1: "2, 2, 4, 4, 2, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 1, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 0, 0, 2, 2, 0, 0" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "14" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "-1, 0, 0, 0, 0, 0, 0, -1" + pre3: "0, 0, 0, 0, 0, 1, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 2, 0, 2, 0" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "15" + pre1: "4, 4, 4, 4, 4, 4, 2, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 0, 0, 2, 2, 2, 0" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "16" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 1, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 0, 2, 4, 4, 2, 2" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "17" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "4, 4, 2, 4, 4, 4, 4, 4" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "18" + pre1: "2, 4, 4, 4, 4, 4, 2, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "4, 4, 4, 4, 4, 4, 4, 4" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "19" + pre1: "4, 4, 4, 4, 2, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "4, 4, 4, 4, 4, 4, 4, 2" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "20" + pre1: "2, 4, 2, 2, 2, 2, 4, 2" + pre2: "0, 0, 0, 0, -1, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "4, 2, 4, 4, 4, 4, 4, 4" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "21" + pre1: "2, 4, 4, 4, 2, 2, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 2, 4, 4, 2, 2, 2" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "22" + pre1: "4, 2, 4, 4, 4, 2, 4, 2" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 2, 2, 2, 2, 2, 2" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "23" + pre1: "4, 4, 4, 2, 4, 4, 4, 2" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 2, 0, 2, 2, 2, 2, 2" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "24" + pre1: "4, 2, 4, 2, 4, 2, 2, 2" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 2, 2, 2, 2, 2, 2" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "25" + pre1: "4, 2, 4, 4, 4, 2, 4, 4" + pre2: "0, 0, 0, -1, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 2, 0, 0, 0, 2, 0, 0" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "26" + pre1: "2, 4, 4, 4, 2, 4, 2, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 1, 0, 0, 0, 0, 1" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 0, 0, 2, 2, 0, 2, 2" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "27" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 2, 2, 2, 0, 2, 0" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "28" + pre1: "4, 2, 4, 2, 4, 4, 4, 2" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 4, 2, 4, 4, 4, 4, 4" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "29" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, -1, 0" + pre3: "0, 1, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "4, 2, 2, 2, 4, 4, 2, 2" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "30" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 0, 2, 2, 2, 2, 0" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "31" + pre1: "4, 4, 4, 4, 2, 4, 2, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 4, 2, 2, 2, 2, 2, 2" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + + - id: "0" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eye_disq: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "1" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eye_disq: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "2" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eye_disq: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "3" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eye_disq: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "4" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eye_disq: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "5" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eye_disq: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "6" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eye_disq: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "7" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eye_disq: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "8" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eye_disq: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "9" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eye_disq: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "10" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eye_disq: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "11" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eye_disq: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "12" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eye_disq: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "13" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eye_disq: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "14" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eye_disq: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "15" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eye_disq: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "16" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eye_disq: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "17" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eye_disq: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "18" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eye_disq: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "19" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eye_disq: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "20" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eye_disq: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "21" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eye_disq: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "22" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eye_disq: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "23" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eye_disq: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "24" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eye_disq: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "25" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eye_disq: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "26" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eye_disq: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "27" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eye_disq: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "28" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eye_disq: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "29" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eye_disq: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "30" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eye_disq: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "31" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eye_disq: "100, 100, 100, 100, 100, 100, 100, 100" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + + - id: "0" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "130, 130, 130, 130, 130, 130, 130, 130" + rx_eye_disq: "200, 200, 200, 200, 200, 200, 200, 200" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "1" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "130, 130, 130, 130, 130, 130, 130, 130" + rx_eye_disq: "200, 200, 200, 200, 200, 200, 200, 200" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "2" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "130, 130, 130, 130, 130, 130, 130, 130" + rx_eye_disq: "200, 200, 200, 200, 200, 200, 200, 200" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "3" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "130, 130, 130, 130, 130, 130, 130, 130" + rx_eye_disq: "200, 200, 200, 200, 200, 200, 200, 200" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "4" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "130, 130, 130, 130, 130, 130, 130, 130" + rx_eye_disq: "200, 200, 200, 200, 200, 200, 200, 200" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "5" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "130, 130, 130, 130, 130, 130, 130, 130" + rx_eye_disq: "200, 200, 200, 200, 200, 200, 200, 200" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "6" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "130, 130, 130, 130, 130, 130, 130, 130" + rx_eye_disq: "200, 200, 200, 200, 200, 200, 200, 200" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "7" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "130, 130, 130, 130, 130, 130, 130, 130" + rx_eye_disq: "200, 200, 200, 200, 200, 200, 200, 200" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "8" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "130, 130, 130, 130, 130, 130, 130, 130" + rx_eye_disq: "200, 200, 200, 200, 200, 200, 200, 200" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "9" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "130, 130, 130, 130, 130, 130, 130, 130" + rx_eye_disq: "200, 200, 200, 200, 200, 200, 200, 200" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "10" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "130, 130, 130, 130, 130, 130, 130, 130" + rx_eye_disq: "200, 200, 200, 200, 200, 200, 200, 200" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "11" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "130, 130, 130, 130, 130, 130, 130, 130" + rx_eye_disq: "200, 200, 200, 200, 200, 200, 200, 200" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "12" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "130, 130, 130, 130, 130, 130, 130, 130" + rx_eye_disq: "200, 200, 200, 200, 200, 200, 200, 200" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "13" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "130, 130, 130, 130, 130, 130, 130, 130" + rx_eye_disq: "200, 200, 200, 200, 200, 200, 200, 200" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "14" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "130, 130, 130, 130, 130, 130, 130, 130" + rx_eye_disq: "200, 200, 200, 200, 200, 200, 200, 200" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "15" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "130, 130, 130, 130, 130, 130, 130, 130" + rx_eye_disq: "200, 200, 200, 200, 200, 200, 200, 200" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "16" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "130, 130, 130, 130, 130, 130, 130, 130" + rx_eye_disq: "200, 200, 200, 200, 200, 200, 200, 200" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "17" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "130, 130, 130, 130, 130, 130, 130, 130" + rx_eye_disq: "200, 200, 200, 200, 200, 200, 200, 200" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "18" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "130, 130, 130, 130, 130, 130, 130, 130" + rx_eye_disq: "200, 200, 200, 200, 200, 200, 200, 200" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "19" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "130, 130, 130, 130, 130, 130, 130, 130" + rx_eye_disq: "200, 200, 200, 200, 200, 200, 200, 200" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "20" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "130, 130, 130, 130, 130, 130, 130, 130" + rx_eye_disq: "200, 200, 200, 200, 200, 200, 200, 200" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "21" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "130, 130, 130, 130, 130, 130, 130, 130" + rx_eye_disq: "200, 200, 200, 200, 200, 200, 200, 200" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "22" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "130, 130, 130, 130, 130, 130, 130, 130" + rx_eye_disq: "200, 200, 200, 200, 200, 200, 200, 200" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "23" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "130, 130, 130, 130, 130, 130, 130, 130" + rx_eye_disq: "200, 200, 200, 200, 200, 200, 200, 200" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "24" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "130, 130, 130, 130, 130, 130, 130, 130" + rx_eye_disq: "200, 200, 200, 200, 200, 200, 200, 200" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "25" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "130, 130, 130, 130, 130, 130, 130, 130" + rx_eye_disq: "200, 200, 200, 200, 200, 200, 200, 200" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "26" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "130, 130, 130, 130, 130, 130, 130, 130" + rx_eye_disq: "200, 200, 200, 200, 200, 200, 200, 200" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "27" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "130, 130, 130, 130, 130, 130, 130, 130" + rx_eye_disq: "200, 200, 200, 200, 200, 200, 200, 200" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "28" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "130, 130, 130, 130, 130, 130, 130, 130" + rx_eye_disq: "200, 200, 200, 200, 200, 200, 200, 200" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "29" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "130, 130, 130, 130, 130, 130, 130, 130" + rx_eye_disq: "200, 200, 200, 200, 200, 200, 200, 200" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "30" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "130, 130, 130, 130, 130, 130, 130, 130" + rx_eye_disq: "200, 200, 200, 200, 200, 200, 200, 200" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "31" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "130, 130, 130, 130, 130, 130, 130, 130" + rx_eye_disq: "200, 200, 200, 200, 200, 200, 200, 200" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "0" + gshape1: "2, 2, 2, 2, 2, 2, 2, 2" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + + - id: "0" + pre1: "4, 4, 4, 2, 2, 2, 2, 4" + pre2: "0, 0, 0, 0, 0, 0, -1, 0" + pre3: "-1, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 0, 2, 2, 2, 2, 0" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "1" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 0, 2, 2, 2, 2, 2" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "2" + pre1: "4, 4, 4, 4, 2, 2, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 0, 2, 2, 2, 0, 0" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "3" + pre1: "4, 4, 4, 4, 2, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, -1, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 2, 0, 2, 0" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "4" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "5" + pre1: "4, 4, 4, 2, 2, 2, 2, 4" + pre2: "0, 0, -1, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 1, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 0, 2, 2, 2, 2, 2" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "6" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 2, 0, 0, 0, 2, 2" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "7" + pre1: "4, 4, 2, 4, 2, 2, 2, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "1, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 2, 2, 2, 2, 2, 0" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "8" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 2, 2, 4, 2, 2, 2" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "9" + pre1: "2, 2, 2, 4, 2, 4, 2, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "4, 4, 2, 2, 2, 2, 4, 2" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "10" + pre1: "4, 2, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, -1, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 2, 2, 2, 4, 2, 6, 2" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "11" + pre1: "4, 4, 4, 4, 4, 2, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "4, 4, 4, 4, 4, 4, 4, 4" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "12" + pre1: "4, 4, 4, 4, 4, 4, 4, 2" + pre2: "0, 0, 0, 0, 0, -1, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 2, 0, 0, 0, 0, 2" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "13" + pre1: "2, 2, 4, 4, 2, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 1, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 0, 0, 2, 2, 0, 0" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "14" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "-1, 0, 0, 0, 0, 0, 0, -1" + pre3: "0, 0, 0, 0, 0, 1, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 2, 0, 2, 0" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "15" + pre1: "4, 4, 4, 4, 4, 4, 2, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 0, 0, 2, 2, 2, 0" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "16" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 1, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 0, 2, 4, 4, 2, 2" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "17" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "4, 4, 2, 4, 4, 4, 4, 4" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "18" + pre1: "2, 4, 4, 4, 4, 4, 2, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "4, 4, 4, 4, 4, 4, 4, 4" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "19" + pre1: "4, 4, 4, 4, 2, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "4, 4, 4, 4, 4, 4, 4, 2" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "20" + pre1: "2, 4, 2, 2, 2, 2, 4, 2" + pre2: "0, 0, 0, 0, -1, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "4, 2, 4, 4, 4, 4, 4, 4" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "21" + pre1: "2, 4, 4, 4, 2, 2, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 2, 4, 4, 2, 2, 2" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "22" + pre1: "4, 2, 4, 4, 4, 2, 4, 2" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 2, 2, 2, 2, 2, 2" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "23" + pre1: "4, 4, 4, 2, 4, 4, 4, 2" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 2, 0, 2, 2, 2, 2, 2" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "24" + pre1: "4, 2, 4, 2, 4, 2, 2, 2" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 2, 2, 2, 2, 2, 2" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "25" + pre1: "4, 2, 4, 4, 4, 2, 4, 4" + pre2: "0, 0, 0, -1, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 2, 0, 0, 0, 2, 0, 0" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "26" + pre1: "2, 4, 4, 4, 2, 4, 2, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 1, 0, 0, 0, 0, 1" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 0, 0, 2, 2, 0, 2, 2" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "27" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 2, 2, 2, 0, 2, 0" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "28" + pre1: "4, 2, 4, 2, 4, 4, 4, 2" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 4, 2, 4, 4, 4, 4, 4" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "29" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, -1, 0" + pre3: "0, 1, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "4, 2, 2, 2, 4, 4, 2, 2" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "30" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 0, 2, 2, 2, 2, 0" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + - id: "31" + pre1: "4, 4, 4, 4, 2, 4, 2, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 4, 2, 2, 2, 2, 2, 2" + rx_agctgt: "160, 160, 160, 160, 160, 160, 160, 160" + rx_eye_disq: "150, 150, 150, 150, 150, 150, 150, 150" + rx_eq_c_t: "Low" + rx_eq_f_t: "Low" + sd_rst: "True" + sd_rst_th: "5" + gshape1: "1, 1, 1, 1, 1, 1, 1, 1" + gshape2: "1, 1, 1, 1, 1, 1, 1, 1" + + + - id: "0" + pre1: "4, 4, 4, 4, 2, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 0, 2, 2, 0, 4, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "1" + pre1: "4, 4, 4, 4, 4, 4, 2, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 2, 4, 2, 4, 0, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "2" + pre1: "4, 2, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 2, 0, 4, 2, 2, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "3" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 2, 2, 0, 0, 2, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "4" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, -1, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 2, 0, 0, 0, 4" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "5" + pre1: "4, 4, 4, 4, 4, 4, 2, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 2, 2, 2, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "6" + pre1: "4, 4, 4, 4, 4, 2, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 2, 0, 2, 4, 2, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "7" + pre1: "4, 2, 2, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 0, 2, 2, 0, 0, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "8" + pre1: "4, 4, 4, 4, 4, 4, 2, 4" + pre2: "0, 0, 0, 0, -1, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 0, 2, 0, 2, 4, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "9" + pre1: "4, 2, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, -2, 0, 0, 4, 2, 2, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "10" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 0, 2, 2, 2, 4, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "11" + pre1: "4, 4, 4, 4, 2, 4, 4, 4" + pre2: "0, -1, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "4, 2, 0, 4, 0, 4, 2, 4" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "12" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, -1, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "13" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 2, 0, 0, 4, 2, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "14" + pre1: "2, 4, 4, 2, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, -1" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "4, 0, 0, 2, 2, 4, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "15" + pre1: "4, 4, 4, 2, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 2, 0, 0, 2, 2, 4, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "16" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 2, 0, 0, 4, 4, 2, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "17" + pre1: "4, 4, 2, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, -1, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "4, 4, 2, 2, 4, 4, 4, 4" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "18" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "1, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 0, 2, 0, 4, 4, 2, 4" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "19" + pre1: "4, 4, 4, 4, 4, 4, 2, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "4, 4, 0, 2, 4, 4, 4, 4" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "20" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, -1, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "4, 2, 2, 4, 4, 4, 4, 4" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "21" + pre1: "2, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 4, 2, 0, 2, 2, 2, 4" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "22" + pre1: "4, 2, 4, 4, 2, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 4, 0, 2, 2, 4, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "23" + pre1: "4, 4, 4, 4, 4, 4, 2, 4" + pre2: "0, -1, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 2, 2, 2, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "24" + pre1: "4, 4, 4, 4, 2, 2, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 0, 2, 0, 2, 2, 4" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "25" + pre1: "2, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 2, 0, -2, 0, 0, 2, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "26" + pre1: "2, 4, 4, 4, 4, 2, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 2, 0, 2, 0, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "27" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 1, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 2, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "28" + pre1: "4, 4, 4, 2, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 2, 2, 2, 4, 4, 4" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "29" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, -1, 0, 0, 0" + pre3: "0, -1, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "4, 2, 2, 4, 4, 2, 2, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "30" + pre1: "4, 4, 4, 4, 4, 2, 2, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 2, 0, 2, 2, 2, 2, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "31" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "4, 4, 2, 2, 2, 4, 2, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + + - id: "0" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "1" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "2" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "3" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "4" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "5" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "6" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "7" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "8" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "9" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "10" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "11" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "12" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "13" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "14" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "15" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "16" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "17" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "18" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "19" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "20" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "21" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "22" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "23" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "24" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "25" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "26" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "27" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "28" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "29" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "30" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "31" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + + - id: "0" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "1" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "2" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "3" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "4" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "5" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "6" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "7" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "8" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "9" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "10" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "11" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "12" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "13" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "14" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "15" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "16" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "17" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "18" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "19" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "20" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "21" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "22" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "23" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "24" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "25" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "26" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "27" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "28" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "29" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "30" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + - id: "31" + pre1: "0, 0, 0, 0, 0, 0, 0, 0" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "10, 10, 10, 10, 10, 10, 10, 10" + rx_ctle_bw: "10, 10, 10, 10, 10, 10, 10, 10" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "2, 2, 2, 2, 2, 2, 2, 2" + + - id: "0" + pre1: "4, 4, 4, 4, 2, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 0, 2, 2, 0, 4, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "1" + pre1: "4, 4, 4, 4, 4, 4, 2, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 2, 4, 2, 4, 0, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "2" + pre1: "4, 2, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 2, 0, 4, 2, 2, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "3" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 2, 2, 0, 0, 2, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "4" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, -1, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 2, 0, 0, 0, 4" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "5" + pre1: "4, 4, 4, 4, 4, 4, 2, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 2, 2, 2, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "6" + pre1: "4, 4, 4, 4, 4, 2, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 2, 0, 2, 4, 2, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "7" + pre1: "4, 2, 2, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 0, 2, 2, 0, 0, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "8" + pre1: "4, 4, 4, 4, 4, 4, 2, 4" + pre2: "0, 0, 0, 0, -1, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 0, 2, 0, 2, 4, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "9" + pre1: "4, 2, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, -2, 0, 0, 4, 2, 2, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "10" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 0, 2, 2, 2, 4, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "11" + pre1: "4, 4, 4, 4, 2, 4, 4, 4" + pre2: "0, -1, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "4, 2, 0, 4, 0, 4, 2, 4" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "12" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, -1, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 0, 0, 0, 0, 0, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "13" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 2, 0, 0, 4, 2, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "14" + pre1: "2, 4, 4, 2, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, -1" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "4, 0, 0, 2, 2, 4, 0, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "15" + pre1: "4, 4, 4, 2, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 2, 0, 0, 2, 2, 4, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "16" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 2, 0, 0, 4, 4, 2, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "17" + pre1: "4, 4, 2, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, -1, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "4, 4, 2, 2, 4, 4, 4, 4" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "18" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "1, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 0, 2, 0, 4, 4, 2, 4" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "19" + pre1: "4, 4, 4, 4, 4, 4, 2, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "4, 4, 0, 2, 4, 4, 4, 4" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "20" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, -1, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "4, 2, 2, 4, 4, 4, 4, 4" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "21" + pre1: "2, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 4, 2, 0, 2, 2, 2, 4" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "22" + pre1: "4, 2, 4, 4, 2, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 4, 0, 2, 2, 4, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "23" + pre1: "4, 4, 4, 4, 4, 4, 2, 4" + pre2: "0, -1, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 0, 2, 2, 2, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "24" + pre1: "4, 4, 4, 4, 2, 2, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 0, 2, 0, 2, 2, 4" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "25" + pre1: "2, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 2, 0, -2, 0, 0, 2, 0" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "26" + pre1: "2, 4, 4, 4, 4, 2, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 0, 0, 2, 0, 2, 0, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "27" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 1, 0, 0, 0" + post: "0, 0, 0, 0, 0, 0, 2, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "28" + pre1: "4, 4, 4, 2, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "2, 2, 2, 2, 2, 4, 4, 4" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "29" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, -1, 0, 0, 0" + pre3: "0, -1, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "4, 2, 2, 4, 4, 2, 2, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "30" + pre1: "4, 4, 4, 4, 4, 2, 2, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "0, 2, 0, 2, 2, 2, 2, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" + - id: "31" + pre1: "4, 4, 4, 4, 4, 4, 4, 4" + pre2: "0, 0, 0, 0, 0, 0, 0, 0" + pre3: "0, 0, 0, 0, 0, 0, 0, 0" + attn: "0, 0, 0, 0, 0, 0, 0, 0" + post: "4, 4, 2, 2, 2, 4, 2, 2" + rx_eq_c_t: "Medium" + rx_eq_f_t: "High" + rx_ctle_lf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_hf: "0, 0, 0, 0, 0, 0, 0, 0" + rx_ctle_bw: "0, 0, 0, 0, 0, 0, 0, 0" + gshape1: "0, 0, 0, 0, 0, 0, 0, 0" + gshape2: "0, 0, 0, 0, 0, 0, 0, 0" diff --git a/device/wistron/x86_64-wistron_sw_to3200k-r0/topo.conf b/device/wistron/x86_64-wistron_sw_to3200k-r0/topo.conf new file mode 100644 index 0000000000..795ea43143 --- /dev/null +++ b/device/wistron/x86_64-wistron_sw_to3200k-r0/topo.conf @@ -0,0 +1 @@ +t1 diff --git a/platform/innovium/one-image.mk b/platform/innovium/one-image.mk index daf38d9d86..bf857404fb 100755 --- a/platform/innovium/one-image.mk +++ b/platform/innovium/one-image.mk @@ -7,6 +7,8 @@ $(SONIC_ONE_IMAGE)_INSTALLS += $(SYSTEMD_SONIC_GENERATOR) $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(CEL_MIDSTONE_200I_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(DELTA_ETC032IF_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(DELTA_EVSA32Q56_PLATFORM_MODULE) +$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(CAMEO_ESC601_32Q_PLATFORM_MODULE) $(CAMEO_ESC600_128Q_PLATFORM_MODULE) $(CAMEO_ESQC610_56SQ_PLATFORM_MODULE) $(CAMEO_ESC602_32Q_PLATFORM_MODULE) +$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(WISTRON_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_INSTALLS += $(INVM_DRV) $(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) diff --git a/platform/innovium/platform-modules-cameo.mk b/platform/innovium/platform-modules-cameo.mk new file mode 100755 index 0000000000..8e1ddffd5c --- /dev/null +++ b/platform/innovium/platform-modules-cameo.mk @@ -0,0 +1,30 @@ + +CAMEO_ESC601_32Q_PLATFORM_MODULE_VERSION = 1.0.0 +CAMEO_ESC600_128Q_PLATFORM_MODULE_VERSION = 1.0.0 +CAMEO_ESQC610_56SQ_PLATFORM_MODULE_VERSION = 1.0.0 +CAMEO_ESC602_32Q_PLATFORM_MODULE_VERSION = 1.0.0 + +export CAMEO_ESC601_32Q_PLATFORM_MODULE_VERSION +export CAMEO_ESC600_128Q_PLATFORM_MODULE_VERSION +export CAMEO_ESQC610_56SQ_PLATFORM_MODULE_VERSION +export CAMEO_ESC602_32Q_PLATFORM_MODULE_VERSION + +CAMEO_ESC601_32Q_PLATFORM_MODULE = sonic-platform-cameo-esc601-32q_$(CAMEO_ESC601_32Q_PLATFORM_MODULE_VERSION)_amd64.deb +$(CAMEO_ESC601_32Q_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-cameo +$(CAMEO_ESC601_32Q_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) +$(CAMEO_ESC601_32Q_PLATFORM_MODULE)_PLATFORM = x86_64-cameo_esc601_32q-r0 +SONIC_DPKG_DEBS += $(CAMEO_ESC601_32Q_PLATFORM_MODULE) + +CAMEO_ESC600_128Q_PLATFORM_MODULE = sonic-platform-cameo-esc600-128q_$(CAMEO_ESC600_128Q_PLATFORM_MODULE_VERSION)_amd64.deb +$(CAMEO_ESC600_128Q_PLATFORM_MODULE)_PLATFORM = x86_64-cameo_esc600_128q-r0 +$(eval $(call add_extra_package,$(CAMEO_ESC601_32Q_PLATFORM_MODULE),$(CAMEO_ESC600_128Q_PLATFORM_MODULE))) + +CAMEO_ESQC610_56SQ_PLATFORM_MODULE = sonic-platform-cameo-esqc610-56sq_$(CAMEO_ESQC610_56SQ_PLATFORM_MODULE_VERSION)_amd64.deb +$(CAMEO_ESQC610_56SQ_PLATFORM_MODULE)_PLATFORM = x86_64-cameo_esqc610_56sq-r0 +$(eval $(call add_extra_package,$(CAMEO_ESC601_32Q_PLATFORM_MODULE),$(CAMEO_ESQC610_56SQ_PLATFORM_MODULE))) + +CAMEO_ESC602_32Q_PLATFORM_MODULE = sonic-platform-cameo-esc602-32q_$(CAMEO_ESC602_32Q_PLATFORM_MODULE_VERSION)_amd64.deb +$(CAMEO_ESC602_32Q_PLATFORM_MODULE)_PLATFORM = x86_64-cameo_esc602_32q-r0 +$(eval $(call add_extra_package,$(CAMEO_ESC601_32Q_PLATFORM_MODULE),$(CAMEO_ESC602_32Q_PLATFORM_MODULE))) + +SONIC_STRETCH_DEBS +=$(CAMEO_ESC601_32Q_PLATFORM_MODULE) diff --git a/platform/innovium/platform-modules-wistron.mk b/platform/innovium/platform-modules-wistron.mk new file mode 100755 index 0000000000..24c333d10f --- /dev/null +++ b/platform/innovium/platform-modules-wistron.mk @@ -0,0 +1,13 @@ +# Wistron Platform modules + +WISTRON_PLATFORM_MODULE_VERSION = 1.1 + +export WISTRON_PLATFORM_MODULE_VERSION + +WISTRON_PLATFORM_MODULE = sonic-platform-wistron-sw-to3200k_$(WISTRON_PLATFORM_MODULE_VERSION)_amd64.deb +$(WISTRON_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-wistron +$(WISTRON_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) +$(WISTRON_PLATFORM_MODULE)_PLATFORM = x86_64-wistron_sw_to3200k-r0 + +SONIC_DPKG_DEBS += $(WISTRON_PLATFORM_MODULE) +SONIC_STRETCH_DEBS += $(WISTRON_PLATFORM_MODULE) diff --git a/platform/innovium/rules.mk b/platform/innovium/rules.mk index 6317cb23b6..fc87e1b731 100755 --- a/platform/innovium/rules.mk +++ b/platform/innovium/rules.mk @@ -1,6 +1,8 @@ include $(PLATFORM_PATH)/invm-sai.mk include $(PLATFORM_PATH)/platform-modules-cel.mk include $(PLATFORM_PATH)/platform-modules-delta.mk +include $(PLATFORM_PATH)/platform-modules-cameo.mk +include $(PLATFORM_PATH)/platform-modules-wistron.mk include $(PLATFORM_PATH)/docker-syncd-invm.mk include $(PLATFORM_PATH)/docker-syncd-invm-rpc.mk include $(PLATFORM_PATH)/one-image.mk @@ -13,7 +15,7 @@ SONIC_ALL += $(SONIC_INVM_ONE_IMAGE) \ $(DOCKER_SYNCD_INVM_RPC) # Inject invm sai into syncd -$(SYNCD)_DEPENDS += $(INVM_HSAI) $(INVM_LIBSAI) $(LIBSAITHRIFT_DEV_INVM) +$(SYNCD)_DEPENDS += $(INVM_HSAI) $(INVM_LIBSAI) $(LIBSAITHRIFT_DEV) $(SYNCD)_UNINSTALLS += $(INVM_HSAI) # Runtime dependency on invm sai is set only for syncd diff --git a/platform/innovium/sonic-platform-modules-cameo/README.md b/platform/innovium/sonic-platform-modules-cameo/README.md new file mode 100644 index 0000000000..0f11efdc8a --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/README.md @@ -0,0 +1 @@ +platform drivers of Cameo products for the SONiC project diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/credo_baldeagle/bin/credo_auto1357.sh b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/credo_baldeagle/bin/credo_auto1357.sh new file mode 100755 index 0000000000..bbf8bdc59d --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/credo_baldeagle/bin/credo_auto1357.sh @@ -0,0 +1,55 @@ +BALDEAGLESDK_100G_EXE="/usr/local/bin/BaldEagleSdk_v2_12_00_20190715_cameo_gearbox.py" +BALDEAGLESDK_400G_EXE="/usr/local/bin/BaldEagleSdk_v2_14_18.py" + +EXE1=$BALDEAGLESDK_100G_EXE +EXE3=$BALDEAGLESDK_100G_EXE +EXE5=$BALDEAGLESDK_100G_EXE +EXE7=$BALDEAGLESDK_100G_EXE + +# credo_auto1357.sh x x x x +# x: type of PHY module, 1 = 100G, 2 = 400G, 0 = don't init +if [ $# -ne 4 ]; then + echo "invalid parameter" + exit 1 +fi + +for var in $1 $2 $3 $4 +do + if [ $var -lt 0 ] || [ $var -gt 2 ]; then + echo "invalid parameter" + exit 1 + fi +done + +if [ $1 -eq 2 ]; then + EXE1=$BALDEAGLESDK_400G_EXE +fi +if [ $2 -eq 2 ]; then + EXE3=$BALDEAGLESDK_400G_EXE +fi +if [ $3 -eq 2 ]; then + EXE5=$BALDEAGLESDK_400G_EXE +fi +if [ $4 -eq 2 ]; then + EXE7=$BALDEAGLESDK_400G_EXE +fi + +d1=$(date +"%s") +#long action here +if [ $1 -ne 0 ]; then + python $EXE1 1 & +fi +if [ $2 -ne 0 ]; then + python $EXE3 3 & +fi +if [ $3 -ne 0 ]; then + python $EXE5 5 & +fi +if [ $4 -ne 0 ]; then + python $EXE7 7 & +fi +wait + +echo "All Process Done" +d2=$(date +"%s") +echo $((d2-d1))"sec" diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/credo_baldeagle/bin/credo_auto2468.sh b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/credo_baldeagle/bin/credo_auto2468.sh new file mode 100755 index 0000000000..b0463064ce --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/credo_baldeagle/bin/credo_auto2468.sh @@ -0,0 +1,56 @@ +BALDEAGLESDK_100G_EXE="/usr/local/bin/BaldEagleSdk_v2_12_00_20190715_cameo_gearbox.py" +BALDEAGLESDK_400G_EXE="/usr/local/bin/BaldEagleSdk_v2_14_18.py" + +EXE2=$BALDEAGLESDK_100G_EXE +EXE4=$BALDEAGLESDK_100G_EXE +EXE6=$BALDEAGLESDK_100G_EXE +EXE8=$BALDEAGLESDK_100G_EXE + +# credo_auto2468.sh x x x x +# x: type of PHY module, 1 = 100G, 2 = 400G, 0 = don't init +if [ $# -ne 4 ]; then + echo "invalid parameter" + exit 1 +fi + +for var in $1 $2 $3 $4 +do + if [ $var -lt 0 ] || [ $var -gt 2 ]; then + echo "invalid parameter" + exit 1 + fi +done + +if [ $1 -eq 2 ]; then + EXE2=$BALDEAGLESDK_400G_EXE +fi +if [ $2 -eq 2 ]; then + EXE4=$BALDEAGLESDK_400G_EXE +fi +if [ $3 -eq 2 ]; then + EXE6=$BALDEAGLESDK_400G_EXE +fi +if [ $4 -eq 2 ]; then + EXE8=$BALDEAGLESDK_400G_EXE +fi + +d1=$(date +"%s") +#long action here +if [ $1 -ne 0 ]; then + python $EXE2 2 & +fi +if [ $2 -ne 0 ]; then + python $EXE4 4 & +fi +if [ $3 -ne 0 ]; then + python $EXE6 6 & +fi +if [ $4 -ne 0 ]; then + python $EXE8 8 & +fi +wait + +echo "All Process Done" +d2=$(date +"%s") +echo $((d2-d1))"sec" + diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/credo_baldeagle/bin/credo_auto_init_all.sh b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/credo_baldeagle/bin/credo_auto_init_all.sh new file mode 100755 index 0000000000..6d1122e8dd --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/credo_baldeagle/bin/credo_auto_init_all.sh @@ -0,0 +1,11 @@ +d1=$(date +"%s") +#long action here +i2cset -y 0 0x30 0xa2 0x0 +sleep 1 +i2cset -y 0 0x30 0xa2 0xff +sleep 1 +./credo_auto1357.sh +./credo_auto2468.sh +echo "All Slots Done" +d2=$(date +"%s") +echo $((d2-d1))"sec" diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/credo_baldeagle/credo_sdk_fw/BE.fw.2.15.04.bin b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/credo_baldeagle/credo_sdk_fw/BE.fw.2.15.04.bin new file mode 100644 index 0000000000..95dfd60919 Binary files /dev/null and b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/credo_baldeagle/credo_sdk_fw/BE.fw.2.15.04.bin differ diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/credo_baldeagle/credo_sdk_fw/BE2.fw.2.14.18.bin b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/credo_baldeagle/credo_sdk_fw/BE2.fw.2.14.18.bin new file mode 100644 index 0000000000..f1dffbf5f2 Binary files /dev/null and b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/credo_baldeagle/credo_sdk_fw/BE2.fw.2.14.18.bin differ diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/credo_baldeagle/credo_sdk_fw/BE2.fw.2.15.04.bin b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/credo_baldeagle/credo_sdk_fw/BE2.fw.2.15.04.bin new file mode 100644 index 0000000000..ac21b40645 Binary files /dev/null and b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/credo_baldeagle/credo_sdk_fw/BE2.fw.2.15.04.bin differ diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/credo_baldeagle/lib/libcameo_mdio.so b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/credo_baldeagle/lib/libcameo_mdio.so new file mode 100755 index 0000000000..1ce1cf53b5 Binary files /dev/null and b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/credo_baldeagle/lib/libcameo_mdio.so differ diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/credo_baldeagle/python_wheel/BaldEagleSdk_v2_12_00_20190715_cameo_gearbox.pyc b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/credo_baldeagle/python_wheel/BaldEagleSdk_v2_12_00_20190715_cameo_gearbox.pyc new file mode 100644 index 0000000000..a2dedaf441 Binary files /dev/null and b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/credo_baldeagle/python_wheel/BaldEagleSdk_v2_12_00_20190715_cameo_gearbox.pyc differ diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/credo_baldeagle/python_wheel/BaldEagleSdk_v2_14_18.pyc b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/credo_baldeagle/python_wheel/BaldEagleSdk_v2_14_18.pyc new file mode 100644 index 0000000000..46da76c30e Binary files /dev/null and b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/credo_baldeagle/python_wheel/BaldEagleSdk_v2_14_18.pyc differ diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/credo_baldeagle/python_wheel/__init__.py b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/credo_baldeagle/python_wheel/__init__.py new file mode 100755 index 0000000000..e69de29bb2 diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/credo_baldeagle/python_wheel/baldeagle_eagle_reg.pyc b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/credo_baldeagle/python_wheel/baldeagle_eagle_reg.pyc new file mode 100644 index 0000000000..a6e5aab951 Binary files /dev/null and b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/credo_baldeagle/python_wheel/baldeagle_eagle_reg.pyc differ diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/credo_baldeagle/python_wheel/baldeagle_phoenix_reg.pyc b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/credo_baldeagle/python_wheel/baldeagle_phoenix_reg.pyc new file mode 100644 index 0000000000..8e7e9d139f Binary files /dev/null and b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/credo_baldeagle/python_wheel/baldeagle_phoenix_reg.pyc differ diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/modules/Ioctl.h b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/modules/Ioctl.h new file mode 100644 index 0000000000..9e78d5835c --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/modules/Ioctl.h @@ -0,0 +1,150 @@ +/* + * COPYRIGHT (c) 2007 by Lattice Semiconductor Corporation + * + * All rights reserved. All use of this software and documentation is + * subject to the License Agreement located in the file LICENSE. + */ +/** + * @file + * + * Define Data structures and ioctl commands to pass between the driver + * and the user space. The definitions serve as the interface between + * the kernel and user. + * + * NOTE: This file is included in source code built for the kernel and user. + * It must be kept compatible with both environments. + * In particular, structure definitions can not be changed in one space without + * recompiling the code in the other space. + */ + +#ifndef LATTICE_SEMI_PCIE_LSC_IOCTL_H +#define LATTICE_SEMI_PCIE_LSC_IOCTL_H + +#include + +#include "sysDefs.h" +#include +#ifndef MAX_PCI_BARS +#define MAX_PCI_BARS 7 // do not count/use the expansion ROM +#endif + +#define MAX_DRIVER_NAME_LEN 128 +#define MAX_DRIVER_VERSION_LEN 128 + + + +typedef char DriverVerStr_t[MAX_DRIVER_NAME_LEN]; + + + +/** + * Information about a device's BAR. + */ +typedef struct +{ + ULONG nBAR; + ULONG physStartAddr; + ULONG size; + bool memMapped; + USHORT flags; + UCHAR type; + +} PCI_BAR_t; + + +/** + * Device Drvier specific information to return to user space. + * This includes the BAR resources allocated to the device, + * interrupts, etc. + * NOTE: to keep backwards compatibility with older applications + * that were built against v1.0.0.x drivers, do no add any new + * fields to this structure or the driver will crash during + * copying info back to user pages because the size will be different + * and a fault will occur. Add new fields to the extra info struct. + */ +typedef struct +{ + // Device Memory Access info + ULONG numBARs; + PCI_BAR_t BAR[MAX_PCI_BARS]; + + UCHAR PCICfgReg[256]; + + // Device Interrupt Info + bool hasInterrupt; + ULONG intrVector; + +} PCIResourceInfo_t; + + +/** + * Additional Device Driver specific information to return to user space. + * This includes the DMA resources allocated to the device, interrupts, etc. + * This is for the newer PCIeBasic and PCIeSFIF demos and applications. + */ +typedef struct +{ + // Instance and device location info + ULONG devID; /**< board number of specific device */ + + ULONG busNum; /**< PCI bus number board located on */ + USHORT deviceNum; /**< PCI device number assigned to board */ + USHORT functionNum; /**< our function number, which is always 0 (no multi-function */ + ULONG UINumber; /**< motherboard slot number (not always implemented/valid) */ + + // Device DMA Common buffer memory info + bool hasDmaBuf; /**< true if DMA buffer has been allocated by driver */ + ULONG DmaBufSize; /**< size in bytes of said buffer */ + bool DmaAddr64; /**< true if the address mode is 64 bit (almost always 32 bit) */ + ULONG DmaPhyAddrHi; /**< Upper 32 bits of 64 bit address for 64 bit mode */ + ULONG DmaPhyAddrLo; /**< DMA bus address to be programmed into device */ + + + char DriverName[MAX_DRIVER_NAME_LEN]; /**< version and name compiled into driver */ + + +} ExtraResourceInfo_t; + + + +/** + * IOCTL Operations. + * use these defines when performing an ioctl operation to a device. + */ + +#define LSCPCIE_MAGIC 'L' + +/** This IO_CTL is used to get PCI driver name and version + * back to user space applications. + */ +#define IOCTL_LSCPCIE_GET_VERSION_INFO _IOR(LSCPCIE_MAGIC, 0, DriverVerStr_t) + + +/** This IO_CTL is used to get PCI and driver information from the + * driver back to user space applications. + */ +#define IOCTL_LSCPCIE_GET_RESOURCES _IOR(LSCPCIE_MAGIC, 1, PCIResourceInfo_t) + +/** + * This IO_CTL is used to set the BAR number that is mapped in with the MMAP command. + */ +#define IOCTL_LSCPCIE_SET_BAR _IOW(LSCPCIE_MAGIC, 2, int) + +/** This IO_CTL is used to get additional information from the + * driver back to user space applications. This info is used by the SFIF. + */ +#define IOCTL_LSCPCIE2_GET_EXTRA_INFO _IOR(LSCPCIE_MAGIC, 3, ExtraResourceInfo_t) + + +/** + * Controls to support future user space handling of interrupts. + * Not implemented yet. + */ +#define IOCTL_LSCPCIE2_WAIT_FOR_INTERRUPT _IO(LSCPCIE_MAGIC, 4) +#define IOCTL_LSCPCIE2_DISABLE_INTERRUPT _IO(LSCPCIE_MAGIC, 5) + + +#define IOCTL_LSCPCIE_MAX_NR 5 // ^^^^^^must match last entry above^^^^^^^ + + +#endif diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/modules/Makefile b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/modules/Makefile new file mode 100644 index 0000000000..e509f75c25 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/modules/Makefile @@ -0,0 +1 @@ +obj-m := x86-64-cameo-esc600-128q.o nct7511.o mcp3425_smbus.o at24_smbus.o zrh2800k2.o tps40425.o powr1014.o phy_cpld640.o lscpcie2.o diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/modules/at24_smbus.c b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/modules/at24_smbus.c new file mode 100644 index 0000000000..56dd8ca1d3 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/modules/at24_smbus.c @@ -0,0 +1,849 @@ +/* + * at24.c - handle most I2C EEPROMs + * + * Copyright (C) 2005-2007 David Brownell + * Copyright (C) 2008 Wolfram Sang, Pengutronix + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * I2C EEPROMs from most vendors are inexpensive and mostly interchangeable. + * Differences between different vendor product lines (like Atmel AT24C or + * MicroChip 24LC, etc) won't much matter for typical read/write access. + * There are also I2C RAM chips, likewise interchangeable. One example + * would be the PCF8570, which acts like a 24c02 EEPROM (256 bytes). + * + * However, misconfiguration can lose data. "Set 16-bit memory address" + * to a part with 8-bit addressing will overwrite data. Writing with too + * big a page size also loses data. And it's not safe to assume that the + * conventional addresses 0x50..0x57 only hold eeproms; a PCF8563 RTC + * uses 0x51, for just one example. + * + * Accordingly, explicit board-specific configuration data should be used + * in almost all cases. (One partial exception is an SMBus used to access + * "SPD" data for DRAM sticks. Those only use 24c02 EEPROMs.) + * + * So this driver uses "new style" I2C driver binding, expecting to be + * told what devices exist. That may be in arch/X/mach-Y/board-Z.c or + * similar kernel-resident tables; or, configuration data coming from + * a bootloader. + * + * Other than binding model, current differences from "eeprom" driver are + * that this one handles write access and isn't restricted to 24c02 devices. + * It also handles larger devices (32 kbit and up) with two-byte addresses, + * which won't work on pure SMBus systems. + */ + +struct at24_data { + struct at24_platform_data chip; + int use_smbus; + int use_smbus_write; + + ssize_t (*read_func)(struct at24_data *, char *, unsigned int, size_t); + ssize_t (*write_func)(struct at24_data *, + const char *, unsigned int, size_t); + + /* + * Lock protects against activities from other Linux tasks, + * but not from changes by other I2C masters. + */ + struct mutex lock; + + u8 *writebuf; + unsigned write_max; + unsigned num_addresses; + + struct nvmem_config nvmem_config; + struct nvmem_device *nvmem; + + /* + * Some chips tie up multiple I2C addresses; dummy devices reserve + * them for us, and we'll use them with SMBus calls. + */ + struct i2c_client *client[]; +}; + +/* + * This parameter is to help this driver avoid blocking other drivers out + * of I2C for potentially troublesome amounts of time. With a 100 kHz I2C + * clock, one 256 byte read takes about 1/43 second which is excessive; + * but the 1/170 second it takes at 400 kHz may be quite reasonable; and + * at 1 MHz (Fm+) a 1/430 second delay could easily be invisible. + * + * This value is forced to be a power of two so that writes align on pages. + */ +static unsigned io_limit = 128; +module_param(io_limit, uint, 0); +MODULE_PARM_DESC(io_limit, "Maximum bytes per I/O (default 128)"); + +/* + * Specs often allow 5 msec for a page write, sometimes 20 msec; + * it's important to recover from write timeouts. + */ +static unsigned write_timeout = 25; +module_param(write_timeout, uint, 0); +MODULE_PARM_DESC(write_timeout, "Time (in ms) to try writes (default 25)"); + +#define AT24_SIZE_BYTELEN 5 +#define AT24_SIZE_FLAGS 8 + +#define AT24_BITMASK(x) (BIT(x) - 1) + +/* create non-zero magic value for given eeprom parameters */ +#define AT24_DEVICE_MAGIC(_len, _flags) \ + ((1 << AT24_SIZE_FLAGS | (_flags)) \ + << AT24_SIZE_BYTELEN | ilog2(_len)) + +/* + * Both reads and writes fail if the previous write didn't complete yet. This + * macro loops a few times waiting at least long enough for one entire page + * write to work while making sure that at least one iteration is run before + * checking the break condition. + * + * It takes two parameters: a variable in which the future timeout in jiffies + * will be stored and a temporary variable holding the time of the last + * iteration of processing the request. Both should be unsigned integers + * holding at least 32 bits. + */ +#define loop_until_timeout(tout, op_time) \ + for (tout = jiffies + msecs_to_jiffies(write_timeout), op_time = 0; \ + op_time ? time_before(op_time, tout) : true; \ + usleep_range(1000, 1500), op_time = jiffies) + +static const struct i2c_device_id at24_ids[] = { + { "24c64smbus", AT24_DEVICE_MAGIC(65536 / 8, AT24_FLAG_ADDR16) }, + { "24c08smbus", AT24_DEVICE_MAGIC(8192 / 8, 0) }, + { "24c04smbus", AT24_DEVICE_MAGIC(4096 / 8, 0) }, + { /* END OF LIST */ } +}; +MODULE_DEVICE_TABLE(i2c, at24_ids); + +static const struct acpi_device_id at24_acpi_ids[] = { + { "INT3499", AT24_DEVICE_MAGIC(8192 / 8, 0) }, + { } +}; +MODULE_DEVICE_TABLE(acpi, at24_acpi_ids); + +/*-------------------------------------------------------------------------*/ + +/* + * This routine supports chips which consume multiple I2C addresses. It + * computes the addressing information to be used for a given r/w request. + * Assumes that sanity checks for offset happened at sysfs-layer. + * + * Slave address and byte offset derive from the offset. Always + * set the byte address; on a multi-master board, another master + * may have changed the chip's "current" address pointer. + * + * REVISIT some multi-address chips don't rollover page reads to + * the next slave address, so we may need to truncate the count. + * Those chips might need another quirk flag. + * + * If the real hardware used four adjacent 24c02 chips and that + * were misconfigured as one 24c08, that would be a similar effect: + * one "eeprom" file not four, but larger reads would fail when + * they crossed certain pages. + */ +static struct i2c_client *at24_translate_offset(struct at24_data *at24, + unsigned int *offset) +{ + unsigned i; + + if (at24->chip.flags & AT24_FLAG_ADDR16) { + i = *offset >> 16; + *offset &= 0xffff; + } else { + i = *offset >> 8; + *offset &= 0xff; + } + + return at24->client[i]; +} + +static ssize_t at24_eeprom_read_smbus(struct at24_data *at24, char *buf, + unsigned int offset, size_t count) +{ + unsigned long timeout, read_time; + struct i2c_client *client; + int status,i,j; + + client = at24_translate_offset(at24, &offset); + + if (count > io_limit) + count = io_limit; + /* Smaller eeproms can work given some SMBus extension calls */ + if (count > I2C_SMBUS_BLOCK_MAX) + count = I2C_SMBUS_BLOCK_MAX; + + if(at24->chip.flags & AT24_FLAG_ADDR16){ + + + status = i2c_smbus_write_byte_data(client, offset>>8, + offset&0xff); + if(status < 0) + return status; + + mdelay(7); + for (i = 0; i < count; i++) { + j = i2c_smbus_read_byte(client); + if (j < 0) { + return j; + } + buf[i] = j; + } + return count; + + }else{ + + loop_until_timeout(timeout, read_time) { + status = i2c_smbus_read_i2c_block_data_or_emulated(client, + offset, + count, buf); + + dev_dbg(&client->dev, "read %zu@%d --> %d (%ld)\n", + count, offset, status, jiffies); + + if (status == count) + return count; + } + } + return -ETIMEDOUT; +} + +static ssize_t at24_eeprom_read_i2c(struct at24_data *at24, char *buf, + unsigned int offset, size_t count) +{ + unsigned long timeout, read_time; + struct i2c_client *client; + struct i2c_msg msg[2]; + int status, i; + u8 msgbuf[2]; + + memset(msg, 0, sizeof(msg)); + client = at24_translate_offset(at24, &offset); + + if (count > io_limit) + count = io_limit; + + /* + * When we have a better choice than SMBus calls, use a combined I2C + * message. Write address; then read up to io_limit data bytes. Note + * that read page rollover helps us here (unlike writes). msgbuf is + * u8 and will cast to our needs. + */ + i = 0; + if (at24->chip.flags & AT24_FLAG_ADDR16) + msgbuf[i++] = offset >> 8; + msgbuf[i++] = offset; + + msg[0].addr = client->addr; + msg[0].buf = msgbuf; + msg[0].len = i; + + msg[1].addr = client->addr; + msg[1].flags = I2C_M_RD; + msg[1].buf = buf; + msg[1].len = count; + + loop_until_timeout(timeout, read_time) { + status = i2c_transfer(client->adapter, msg, 2); + if (status == 2) + status = count; + + dev_dbg(&client->dev, "read %zu@%d --> %d (%ld)\n", + count, offset, status, jiffies); + + if (status == count) + return count; + } + + return -ETIMEDOUT; +} + +static ssize_t at24_eeprom_read_serial(struct at24_data *at24, char *buf, + unsigned int offset, size_t count) +{ + unsigned long timeout, read_time; + struct i2c_client *client; + struct i2c_msg msg[2]; + u8 addrbuf[2]; + int status; + + client = at24_translate_offset(at24, &offset); + + memset(msg, 0, sizeof(msg)); + msg[0].addr = client->addr; + msg[0].buf = addrbuf; + + /* + * The address pointer of the device is shared between the regular + * EEPROM array and the serial number block. The dummy write (part of + * the sequential read protocol) ensures the address pointer is reset + * to the desired position. + */ + if (at24->chip.flags & AT24_FLAG_ADDR16) { + /* + * For 16 bit address pointers, the word address must contain + * a '10' sequence in bits 11 and 10 regardless of the + * intended position of the address pointer. + */ + addrbuf[0] = 0x08; + addrbuf[1] = offset; + msg[0].len = 2; + } else { + /* + * Otherwise the word address must begin with a '10' sequence, + * regardless of the intended address. + */ + addrbuf[0] = 0x80 + offset; + msg[0].len = 1; + } + + msg[1].addr = client->addr; + msg[1].flags = I2C_M_RD; + msg[1].buf = buf; + msg[1].len = count; + + loop_until_timeout(timeout, read_time) { + status = i2c_transfer(client->adapter, msg, 2); + if (status == 2) + return count; + } + + return -ETIMEDOUT; +} + +static ssize_t at24_eeprom_read_mac(struct at24_data *at24, char *buf, + unsigned int offset, size_t count) +{ + unsigned long timeout, read_time; + struct i2c_client *client; + struct i2c_msg msg[2]; + u8 addrbuf[2]; + int status; + + client = at24_translate_offset(at24, &offset); + + memset(msg, 0, sizeof(msg)); + msg[0].addr = client->addr; + msg[0].buf = addrbuf; + /* EUI-48 starts from 0x9a, EUI-64 from 0x98 */ + addrbuf[0] = 0xa0 - at24->chip.byte_len + offset; + msg[0].len = 1; + msg[1].addr = client->addr; + msg[1].flags = I2C_M_RD; + msg[1].buf = buf; + msg[1].len = count; + + loop_until_timeout(timeout, read_time) { + status = i2c_transfer(client->adapter, msg, 2); + if (status == 2) + return count; + } + + return -ETIMEDOUT; +} + +/* + * Note that if the hardware write-protect pin is pulled high, the whole + * chip is normally write protected. But there are plenty of product + * variants here, including OTP fuses and partial chip protect. + * + * We only use page mode writes; the alternative is sloooow. These routines + * write at most one page. + */ + +static size_t at24_adjust_write_count(struct at24_data *at24, + unsigned int offset, size_t count) +{ + unsigned next_page; + + /* write_max is at most a page */ + if (count > at24->write_max) + count = at24->write_max; + + /* Never roll over backwards, to the start of this page */ + next_page = roundup(offset + 1, at24->chip.page_size); + if (offset + count > next_page) + count = next_page - offset; + + return count; +} + +static ssize_t at24_eeprom_write_smbus_block(struct at24_data *at24, + const char *buf, + unsigned int offset, size_t count) +{ + unsigned long timeout, write_time; + struct i2c_client *client; + ssize_t status = 0; + + client = at24_translate_offset(at24, &offset); + count = at24_adjust_write_count(at24, offset, count); + + loop_until_timeout(timeout, write_time) { + status = i2c_smbus_write_i2c_block_data(client, + offset, count, buf); + if (status == 0) + status = count; + + dev_dbg(&client->dev, "write %zu@%d --> %zd (%ld)\n", + count, offset, status, jiffies); + + if (status == count) + return count; + } + + return -ETIMEDOUT; +} + +static ssize_t at24_eeprom_write_smbus_byte(struct at24_data *at24, + const char *buf, + unsigned int offset, size_t count) +{ + unsigned long timeout, write_time; + struct i2c_client *client; + ssize_t status = 0; + + client = at24_translate_offset(at24, &offset); + + loop_until_timeout(timeout, write_time) { + status = i2c_smbus_write_byte_data(client, offset, buf[0]); + if (status == 0) + status = count; + + dev_dbg(&client->dev, "write %zu@%d --> %zd (%ld)\n", + count, offset, status, jiffies); + + if (status == count) + return count; + } + + return -ETIMEDOUT; +} + +static ssize_t at24_eeprom_write_i2c(struct at24_data *at24, const char *buf, + unsigned int offset, size_t count) +{ + unsigned long timeout, write_time; + struct i2c_client *client; + struct i2c_msg msg; + ssize_t status = 0; + int i = 0; + + client = at24_translate_offset(at24, &offset); + count = at24_adjust_write_count(at24, offset, count); + + msg.addr = client->addr; + msg.flags = 0; + + /* msg.buf is u8 and casts will mask the values */ + msg.buf = at24->writebuf; + if (at24->chip.flags & AT24_FLAG_ADDR16) + msg.buf[i++] = offset >> 8; + + msg.buf[i++] = offset; + memcpy(&msg.buf[i], buf, count); + msg.len = i + count; + + loop_until_timeout(timeout, write_time) { + status = i2c_transfer(client->adapter, &msg, 1); + if (status == 1) + status = count; + + dev_dbg(&client->dev, "write %zu@%d --> %zd (%ld)\n", + count, offset, status, jiffies); + + if (status == count) + return count; + } + + return -ETIMEDOUT; +} + +static int at24_read(void *priv, unsigned int off, void *val, size_t count) +{ + struct at24_data *at24 = priv; + char *buf = val; + + if (unlikely(!count)) + return count; + + if (off + count > at24->chip.byte_len) + return -EINVAL; + + /* + * Read data from chip, protecting against concurrent updates + * from this host, but not from other I2C masters. + */ + mutex_lock(&at24->lock); + + while (count) { + int status; + + status = at24->read_func(at24, buf, off, count); + if (status < 0) { + mutex_unlock(&at24->lock); + return status; + } + buf += status; + off += status; + count -= status; + } + + mutex_unlock(&at24->lock); + + return 0; +} + +static int at24_write(void *priv, unsigned int off, void *val, size_t count) +{ + struct at24_data *at24 = priv; + char *buf = val; + + if (unlikely(!count)) + return -EINVAL; + + if (off + count > at24->chip.byte_len) + return -EINVAL; + + /* + * Write data to chip, protecting against concurrent updates + * from this host, but not from other I2C masters. + */ + mutex_lock(&at24->lock); + + while (count) { + int status; + + status = at24->write_func(at24, buf, off, count); + if (status < 0) { + mutex_unlock(&at24->lock); + return status; + } + buf += status; + off += status; + count -= status; + } + + mutex_unlock(&at24->lock); + + return 0; +} + +#ifdef CONFIG_OF +static void at24_get_ofdata(struct i2c_client *client, + struct at24_platform_data *chip) +{ + const __be32 *val; + struct device_node *node = client->dev.of_node; + + if (node) { + if (of_get_property(node, "read-only", NULL)) + chip->flags |= AT24_FLAG_READONLY; + val = of_get_property(node, "pagesize", NULL); + if (val) + chip->page_size = be32_to_cpup(val); + } +} +#else +static void at24_get_ofdata(struct i2c_client *client, + struct at24_platform_data *chip) +{ } +#endif /* CONFIG_OF */ + +static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id) +{ + struct at24_platform_data chip; + kernel_ulong_t magic = 0; + bool writable; + int use_smbus = 0; + int use_smbus_write = 0; + struct at24_data *at24; + int err; + unsigned i, num_addresses; + u8 test_byte; + + if (client->dev.platform_data) { + chip = *(struct at24_platform_data *)client->dev.platform_data; + } else { + if (id) { + magic = id->driver_data; + } else { + const struct acpi_device_id *aid; + + aid = acpi_match_device(at24_acpi_ids, &client->dev); + if (aid) + magic = aid->driver_data; + } + if (!magic) + return -ENODEV; + + chip.byte_len = BIT(magic & AT24_BITMASK(AT24_SIZE_BYTELEN)); + magic >>= AT24_SIZE_BYTELEN; + chip.flags = magic & AT24_BITMASK(AT24_SIZE_FLAGS); + /* + * This is slow, but we can't know all eeproms, so we better + * play safe. Specifying custom eeprom-types via platform_data + * is recommended anyhow. + */ + chip.page_size = 1; + + /* update chipdata if OF is present */ + at24_get_ofdata(client, &chip); + + chip.setup = NULL; + chip.context = NULL; + } + + if (!is_power_of_2(chip.byte_len)) + dev_warn(&client->dev, + "byte_len looks suspicious (no power of 2)!\n"); + if (!chip.page_size) { + dev_err(&client->dev, "page_size must not be 0!\n"); + return -EINVAL; + } + if (!is_power_of_2(chip.page_size)) + dev_warn(&client->dev, + "page_size looks suspicious (no power of 2)!\n"); + + /* + * REVISIT: the size of the EUI-48 byte array is 6 in at24mac402, while + * the call to ilog2() in AT24_DEVICE_MAGIC() rounds it down to 4. + * + * Eventually we'll get rid of the magic values altoghether in favor of + * real structs, but for now just manually set the right size. + */ + if (chip.flags & AT24_FLAG_MAC && chip.byte_len == 4) + chip.byte_len = 6; + + /* Use I2C operations unless we're stuck with SMBus extensions. */ + if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { + //if (chip.flags & AT24_FLAG_ADDR16) + // return -EPFNOSUPPORT; + + if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { + use_smbus = I2C_SMBUS_I2C_BLOCK_DATA; + } else if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_READ_WORD_DATA)) { + use_smbus = I2C_SMBUS_WORD_DATA; + } else if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_READ_BYTE_DATA)) { + use_smbus = I2C_SMBUS_BYTE_DATA; + } else { + return -EPFNOSUPPORT; + } + + if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_WRITE_I2C_BLOCK)) { + use_smbus_write = I2C_SMBUS_I2C_BLOCK_DATA; + } else if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) { + use_smbus_write = I2C_SMBUS_BYTE_DATA; + chip.page_size = 1; + } + } + + if (chip.flags & AT24_FLAG_TAKE8ADDR) + num_addresses = 8; + else + num_addresses = DIV_ROUND_UP(chip.byte_len, + (chip.flags & AT24_FLAG_ADDR16) ? 65536 : 256); + + at24 = devm_kzalloc(&client->dev, sizeof(struct at24_data) + + num_addresses * sizeof(struct i2c_client *), GFP_KERNEL); + if (!at24) + return -ENOMEM; + + mutex_init(&at24->lock); + at24->use_smbus = use_smbus; + at24->use_smbus_write = use_smbus_write; + at24->chip = chip; + at24->num_addresses = num_addresses; + + if ((chip.flags & AT24_FLAG_SERIAL) && (chip.flags & AT24_FLAG_MAC)) { + dev_err(&client->dev, + "invalid device data - cannot have both AT24_FLAG_SERIAL & AT24_FLAG_MAC."); + return -EINVAL; + } + + if (chip.flags & AT24_FLAG_SERIAL) { + at24->read_func = at24_eeprom_read_serial; + } else if (chip.flags & AT24_FLAG_MAC) { + at24->read_func = at24_eeprom_read_mac; + } else { + at24->read_func = at24->use_smbus ? at24_eeprom_read_smbus + : at24_eeprom_read_i2c; + } + + if (at24->use_smbus) { + if (at24->use_smbus_write == I2C_SMBUS_I2C_BLOCK_DATA) + at24->write_func = at24_eeprom_write_smbus_block; + else + at24->write_func = at24_eeprom_write_smbus_byte; + } else { + at24->write_func = at24_eeprom_write_i2c; + } + + writable = !(chip.flags & AT24_FLAG_READONLY); + if (writable) { + if (!use_smbus || use_smbus_write) { + + unsigned write_max = chip.page_size; + + if (write_max > io_limit) + write_max = io_limit; + if (use_smbus && write_max > I2C_SMBUS_BLOCK_MAX) + write_max = I2C_SMBUS_BLOCK_MAX; + at24->write_max = write_max; + + /* buffer (data + address at the beginning) */ + at24->writebuf = devm_kzalloc(&client->dev, + write_max + 2, GFP_KERNEL); + if (!at24->writebuf) + return -ENOMEM; + } else { + dev_warn(&client->dev, + "cannot write due to controller restrictions."); + } + } + + at24->client[0] = client; + + /* use dummy devices for multiple-address chips */ + for (i = 1; i < num_addresses; i++) { + at24->client[i] = i2c_new_dummy(client->adapter, + client->addr + i); + if (!at24->client[i]) { + dev_err(&client->dev, "address 0x%02x unavailable\n", + client->addr + i); + err = -EADDRINUSE; + goto err_clients; + } + } + + i2c_set_clientdata(client, at24); + + /* + * Perform a one-byte test read to verify that the + * chip is functional. + */ + err = at24_read(at24, 0, &test_byte, 1); + if (err) { + err = -ENODEV; + goto err_clients; + } + + at24->nvmem_config.name = dev_name(&client->dev); + at24->nvmem_config.dev = &client->dev; + at24->nvmem_config.read_only = !writable; + at24->nvmem_config.root_only = true; + at24->nvmem_config.owner = THIS_MODULE; + at24->nvmem_config.compat = true; + at24->nvmem_config.base_dev = &client->dev; + at24->nvmem_config.reg_read = at24_read; + at24->nvmem_config.reg_write = at24_write; + at24->nvmem_config.priv = at24; + at24->nvmem_config.stride = 1; + at24->nvmem_config.word_size = 1; + at24->nvmem_config.size = chip.byte_len; + + at24->nvmem = nvmem_register(&at24->nvmem_config); + + if (IS_ERR(at24->nvmem)) { + err = PTR_ERR(at24->nvmem); + goto err_clients; + } + + dev_info(&client->dev, "%u byte %s EEPROM, %s, %u bytes/write\n", + chip.byte_len, client->name, + writable ? "writable" : "read-only", at24->write_max); + if (use_smbus == I2C_SMBUS_WORD_DATA || + use_smbus == I2C_SMBUS_BYTE_DATA) { + dev_notice(&client->dev, "Falling back to %s reads, " + "performance will suffer\n", use_smbus == + I2C_SMBUS_WORD_DATA ? "word" : "byte"); + } + + /* export data to kernel code */ + if (chip.setup) + chip.setup(at24->nvmem, chip.context); + + return 0; + +err_clients: + for (i = 1; i < num_addresses; i++) + if (at24->client[i]) + i2c_unregister_device(at24->client[i]); + + return err; +} + +static int at24_remove(struct i2c_client *client) +{ + struct at24_data *at24; + int i; + + at24 = i2c_get_clientdata(client); + + nvmem_unregister(at24->nvmem); + + for (i = 1; i < at24->num_addresses; i++) + i2c_unregister_device(at24->client[i]); + + return 0; +} + +/*-------------------------------------------------------------------------*/ + +static struct i2c_driver at24_driver = { + .driver = { + .name = "at24_smbus", + .acpi_match_table = ACPI_PTR(at24_acpi_ids), + }, + .probe = at24_probe, + .remove = at24_remove, + .id_table = at24_ids, +}; + +static int __init at24_init(void) +{ + if (!io_limit) { + pr_err("at24: io_limit must not be 0!\n"); + return -EINVAL; + } + + io_limit = rounddown_pow_of_two(io_limit); + return i2c_add_driver(&at24_driver); +} +module_init(at24_init); + +static void __exit at24_exit(void) +{ + i2c_del_driver(&at24_driver); +} +module_exit(at24_exit); + +MODULE_DESCRIPTION("Driver for most I2C EEPROMs"); +MODULE_AUTHOR("David Brownell and Wolfram Sang"); +MODULE_LICENSE("GPL"); diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/modules/lscpcie2.c b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/modules/lscpcie2.c new file mode 100644 index 0000000000..672c214a0f --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/modules/lscpcie2.c @@ -0,0 +1,1485 @@ +/* + * COPYRIGHT (c) 2007 by Lattice Semiconductor Corporation + * + * All rights reserved. All use of this software and documentation is + * subject to the License Agreement located in the file LICENSE. + */ +/** @file lscpcie2.c + * + * Generic PCI/PCI-Express Device Driver for Lattice Eval Boards. + * + * NOTE: code has been targeted for RedHat WorkStation 4.0 update 4 + * kernel 2.6.9-42.ELsmp #1 SMP Wed Jul 12 23:27:17 EDT 2006 i686 i686 i386 GNU/Linux + * + * + * A Linux kernel device driver, for Lattice PCIe Eval boards on the PCIe bus, + * that maps the + * device's PCI address windows (its BAR0-n) into shared memory that is + * accessible by a user-space driver that implements the real control of + * the device. + * + * The intent is to map each active BAR to a corresponding minor device + * so that the user space driver can open that minor device and mmap it + * to get access to the registers. + * + * The BAR register definitions are Demo/application specific. The driver + * does not make any assumptions about the number of BARs that exist or + * their size or use. These are policies of the demo. The driver just + * makes them available to user space. + * + * The driver places no policies on the use of the device. It simply allows + * direct access to the PCI memory space occupied by the device. Any number + * of processes can open the device. It is up to the higher level application + * space driver to coordinate multiple accesses. The policy is basically the + * same as a flat memory space embedded system. + * + * The ioctl system call can be used to control interrupts or other global + * settings of the device. + * + * BUILDING: + * + * Compile as regular user (no need to be root) + * The product is a kernel module: lscpcie2.ko + * + * + * INSTALLING: + * + * Need to be root to install a module. + * + * Use the shell scripts insdrvr and rmdrvr to install and remove + * the driver. + * The scripts may perform udev operations to make the devices known to the /dev + * file system. + * + * Manual: + * install with system call: /sbin/insmod lscpice.ko + * remove with system call: /sbin/rmmod lscpcie2.ko + * check status of module: cat /proc/modules + * cat /proc/devices + * + * The printk() messages can be seen by running the command dmesg. + * + * The Major device number is dynamically assigned. This info can + * be found in /proc/devices. + * + * + * + * The minor number refers to the specific device. + * Previous incarnations used the minor number to encode the board and BAR to + * access. This has been abandoned, and the minor now referes to the specific + * device controlled by this driver (i.e. the eval board). Once open() the + * user has access to all BARs and board resources through the same file + * descriptor. The user space code knows how many BARs are active via ioctl + * calls to return the PCI resource info. + * + * + * Diagnostic information can be seen with: cat /proc/driver/lscpcie2 + * + * The standard read/write system operations are not implemented because the + * user has direct access to the device registers via a standard pointer. + * + * This driver implements the 2.6 kernel method of sysfs and probing to register + * the driver, discover devices and make them available to user space programs. + * A major player is creating a specific Class lscpcie2 which + * + * register it with the PCI subsystem to probe for the eval board(s) + * register it as a character device (cdev) so it can get a major number and minor numbers + * create a special sysfs Class and add each discovered device under the class + * udev processes the /sys/class/ tree to populate + * + * + * BASED ON: + * Original lscpcie Linux driver which did things the 2.4 kernel way + * + * My previous work on vxp524 driver + * + * And: + * ------------------------------------------------------------------------ + * Host shared memory driver (Mark McLeland 3Com/Cal Poly Project) + * ------------------------------------------------------------------------ + * linux/drivers/char/mem.c (RedHat 2.4.7 kernel) + * + * Copyright (C) 1991, 1992 Linus Torvalds + * + * Added devfs support. + * Jan-11-1998, C. Scott Ananian + * Shared /dev/zero mmaping support, Feb 2000, Kanoj Sarcar + * ----------------------------------------------------------------------- + * + */ + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +//#include +#include +#include + +#include +#include +#include + +/* For devices that use/implement shared memory (mmap) */ +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "Ioctl.h" + +#ifndef CONFIG_PCI + #error No PCI Bus Support in kernel! +#endif + +#define USE_PROC /* For debugging */ + +// Some Useful defines +#ifndef TRUE +#define TRUE 1 +#endif +#ifndef FALSE +#define FALSE 0 +#endif +#ifndef OK +#define OK 0 +#endif +#ifndef ERROR +#define ERROR -1 +#endif + +/* Change these defines to increase number of boards supported by the driver */ + +#define NUM_BARS MAX_PCI_BARS /* defined in Ioctl.h */ +#define NUM_BOARDS 4 // 4 PCIe boards per system is a lot of PCIe slots and eval boards to have on hand +#define MAX_BOARDS (NUM_BOARDS) +#define MINORS_PER_BOARD 1 // 1 minor number per discrete device +#define MAX_MINORS (MAX_BOARDS * MINORS_PER_BOARD) + + +#define DMA_BUFFER_SIZE (64 * 1024) + + +// Note: used as indexes into lists of strings +#define SC_BOARD 1 +#define ECP2M_BOARD 2 +#define ECP3_BOARD 3 +#define BASIC_DEMO 1 +#define SFIF_DEMO 2 + +#ifndef DMA_32BIT_MASK +#define DMA_32BIT_MASK 0x00000000ffffffffULL +#endif + +#ifndef VM_RESERVED +# define VM_RESERVED (VM_DONTEXPAND | VM_DONTDUMP) +#endif + +MODULE_AUTHOR("Lattice Semiconductor"); +MODULE_DESCRIPTION("Lattice PCIe Eval Board Device Driver"); + +/* License this so no annoying messages when loading module */ +MODULE_LICENSE("Dual BSD/GPL"); + +MODULE_ALIAS("lscpcie2"); + + + + + +/*-------------------------------------------------*/ +/*-------------------------------------------------*/ +/*-------------------------------------------------*/ +/* DATA TYPES + */ +/*-------------------------------------------------*/ +/*-------------------------------------------------*/ +/*-------------------------------------------------*/ + +/** + * This is the private data for each board's BAR that is mapped in. + * NOTE: each structure MUST have minor as the first entry because it + * it tested by a void * to see what BAR it is - See mmap() + */ +typedef struct PCI_Dev_BAR +{ + int bar; + void *pci_addr; /**< the physical bus address of the BAR (assigned by PCI system), used in mmap */ + void *kvm_addr; /**< the virtual address of a BAR mapped into kernel space, used in ioremap */ + int memType; + int dataSize; + unsigned long len; + unsigned long pci_start; /* info gathered from pci_resource_*() */ + unsigned long pci_end; + unsigned long pci_flags; +} pci_dev_bar_t; + + +typedef struct PCIE_Board +{ + u32 ID; /**< PCI device ID of the board (0x5303, 0xe235, etc) */ + u32 demoID; /**< PCI subsys device ID of the board (0x3030, 0x3010, etc) */ + u32 demoType; /**< Basic or SFIF demo ID */ + u32 boardType; /**< SC or ECP2M device ID */ + u32 instanceNum; /**< tracks number of identical board,demo devices in system */ + u32 majorNum; /**< copy of driver's Major number for use in places where only device exists */ + u32 minorNum; /**< specific Minor number asigned to this board */ + u32 numBars; /**< number of valid BARs this board has, used to limit access into Dev_BARs[] */ + int IRQ; /**< -1 if no interrupt support, otherwise the interrupt line/vector */ + + //---------------- BAR Assignments ------------- + u32 mmapBAR; /**< which BAR is used for mmap into user space. Can change with IOCTL call */ + u32 ctrlBAR; /**< which BAR is used for control access, i.e. lighting LEDs, masking Intrs */ + void *ctrlBARaddr; /**< above BAR memory ioremap'ed into driver space to access */ + + + //---------------- DMA Buffer ------------- + bool hasDMA; /**< true = allocated a buffer for DMA transfers by SFIF */ + size_t dmaBufSize; /**< size in bytes of the allocated kernel buffer */ + dma_addr_t dmaPCIBusAddr; /**< PCI bus address to access the DMA buffer - program into board */ + void *dmaCPUAddr; /**< CPU (software) address to access the DMA buffer - use in driver */ + + + struct pci_dev *pPciDev; /**< pointer to the PCI core representation of the board */ + + pci_dev_bar_t Dev_BARs[NUM_BARS]; /**< database of valid, mapped BARs belonging to this board */ + + struct cdev charDev; /**< the character device implemented by this driver */ + + +} pcie_board_t; + + + +/** + * The main container of all the data structures and elements that comprise the + * lscpcie2 device driver. Main elements are the array of detected eval boards, + * the sysfs class, the assigned driver number. + */ +typedef struct LSCPCIe2 +{ + + dev_t drvrDevNum; /**> starting [MAJOR][MINOR] device number for this driver */ + u32 numBoards; /**> total number of boards controlled by driver */ + + u8 numSC_Basic; /**> count of number of SC Basic boards found */ + u8 numSC_SFIF; /**> count of number of SC SFIF boards found */ + u8 numECP2M_Basic; /**> count of number of ECP2M Basic boards found */ + u8 numECP2M_SFIF; /**> count of number of ECP2M SFIF boards found */ + u8 numECP3_Basic; /**> count of number of ECP3 Basic boards found */ + u8 numECP3_SFIF; /**> count of number of ECP3 SFIF boards found */ + + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)) + struct class *sysClass; /**> the top entry point of lscpcie2 in /sys/class */ +#else + struct class_simple *sysClass; /**> the top entry point of lscpcie2 in /sys/class */ +#endif + + + pcie_board_t Board[NUM_BOARDS]; /**> Database of LSC PCIe Eval Boards Installed */ + +} lscpcie2_t; + + +/*-------------------------------------------------*/ +/*-------------------------------------------------*/ +/*-------------------------------------------------*/ +/* + * DRIVER GLOBAL VARIABLES + */ +/*-------------------------------------------------*/ +/*-------------------------------------------------*/ +/*-------------------------------------------------*/ + + +/** + * The driver's global database of all boards and run-time information. + */ +static lscpcie2_t lscpcie2; + + + +static int DrvrDebug = 0; + + +static const char Version[] = "lscpcie2 v2.1.7 - ECP3 support"; /**< version string for display */ + + +static const char *BoardName[4] = {"??", "SC", "ECP2M", "ECP3"}; +static const char *DemoName[3] = {"??", "Basic", "SFIF"}; + + + +/** + * List of boards we will attempt to find and associate with the driver. + */ +static struct pci_device_id lscpcie2_pci_id_tbl[] = +{ + { 0x1204, 0x5303, 0x1204, 0x3030, }, // SC SFIF + { 0x1204, 0xe250, 0x1204, 0x3030, }, // ECP2M SFIF + { 0x1204, 0xec30, 0x1204, 0x3030, }, // ECP3 SFIF + { 0x1204, 0xe250, 0x1204, 0x3010, }, // ECP2M50 Basic on Sol. Brd + { 0x1204, 0x5303, 0x1204, 0x3010, }, // SC Basic + { 0x1204, 0xec30, 0x1204, 0x3010, }, // ECP3 Basic +#if 0 + { 0x1204, 0xe235, 0x1204, 0xe235, }, // ECP2M Basic - old ID; enable if have old demo bitstream + { 0x1204, 0xe235, 0x1204, 0x5303, }, // ECP2M Basic - old ID; enable if have old demo bitstream + { 0x1204, 0x5303, 0x1204, 0x5303, }, // SC Basic - old ID; enable if have old demo bitstream +#endif + { } /* Terminating entry */ +}; + +MODULE_DEVICE_TABLE(pci, lscpcie2_pci_id_tbl); + + +/*========================================================================*/ +/*========================================================================*/ +/*========================================================================*/ +/* + * PROC DEBUG STUFF + */ +/*========================================================================*/ +/*========================================================================*/ +/*========================================================================*/ +#ifdef USE_PROC /* don't waste space if unused */ + +/** + * Procedure to format and display data into the /proc filesystem when + * a user cats the /proc/driver/lscpie2 file. + * Displays the driver major/minor #'s, BARs that are allocated, interrupt + * resources. General infomation about the board that was initialized. + */ +int lscpcie2_read_procmem(char *buf, char **start, off_t offset, + int count, int *eof, void *data) +{ + int i, n; + int len = 0; + // int limit = count - 80; /* Don't print more than this */ + pci_dev_bar_t *p; + + *start = buf + offset; + + if (DrvrDebug) + printk(KERN_INFO "lscpcie2: /proc entry created\n"); + + /* Put any messages in here that will be displayed by cat /proc/driver/.. */ + len += sprintf(buf+len, "\nLSC PCIE Device Driver Info\n"); + len += sprintf(buf+len, "\nNumBoards: %d Major#: %d\n", lscpcie2.numBoards, MAJOR(lscpcie2.drvrDevNum)); + + for (n = 0; n < NUM_BOARDS; n++) + { + + if (lscpcie2.Board[n].ID != 0) + { + + len += sprintf(buf+len, "Board:%d = %x Demo=%x IRQ=%d\n", lscpcie2.Board[n].instanceNum, + lscpcie2.Board[n].ID, + lscpcie2.Board[n].demoID, + lscpcie2.Board[n].IRQ); + + for (i = 0; i < NUM_BARS; i++) + { + p = &lscpcie2.Board[n].Dev_BARs[i]; + len += sprintf(buf+len, "BAR[%d] pci_addr=%p kvm_addr=%p\n" + " type=%d dataSize=%d len=%ld\n" + " start=%lx end=%lx flags=%lx\n", + i, + p->pci_addr, + p->kvm_addr, + p->memType, + p->dataSize, + p->len, + p->pci_start, + p->pci_end, + p->pci_flags); + } + } + } + + if (len < offset + count) + *eof = 1; /* Mark that this is a complete buffer (the End of File) */ + + /* Not sure about all this, but it works */ + len = len - offset; + if (len > count) + len = count; + if (len < 0) + len = 0; + + + return(len); +} + + +#endif /* USE_PROC */ + + + +/** + * Initialize the board's resources. + * This is called when probe() has found a matching PCI device (via the PCI subsystem + * probing for boards on behalf of the driver). The board resources are mapped in + * and its setup to be accessed. + */ +static pcie_board_t* initBoard(struct pci_dev *PCI_Dev_Cfg, void * devID) +{ + int i; + unsigned char irq; + pcie_board_t *pBrd; + pci_dev_bar_t *pBAR; + pci_dev_bar_t *p; + u16 SubSystem; + u16 VendorID; + u16 DeviceID; + + /****************************************************/ + /* Device info passed in from the PCI controller via probe() */ + /****************************************************/ + +// TODO +// Add writing an 'E' to the LEDs to show an error if initialization fails +// Problem is we don't have BARs setup till end of function :-( + + + if (DrvrDebug) + printk(KERN_INFO "lscpcie2: init EvalBoard\n"); + + /* Next available board structure in data base */ + pBrd = &lscpcie2.Board[lscpcie2.numBoards]; + + if (pci_read_config_word(PCI_Dev_Cfg, PCI_VENDOR_ID, &VendorID)) + { + printk(KERN_ERR "lscpcie2: init EvalBoard cfg access failed!\n"); + return(NULL); + } + if (VendorID != 0x1204) + { + printk(KERN_ERR "lscpcie2: init EvalBoard not Lattice ID!\n"); + return(NULL); + } + + if (pci_read_config_word(PCI_Dev_Cfg, PCI_DEVICE_ID, &DeviceID)) + { + printk(KERN_ERR "lscpcie2: init EvalBoard cfg access failed!\n"); + return(NULL); + } + + if (pci_read_config_word(PCI_Dev_Cfg, PCI_SUBSYSTEM_ID, &SubSystem)) + { + printk(KERN_ERR "lscpcie2: init EvalBoard cfg access failed!\n"); + return(NULL); + } + + pBrd->ID = DeviceID; + pBrd->demoID = SubSystem; + pBrd->pPciDev = PCI_Dev_Cfg; + pBrd->majorNum = MAJOR(lscpcie2.drvrDevNum); + pBrd->minorNum = MINOR(lscpcie2.drvrDevNum) + lscpcie2.numBoards; + + + // Figure out if board is SC or ECP2M or ECP3, if demo is Basic or SFIF + if ((DeviceID == 0x5303) && (SubSystem == 0x3030)) + { + ++lscpcie2.numSC_SFIF; + pBrd->instanceNum = lscpcie2.numSC_SFIF; + pBrd->boardType = SC_BOARD; + pBrd->demoType = SFIF_DEMO; + pBrd->ctrlBAR = 0; + } + else if ((DeviceID == 0xe250) && (SubSystem == 0x3030)) + { + ++lscpcie2.numECP2M_SFIF; + pBrd->instanceNum = lscpcie2.numECP2M_SFIF; + pBrd->boardType = ECP2M_BOARD; + pBrd->demoType = SFIF_DEMO; + pBrd->ctrlBAR = 0; + } + else if ((DeviceID == 0x5303) && (SubSystem == 0x3010)) + { + ++lscpcie2.numSC_Basic; + pBrd->instanceNum = lscpcie2.numSC_Basic; + pBrd->boardType = SC_BOARD; + pBrd->demoType = BASIC_DEMO; + pBrd->ctrlBAR = 0; + } + else if ((DeviceID == 0xe250) && (SubSystem == 0x3010)) + { + ++lscpcie2.numECP2M_Basic; + pBrd->instanceNum = lscpcie2.numECP2M_Basic; + pBrd->boardType = ECP2M_BOARD; + pBrd->demoType = BASIC_DEMO; + pBrd->ctrlBAR = 0; + } + else if ((DeviceID == 0xec30) && (SubSystem == 0x3010)) + { + ++lscpcie2.numECP3_Basic; + pBrd->instanceNum = lscpcie2.numECP3_Basic; + pBrd->boardType = ECP3_BOARD; + pBrd->demoType = BASIC_DEMO; + pBrd->ctrlBAR = 0; + } + else if ((DeviceID == 0xec30) && (SubSystem == 0x3030)) + { + ++lscpcie2.numECP3_SFIF; + pBrd->instanceNum = lscpcie2.numECP3_SFIF; + pBrd->boardType = ECP3_BOARD; + pBrd->demoType = SFIF_DEMO; + pBrd->ctrlBAR = 0; + } + + + +#if 0 // OLD DEMO ID's for old bitstreams and boards + else if ((DeviceID == 0x5303) && (SubSystem == 0x5303)) + { + ++lscpcie2.numSC_Basic; + pBrd->instanceNum = lscpcie2.numSC_Basic; + pBrd->boardType = SC_BOARD; + pBrd->demoType = BASIC_DEMO; + pBrd->ctrlBAR = 1; + } + else if ((DeviceID == 0xe235) && (SubSystem == 0x5303)) + { + ++lscpcie2.numECP2M_Basic; + pBrd->instanceNum = lscpcie2.numECP2M_Basic; + pBrd->boardType = ECP2M_BOARD; + pBrd->demoType = BASIC_DEMO; + pBrd->ctrlBAR = 1; + } + else if ((DeviceID == 0xe235) && (SubSystem == 0xe235)) + { + ++lscpcie2.numECP2M_Basic; + pBrd->instanceNum = lscpcie2.numECP2M_Basic; + pBrd->boardType = ECP2M_BOARD; + pBrd->demoType = BASIC_DEMO; + pBrd->ctrlBAR = 1; + } +#endif + else + { + printk(KERN_ERR "lscpcie2: init ERROR! unknown board: %x %x\n", DeviceID, SubSystem); + pBrd->instanceNum = 0; + pBrd->boardType = 0; + pBrd->demoType = 0; + return(NULL); + } + + // For now, all demos use only one BAR and that BAR is for control plane and is also what will + // be mmap'ed into user space for the driver interface to access. + pBrd->mmapBAR = pBrd->ctrlBAR; + + + //=============== Interrupt handling stuff ======================== + if (pci_read_config_byte(PCI_Dev_Cfg, PCI_INTERRUPT_LINE, &irq)) + pBrd->IRQ = -1; // no interrupt + else + pBrd->IRQ = irq; + + if (DrvrDebug) + { + printk(KERN_INFO "lscpcie2: init brdID: %x demoID: %x\n", DeviceID, SubSystem); + printk(KERN_INFO "lscpcie2: init Board[] =%d\n", lscpcie2.numBoards); + printk(KERN_INFO "lscpcie2: init IRQ=%d\n", irq); + } + + + //================ DMA Common Buffer (Consistent) Allocation ==================== + // First see if platform supports 32 bit DMA address cycles (like what won't!) + if (pci_set_dma_mask(PCI_Dev_Cfg, DMA_32BIT_MASK)) + { + printk(KERN_WARNING "lscpcie2: init DMA not supported!\n"); + pBrd->hasDMA = FALSE; + } + else + { + pBrd->hasDMA = TRUE; + pBrd->dmaBufSize = DMA_BUFFER_SIZE; + pBrd->dmaCPUAddr = pci_alloc_consistent(PCI_Dev_Cfg, pBrd->dmaBufSize, &pBrd->dmaPCIBusAddr); + if (pBrd->dmaCPUAddr == NULL) + { + printk(KERN_WARNING "lscpcie2: init DMA alloc failed! No DMA buffer.\n"); + pBrd->hasDMA = FALSE; + } + } + + + /* Get info on all the PCI BAR registers */ + pBrd->numBars = 0; // initialize + for (i = 0; i < NUM_BARS; i++) + { + p = &(pBrd->Dev_BARs[i]); + p->pci_start = pci_resource_start(PCI_Dev_Cfg, i); + p->pci_end = pci_resource_end(PCI_Dev_Cfg, i); + p->len = pci_resource_len(PCI_Dev_Cfg, i); + p->pci_flags = pci_resource_flags(PCI_Dev_Cfg, i); + + if ((p->pci_start > 0) && (p->pci_end > 0)) + { + ++(pBrd->numBars); + p->bar = i; + p->pci_addr = (void *)p->pci_start; + p->memType = p->pci_flags; /* IORESOURCE Definitions: (see ioport.h) + * 0x0100 = IO + * 0x0200 = memory + * 0x0400 = IRQ + * 0x0800 = DMA + * 0x1000 = PREFETCHable + * 0x2000 = READONLY + * 0x4000 = cacheable + * 0x8000 = rangelength ??? + */ + /*============================================================* + * * + * Windows DDK definitions CM_PARTIAL_RESOURCE_DESCRIPTOR.Type * + * * + * #define CmResourceTypeNull 0 * + * #define CmResourceTypePort 1 * + * #define CmResourceTypeInterrupt 2 * + * #define CmResourceTypeMemory 3 * + * #define CmResourceTypeDma 4 * + * #define CmResourceTypeDeviceSpecific 5 * + * #define CmResourceTypeBusNumber 6 * + * #define CmResourceTypeMaximum 7 * + * #define CmResourceTypeNonArbitrated 128 * + * #define CmResourceTypeConfigData 128 * + * #define CmResourceTypeDevicePrivate 129 * + * #define CmResourceTypePcCardConfig 130 * + * #define CmResourceTypeMfCardConfig 131 * + *============================================================*/ + if (DrvrDebug) + { + printk(KERN_INFO "lscpcie2: init BAR=%d\n", i); + printk(KERN_INFO "lscpcie2: init start=%lx\n", p->pci_start); + printk(KERN_INFO "lscpcie2: init end=%lx\n", p->pci_end); + printk(KERN_INFO "lscpcie2: init len=0x%lx\n", p->len); + printk(KERN_INFO "lscpcie2: init flags=0x%lx\n", p->pci_flags); + } + } + } + + + // Map the BAR into kernel space so the driver can access registers. + // The driver can not directly read/write the PCI physical bus address returned + // by pci_resource_start(). In our current implementation the driver really + // doesn't access the device registers, so this is not used. It could be used + // if the driver took a more active role in managing the devices on the board. + + // Map the default BAR into the driver's address space for access to LED registers, + // masking off interrupts, and any other direct hardware controlled by the driver. + // Note that the BAR may be different per demo. Basic uses BAR1, SFIF & SGDMA use BAR0 + pBAR = &(pBrd->Dev_BARs[pBrd->ctrlBAR]); + if (pBAR->pci_start) + { + pBrd->ctrlBARaddr = ioremap(pBAR->pci_start, // PCI bus start address + pBAR->len); // BAR size + pBAR->kvm_addr = pBrd->ctrlBARaddr; // for historic reasons + + if (pBrd->ctrlBARaddr) + { + writew(0x80f3, pBrd->ctrlBARaddr + 8); // display an 'E' for error (erased if all goes well) + } + else + { + printk(KERN_ERR "lscpcie2: init ERROR with ioremap\n"); + return(NULL); + } + + } + else + { + printk(KERN_ERR "lscpcie2: init ERROR ctrlBAR %d not avail!\n", pBrd->ctrlBAR); + return(NULL); + } + + ++lscpcie2.numBoards; + + return(pBrd); // pointer to board found and initialized + +} + + +/*========================================================================*/ +/*========================================================================*/ +/*========================================================================*/ +/* + * DRIVER FILE OPERATIONS (OPEN, CLOSE, MMAP, IOCTL) + */ +/*========================================================================*/ +/*========================================================================*/ +/*========================================================================*/ + + +/** + * Open + * Any number of devices can open this address space. The main reason for + * this method is so the user has a file descriptor to pass to mmap() to + * get the device memory mapped into their address space. + * + * The minor number is the index into the Board[] list. + * It specifies exactly what board and is correlated to the device node filename. + * Only valid board devices that have been enumerated by probe() and initialized + * are in the list, are in /sys/class/lscpcie2/ and should appear in /dev/lscpcie/ + * + * Note that the PCI device has already been enabled in probe() and init so it + * doesn't need to be done again. + */ +int lscpcie2_open(struct inode *inode, struct file *filp) +{ + u32 brdNum; + pcie_board_t *pBrd; + + + /* Extract the board number from the minor number */ + brdNum = iminor(inode); + + if (DrvrDebug) + printk(KERN_INFO "lscpcie2: open(): board#=%d\n", brdNum); + + /* Validate (paranoid) */ + if (brdNum >= lscpcie2.numBoards) + return(-ENODEV); + + // This is what the user wants to access + pBrd = &lscpcie2.Board[brdNum]; + + + if (pBrd->ID == 0) + return(-ENODEV); // Board[] entry not configured correctly + +// TODO + // Maybe increment a reference count, don't let more than one user open a board??? + + /* This allows ioctl quick access to the boards global resources */ + filp->private_data = pBrd; + + // Need to possibly connect up interrupts + // pci_enable_device(pBrd->pPciDev); // we may want to do this to "power-up" a closed board? + + // Write an 'O' to the LEDs to signal its openned + if (pBrd->ctrlBARaddr) + writew(0x00ff, pBrd->ctrlBARaddr + 8); // display an 'O' + + return(0); +} + + +/** + * Close. + * The complement to open(). + */ +int lscpcie2_release(struct inode *inode, struct file *filp) +{ + struct PCIE_Board *pBrd = filp->private_data; + + u32 mnr = iminor(inode); + + if (DrvrDebug) + printk(KERN_INFO "lscpcie2: close() - closing board=%d\n", mnr); + + // Write a 'C' to the LEDs to signal its closed + if (pBrd->ctrlBARaddr) + writew(0x00f3, pBrd->ctrlBARaddr + 8); // display a 'C' + +// TODO + // Maybe decrement a reference count + + // pci_disable_device(pBrd->pPciDev); // we may want to do this to "power-down" the board? + + return(0); +} + + + +/** + * ioctl. + * Allow simple access to generic PCI control type things like enabling + * device interrupts and such. + * IOCTL works on a board object as a whole, not a BAR. + */ +long lscpcie2_ioctl( struct file *filp, unsigned int cmd, unsigned long arg) +{ + int i; + int status = OK; + + pcie_board_t *pBrd = NULL; + PCIResourceInfo_t *pInfo; + ExtraResourceInfo_t *pExtra; + + if (DrvrDebug) + printk(KERN_INFO "lscpcie2: ioctl(cmd=%d arg=%lx size=%d)\n" + , _IOC_NR(cmd), arg, _IOC_SIZE(cmd)); + + if (_IOC_TYPE(cmd) != LSCPCIE_MAGIC) + return(-EINVAL); + if (_IOC_NR(cmd) > IOCTL_LSCPCIE_MAX_NR) + return(-EINVAL); + + pBrd = filp->private_data; + switch (cmd) + { + + case IOCTL_LSCPCIE_GET_VERSION_INFO: + // first make sure the pointer passed in arg is still valid user page + if (!access_ok(VERIFY_WRITE, (void *)arg, _IOC_SIZE(cmd))) + { + status = -EFAULT; + break; // abort + } + + pInfo = kmalloc(sizeof(MAX_DRIVER_VERSION_LEN ), GFP_KERNEL); + if (pInfo == NULL) + { + status = -EFAULT; + break; // abort + } + + + strncpy((void *)arg, Version, MAX_DRIVER_VERSION_LEN - 1); + kfree(pInfo); // release kernel temp buffer + + break; + + case IOCTL_LSCPCIE_SET_BAR: + // The argument passed in is the direct BAR number (0-5) to use for mmap + pBrd->mmapBAR = arg; + break; + + + case IOCTL_LSCPCIE_GET_RESOURCES: + // first make sure the pointer passed in arg is still valid user page + if (!access_ok(VERIFY_WRITE, (void *)arg, _IOC_SIZE(cmd))) + { + status = -EFAULT; + break; // abort + } + + pInfo = kmalloc(sizeof(PCIResourceInfo_t), GFP_KERNEL); + if (pInfo == NULL) + { + status = -EFAULT; + break; // abort + } + + if (pBrd->IRQ > 0) + pInfo->hasInterrupt = TRUE; + else + pInfo->hasInterrupt = FALSE; + pInfo->intrVector = pBrd->IRQ; + pInfo->numBARs = pBrd->numBars; + for (i = 0; i < MAX_PCI_BARS; i++) + { + pInfo->BAR[i].nBAR = pBrd->Dev_BARs[i].bar; + pInfo->BAR[i].physStartAddr = (ULONG)pBrd->Dev_BARs[i].pci_addr; + pInfo->BAR[i].size = pBrd->Dev_BARs[i].len; + pInfo->BAR[i].memMapped = (pBrd->Dev_BARs[i].kvm_addr) ? 1 : 0; + pInfo->BAR[i].flags = (USHORT)(pBrd->Dev_BARs[i].pci_flags); + pInfo->BAR[i].type = (UCHAR)((pBrd->Dev_BARs[i].memType)>>8); // get the bits that show IO or mem + } + for (i = 0; i < 0x100; ++i) + pci_read_config_byte(pBrd->pPciDev, i, &(pInfo->PCICfgReg[i])); + + if (copy_to_user((void *)arg, (void *)pInfo, sizeof(PCIResourceInfo_t)) != 0) + status = -EFAULT; // Not all bytes were copied so this is an error + kfree(pInfo); // release kernel temp buffer + + break; + + + case IOCTL_LSCPCIE2_GET_EXTRA_INFO: + // first make sure the pointer passed in arg is still valid user page + if (!access_ok(VERIFY_WRITE, (void *)arg, _IOC_SIZE(cmd))) + { + status = -EFAULT; + break; // abort + } + + pExtra = kmalloc(sizeof(ExtraResourceInfo_t), GFP_KERNEL); + if (pExtra == NULL) + { + status = -EFAULT; + break; // abort + } + + pExtra->devID = pBrd->minorNum; // board number of specific device + + pExtra->busNum = pBrd->pPciDev->bus->number; // PCI bus number board located on + pExtra->deviceNum = PCI_SLOT(pBrd->pPciDev->devfn); // PCI device number assigned to board + pExtra->functionNum = PCI_FUNC(pBrd->pPciDev->devfn); // our function number + pExtra->UINumber = pBrd->minorNum; // slot number (not implemented) + + // Device DMA Common buffer memory info + pExtra->hasDmaBuf = pBrd->hasDMA; // true if DMA buffer has been allocated by driver + pExtra->DmaBufSize = pBrd->dmaBufSize; // size in bytes of said buffer + pExtra->DmaAddr64 = 0; // driver only asks for 32 bit, SGDMA only supports 32 bit + pExtra->DmaPhyAddrHi = 0; // not used, only 32 bit + pExtra->DmaPhyAddrLo = pBrd->dmaPCIBusAddr; // DMA bus address to be programmed into device + + strncpy(pExtra->DriverName, Version, MAX_DRIVER_NAME_LEN-1); // version and name + + if (copy_to_user((void *)arg, (void *)pExtra, sizeof(ExtraResourceInfo_t)) != 0) + status = -EFAULT; // Not all bytes were copied so this is an error + kfree(pExtra); // release kernel temp buffer + + break; + + default: + status = -EINVAL; // invalid IOCTL argument + } + + return(status); +} + + +/** + * mmap. + * This is the most important driver method. This maps the device's PCI + * address space (based on the select mmap BAR number) into the user's + * address space, allowing direct memory access with standard pointers. + */ +int lscpcie2_mmap(struct file *filp, + struct vm_area_struct *vma) +{ + int num; + int sysErr; + pcie_board_t *pBrd = filp->private_data; + pci_dev_bar_t *pBAR; + unsigned long phys_start; /* starting address to map */ + unsigned long mapSize; /* requested size to map */ + unsigned long offset; /* how far into window to start map */ + + // Map the BAR of the board, specified by mmapBAR (normally the default one that the + // demo supports - normally only one valid BAR in our demos) + pBAR = &(pBrd->Dev_BARs[pBrd->mmapBAR]); + + mapSize = vma->vm_end - vma->vm_start; + offset = vma->vm_pgoff << PAGE_SHIFT; + + num = pBAR->bar; // this is a check to make sure we really initialized the BAR and structures + + if (DrvrDebug) + printk(KERN_INFO "lscpcie2: mmap Board=%d BAR=%d\n", pBrd->minorNum, num); + + if (num == -1) + { + if (DrvrDebug) + printk(KERN_INFO "BAR not activated, no memory\n"); + + + return(-ENOMEM); /* BAR not activated, no memory */ + } + + printk(KERN_INFO "\nasked for memory size %x BAR LEN. %x VMA_START(%x) end %x\n",mapSize,pBAR->len,vma->vm_start,vma->vm_end); +#if 0 + if (mapSize > pBAR->len) + { + if (DrvrDebug) + printk(KERN_INFO "asked for too much memory.\n"); + + return(-EINVAL); /* asked for too much memory. */ + } +#endif + /* Calculate the starting address, based on the offset passed by user */ + phys_start = (unsigned long)(pBAR->pci_addr) + offset; + + if (DrvrDebug) + { + printk(KERN_INFO "lscpcie2: remap_page_range(0x%lx, 0x%x, %d, ...)\n", + vma->vm_start, (uint32_t)phys_start, (uint32_t)mapSize); + } + + /* Make sure the memory is treated as uncached, non-swap device memory */ + vma->vm_flags = vma->vm_flags | VM_LOCKED | VM_IO | VM_RESERVED; + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10)) + /* Do the page mapping the new 2.6.10+ way */ + sysErr = remap_pfn_range(vma, + (unsigned long)vma->vm_start, + (phys_start>>PAGE_SHIFT), + mapSize, + vma->vm_page_prot); + +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,8)) + /* Do the page mapping the intermediate way */ + sysErr = remap_page_range(vma, + (unsigned long)vma->vm_start, + phys_start, + mapSize, + vma->vm_page_prot); +#else + #error Unsupported kernel version!!!! +#endif + + + if (sysErr < 0) + { + printk(KERN_ERR "lscpcie2: remap_page_range() failed!\n"); + return(-EAGAIN); + } + + return(0); +} + + + + +/** + * read. + * Read from system CommonBuffer DMA memory into users buffer. + * User passes length (in bytes) like reading from a file. + */ +ssize_t lscpcie2_read(struct file *filp, + char __user *userBuf, + size_t len, + loff_t *offp) +{ + pcie_board_t *pBrd = filp->private_data; + + if (DrvrDebug) + printk(KERN_INFO "lscpcie2: read len=%d\n", (u32)len); + + if (!pBrd->hasDMA) + return(-EINVAL); // invalid, no DMA buffer allocated + + if (len > pBrd->dmaBufSize) + len = pBrd->dmaBufSize; // trim it down + + if (copy_to_user(userBuf, pBrd->dmaCPUAddr, len) != 0) + return(-EFAULT); + + return(len); +} + + +/** + * write. + * Write from users buffer into system CommonBuffer DMA memory. + * User passes length (in bytes) like writing to a file. + */ +ssize_t lscpcie2_write(struct file *filp, + const char __user *userBuf, + size_t len, + loff_t *offp) +{ + pcie_board_t *pBrd = filp->private_data; + + if (DrvrDebug) + printk(KERN_INFO "lscpcie2: write len=%d\n", (u32)len); + + if (!pBrd->hasDMA) + return(-EINVAL); // invalid, no DMA buffer allocated + + if (len > pBrd->dmaBufSize) + len = pBrd->dmaBufSize; // trim it down + + if (copy_from_user(pBrd->dmaCPUAddr, userBuf, len) != 0) + return(-EFAULT); + + return(len); +} + + + + + +/*==================================================================*/ +/*==================================================================*/ +/*==================================================================*/ +/* + * M O D U L E F U N C T I O N S + */ +/*==================================================================*/ +/*==================================================================*/ +/*==================================================================*/ + +/** + * The file operations table for the device. + * read/write/seek, etc. are not implemented because device access + * is memory mapped based. + */ +static struct file_operations drvr_fops = +{ + owner: THIS_MODULE, + open: lscpcie2_open, + release: lscpcie2_release, + unlocked_ioctl: lscpcie2_ioctl, + mmap: lscpcie2_mmap, + read: lscpcie2_read, + write: lscpcie2_write, +}; + + +/*------------------------------------------------------------------*/ + + + +/** + * Called by the PCI subsystem when it has probed the PCI buses and has + * found a device that matches the criteria registered in the pci table. + * For each board found, the type and demo are determined in the initBoard + * routine. All resources are allocated. A new device is added to the + * /sys/class/lscpcie2/ tree with the name created by the: + * information. + */ +static int lscpcie2_probe(struct pci_dev *pdev, + const struct pci_device_id *ent) +{ + static char devNameStr[12] = "lscpcie2__"; + pcie_board_t *brd; + int err; + + devNameStr[9] = '0' + lscpcie2.numBoards; + + if (DrvrDebug) + printk(KERN_INFO "lscpcie2: pci probe for: %s pdev=%p ent=%p\n", + devNameStr, pdev, ent); + + /* + * Enable the bus-master bit values. + * Some PCI BIOSes fail to set the master-enable bit. + * Some demos support being an initiator, so need bus master ability. + */ + err = pci_request_regions(pdev, devNameStr); + if (err) + return err; + + pci_set_master(pdev); + + err = pci_enable_device(pdev); + if (err) + return err; + + /* + * Call to perform board specific initialization and figure out + * which BARs are active, interrupt vectors, register ISR, what board + * it is (SC or ECP2M or ECP3), what demo (Basic or SFIF) and what instance + * number (is it the 2nd time we've seen a SC Basic?) + * Returns pointer to the Board structure after all info filled in. + */ + brd = initBoard(pdev, (void *)ent); + + if (brd == NULL) + { + printk(KERN_ERR "lscpcie2: Error initializing Eval Board\n"); + // Clean up any resources we acquired along the way + pci_release_regions(pdev); + + return(-1); + } + + + + // Initialize the CharDev entry for this new found eval board device + brd->charDev.owner = THIS_MODULE; + kobject_set_name(&(brd->charDev.kobj), "lscpcie2"); + + cdev_init(&(brd->charDev), &drvr_fops); + +//????? +// Does cdev_add initialize reference count in the kobj? +//????? + + /* Create the minor numbers here and register the device as a character device. + * A number of minor devices can be associated with this particular board. + * The hope/idea is that we give the starting minor number and the number of them + * and all those devices will be associated to this one particular device. + */ + if (cdev_add(&(brd->charDev), MKDEV(brd->majorNum,brd->minorNum), MINORS_PER_BOARD)) + { + printk(KERN_ERR "lscpcie2: Error adding char device\n"); + kobject_put(&(brd->charDev.kobj)); + return(-1); + } + + + /* This creates a new entry in the /sys/class/lscpcie2/ tree that represents this + * new device in user space. An entry in /dev will be created based on the name + * given in the last argument. udev is responsible for mapping sysfs Classes to + * device nodes, and is done outside this kernel driver. + * + * The name is constructed from the board type, demo type and board instance. + * Examples are "sc_basic_0", "sc_basic_1", "ecp2m_sfif_0" + */ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)) + device_create(lscpcie2.sysClass, + NULL, + MKDEV(brd->majorNum,brd->minorNum), + &(pdev->dev), // this is of type struct device, the PCI device? + "%s_%s_%d", BoardName[brd->boardType], DemoName[brd->demoType], brd->instanceNum); +#else + class_simple_device_add(lscpcie2.sysClass, + MKDEV(brd->majorNum,brd->minorNum), + NULL, // this is of type struct device, but who????? + "%s_%s_%d", BoardName[brd->boardType], DemoName[brd->demoType], brd->instanceNum); +#endif + + + + /* Store a pointer to the Board structure with this PCI device instance for easy access + * to board info later on. + */ + pci_set_drvdata(pdev, brd); + + // Write an 'I' to the LEDs at end of initialization + if (brd->ctrlBARaddr) + writew(0x2233, brd->ctrlBARaddr + 8); // display an 'I' + + return 0; +} + + + +/** + * Undo all resource allocations that happened in probe() during device discovery + * and initialization. Major steps are: + * 1.) release PCI resources + * 2.) release minor numbers + * 3.) delete the character device associated with the Major/Minor + * 4.) remove the entry from the sys/class/lscpcie2/ tree + */ +static void lscpcie2_remove(struct pci_dev *pdev) +{ + pcie_board_t *brd = pci_get_drvdata(pdev); + + if (DrvrDebug) + printk(KERN_INFO "lscpcie2: pci remove for device: pdev=%p board=%p\n", pdev, brd); + + + // Write an 'R' to the LEDs when device is removed + if (brd->ctrlBARaddr) + writew(0x98c7, brd->ctrlBARaddr + 8); // display an 'R' + + // Release DMA Buffer + if (brd->hasDMA) + { + pci_free_consistent(pdev, brd->dmaBufSize, brd->dmaCPUAddr, brd->dmaPCIBusAddr); + } + + + // Shut off interrupt sources - not implemented in Basic or SFIF + + // Free our internal access to the control BAR address space + if (brd->ctrlBARaddr) + iounmap(brd->ctrlBARaddr); + + // No more access after this call + pci_release_regions(pdev); + + // Unbind the minor numbers of this device + // using the MAJOR_NUM + board_num + Minor Range of this board + cdev_del(&(brd->charDev)); + + unregister_chrdev_region(MKDEV(brd->majorNum, brd->minorNum), MINORS_PER_BOARD); + + + // Remove the device entry in the /sys/class/lscpcie2/ tree + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)) + device_destroy(lscpcie2.sysClass, MKDEV(brd->majorNum, brd->minorNum)); +#else + class_simple_device_remove(MKDEV(brd->majorNum, brd->minorNum)); +#endif + +} + + +/*-------------------------------------------------------------------------*/ +/* DRIVER INSTALL/REMOVE POINTS */ +/*-------------------------------------------------------------------------*/ + +/* + * Variables that can be overriden from module command line + */ +static int debug = 0; +module_param(debug, int, 0); +MODULE_PARM_DESC(debug, "lscpcie2 enable debugging (0-1)"); + +/** + * Main structure required for registering a driver with the PCI core. + * name must be unique across all registered PCI drivers, and shows up in + * /sys/bus/pci/drivers/ + * id_table points to the table of Vendor,Device,SubSystem matches + * probe is the function to call when enumerating PCI buses to match driver to device + * remove is the function called when PCI is shutting down and devices/drivers are + * being removed. + */ +static struct pci_driver lscpcie2_driver = { + .name = "lscpcie2", + .id_table = lscpcie2_pci_id_tbl, + .probe = lscpcie2_probe, +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0) + .remove = __devexit_p(lscpcie2_remove), +#else + .remove = lscpcie2_remove, +#endif + +/* + .save_state - Save a device's state before its suspended + .suspend - put device into low power state + .resume - wake device from low power state + .enable_wake - enable device to generate wake events from low power state +*/ +}; + + +/*-------------------------------------------------------------------------*/ + +/** + * Initialize the driver. + * called by init_module() when module dynamically loaded by insmod + */ +static int __init lscpcie2_init(void) +{ + int result; + int i, n; + int err; + //pci_dev_bar_t *p; + //pcie_board_t *pB; + + printk(KERN_INFO "lscpcie2: _init() debug=%d\n", debug); + DrvrDebug = debug; + + /* Initialize the driver database to nothing found, no BARs, no devices */ + memset(&lscpcie2, 0, sizeof(lscpcie2)); + for (n = 0; n < NUM_BOARDS; n++) + for (i = 0; i < NUM_BARS; i++) + lscpcie2.Board[n].Dev_BARs[i].bar = -1; + + /* + * Register device driver as a character device and get a dynamic Major number + * and reserve enough minor numbers for the maximum amount of boards * BARs + * we'd expect to find in a system. + */ + result = alloc_chrdev_region(&lscpcie2.drvrDevNum, // return allocated Device Num here + 0, // first minor number + MAX_MINORS, + "lscpcie2"); + + if (result < 0) + { + printk(KERN_WARNING "lscpcie2: can't get major/minor numbers!\n"); + return(result); + } + + + if (DrvrDebug) + printk(KERN_INFO "lscpcie2: Major=%d num boards=%d\n", MAJOR(lscpcie2.drvrDevNum), lscpcie2.numBoards ); + + + if (DrvrDebug) + printk(KERN_INFO "lscpcie2: cdev_init()\n"); + + + + /* Create the new sysfs Class entry that will hold the tree of detected Lattice PCIe Eval + * board devices. + */ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)) + lscpcie2.sysClass = class_create(THIS_MODULE, "lscpcie2"); +#else + lscpcie2.sysClass = class_simple_create(THIS_MODULE, "lscpcie2"); +#endif + if (IS_ERR(lscpcie2.sysClass)) + { + printk(KERN_ERR "lscpcie2: Error creating simple class interface\n"); + return(-1); + } + + + + if (DrvrDebug) + printk(KERN_INFO "lscpcie2: registering driver with PCI\n"); + + + /* Register our PCI components and functions with the Kernel PCI core. + * Returns negative number for error, and 0 if success. It does not always + * return the number of devices found and bound to the driver because of hot + * plug - they could be bound later. + */ + err = pci_register_driver(&lscpcie2_driver); + + if (DrvrDebug) + printk(KERN_INFO "lscpcie2: pci_register_driver()=%d\n", err); + + if (err < 0) + return(err); + + +#ifdef USE_PROC /* only when available */ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)) + proc_create("driver/lscpcie2", 0, 0, &drvr_fops); +#else + create_proc_read_entry("driver/lscpcie2", 0, 0, lscpcie2_read_procmem, NULL); +#endif +#endif + + + return(0); /* succeed */ + +} + + +/** + * Driver clean-up. + * Called when module is unloaded by kernel or rmmod + */ +static void __exit lscpcie2_exit(void) +{ + int i; + + printk(KERN_INFO "lscpcie2: _exit()\n"); + + + pci_unregister_driver(&lscpcie2_driver); + + for (i = 0; i < NUM_BOARDS; i++) + { + if (lscpcie2.Board[i].ID != 0) + { + /* Do the cleanup for each active board */ + printk(KERN_INFO "lscpcie2: Cleaning up board: %d\n", i); + + // Disable and release IRQ if still active + } + } + + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)) + class_destroy(lscpcie2.sysClass); +#else + class_simple_destroy(lscpcie2.sysClass); +#endif + + // Free every minor number and major number we reserved in init + unregister_chrdev_region(lscpcie2.drvrDevNum, MAX_MINORS); + + +#ifdef USE_PROC + remove_proc_entry("driver/lscpcie2", NULL); +#endif + + return; +} + + +/* + * Kernel Dynamic Loadable Module Interface APIs + */ + +module_init(lscpcie2_init); +module_exit(lscpcie2_exit); + + + diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/modules/mcp3425_smbus.c b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/modules/mcp3425_smbus.c new file mode 100644 index 0000000000..fea7a65886 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/modules/mcp3425_smbus.c @@ -0,0 +1,406 @@ +/* + * mcp3422.c - driver for the Microchip mcp3421/2/3/4/5/6/7/8 chip family + * + * Copyright (C) 2013, Angelo Compagnucci + * Author: Angelo Compagnucci + * + * Datasheet: http://ww1.microchip.com/downloads/en/devicedoc/22088b.pdf + * http://ww1.microchip.com/downloads/en/DeviceDoc/22226a.pdf + * http://ww1.microchip.com/downloads/en/DeviceDoc/22072b.pdf + * + * This driver exports the value of analog input voltage to sysfs, the + * voltage unit is nV. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include + +#include +#include + +/* Masks */ +#define MCP3422_CHANNEL_MASK 0x60 +#define MCP3422_PGA_MASK 0x03 +#define MCP3422_SRATE_MASK 0x0C +#define MCP3422_SRATE_240 0x0 +#define MCP3422_SRATE_60 0x1 +#define MCP3422_SRATE_15 0x2 +#define MCP3422_SRATE_3 0x3 +#define MCP3422_PGA_1 0 +#define MCP3422_PGA_2 1 +#define MCP3422_PGA_4 2 +#define MCP3422_PGA_8 3 +#define MCP3422_CONT_SAMPLING 0x10 + +#define MCP3422_CHANNEL(config) (((config) & MCP3422_CHANNEL_MASK) >> 5) +#define MCP3422_PGA(config) ((config) & MCP3422_PGA_MASK) +#define MCP3422_SAMPLE_RATE(config) (((config) & MCP3422_SRATE_MASK) >> 2) + +#define MCP3422_CHANNEL_VALUE(value) (((value) << 5) & MCP3422_CHANNEL_MASK) +#define MCP3422_PGA_VALUE(value) ((value) & MCP3422_PGA_MASK) +#define MCP3422_SAMPLE_RATE_VALUE(value) ((value << 2) & MCP3422_SRATE_MASK) + +#define MCP3422_CHAN(_index) \ + { \ + .type = IIO_VOLTAGE, \ + .indexed = 1, \ + .channel = _index, \ + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) \ + | BIT(IIO_CHAN_INFO_SCALE), \ + .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SAMP_FREQ), \ + } + +static const int mcp3422_scales[4][4] = { + { 1000000, 500000, 250000, 125000 }, + { 250000, 125000, 62500, 31250 }, + { 62500, 31250, 15625, 7812 }, + { 15625, 7812, 3906, 1953 } }; + +/* Constant msleep times for data acquisitions */ +static const int mcp3422_read_times[4] = { + [MCP3422_SRATE_240] = 1000 / 240, + [MCP3422_SRATE_60] = 1000 / 60, + [MCP3422_SRATE_15] = 1000 / 15, + [MCP3422_SRATE_3] = 1000 / 3 }; + +/* sample rates to integer conversion table */ +static const int mcp3422_sample_rates[4] = { + [MCP3422_SRATE_240] = 240, + [MCP3422_SRATE_60] = 60, + [MCP3422_SRATE_15] = 15, + [MCP3422_SRATE_3] = 3 }; + +/* sample rates to sign extension table */ +static const int mcp3422_sign_extend[4] = { + [MCP3422_SRATE_240] = 11, + [MCP3422_SRATE_60] = 13, + [MCP3422_SRATE_15] = 15, + [MCP3422_SRATE_3] = 17 }; + +/* Client data (each client gets its own) */ +struct mcp3422 { + struct i2c_client *i2c; + u8 id; + u8 config; + u8 pga[4]; + struct mutex lock; +}; + +static int mcp3422_update_config(struct mcp3422 *adc, u8 newconfig) +{ + int ret; + + mutex_lock(&adc->lock); + + ret = i2c_master_send(adc->i2c, &newconfig, 1); + if (ret > 0) { + adc->config = newconfig; + ret = 0; + } + + mutex_unlock(&adc->lock); + + return ret; +} + +static int mcp3422_read(struct mcp3422 *adc, int *value, u8 *config) +{ + int ret = 0; + u8 sample_rate = MCP3422_SAMPLE_RATE(adc->config); + u8 buf[4] = {0, 0, 0, 0}; + u32 temp; + + if (sample_rate == MCP3422_SRATE_3) { + //ret = i2c_master_recv(adc->i2c, buf, 4); + ret = i2c_smbus_read_i2c_block_data(adc->i2c, 0, 4 , buf); + temp = buf[0] << 16 | buf[1] << 8 | buf[2]; + *config = buf[3]; + } else { + //ret = i2c_master_recv(adc->i2c, buf, 3); + ret = i2c_smbus_read_i2c_block_data(adc->i2c, 0, 3 , buf); + temp = buf[0] << 8 | buf[1]; + *config = buf[2]; + } + + *value = sign_extend32(temp, mcp3422_sign_extend[sample_rate]); + + return ret; +} + +static int mcp3422_read_channel(struct mcp3422 *adc, + struct iio_chan_spec const *channel, int *value) +{ + int ret; + u8 config; + u8 req_channel = channel->channel; + + if (req_channel != MCP3422_CHANNEL(adc->config)) { + config = adc->config; + config &= ~MCP3422_CHANNEL_MASK; + config |= MCP3422_CHANNEL_VALUE(req_channel); + config &= ~MCP3422_PGA_MASK; + config |= MCP3422_PGA_VALUE(adc->pga[req_channel]); + ret = mcp3422_update_config(adc, config); + if (ret < 0) + return ret; + msleep(mcp3422_read_times[MCP3422_SAMPLE_RATE(adc->config)]); + } + + return mcp3422_read(adc, value, &config); +} + +static int mcp3422_read_raw(struct iio_dev *iio, + struct iio_chan_spec const *channel, int *val1, + int *val2, long mask) +{ + struct mcp3422 *adc = iio_priv(iio); + int err; + + u8 sample_rate = MCP3422_SAMPLE_RATE(adc->config); + u8 pga = MCP3422_PGA(adc->config); + + switch (mask) { + case IIO_CHAN_INFO_RAW: + err = mcp3422_read_channel(adc, channel, val1); + if (err < 0) + return -EINVAL; + return IIO_VAL_INT; + + case IIO_CHAN_INFO_SCALE: + + *val1 = 0; + *val2 = mcp3422_scales[sample_rate][pga]; + return IIO_VAL_INT_PLUS_NANO; + + case IIO_CHAN_INFO_SAMP_FREQ: + *val1 = mcp3422_sample_rates[MCP3422_SAMPLE_RATE(adc->config)]; + return IIO_VAL_INT; + + default: + break; + } + + return -EINVAL; +} + +static int mcp3422_write_raw(struct iio_dev *iio, + struct iio_chan_spec const *channel, int val1, + int val2, long mask) +{ + struct mcp3422 *adc = iio_priv(iio); + u8 temp; + u8 config = adc->config; + u8 req_channel = channel->channel; + u8 sample_rate = MCP3422_SAMPLE_RATE(config); + u8 i; + + switch (mask) { + case IIO_CHAN_INFO_SCALE: + if (val1 != 0) + return -EINVAL; + + for (i = 0; i < ARRAY_SIZE(mcp3422_scales[0]); i++) { + if (val2 == mcp3422_scales[sample_rate][i]) { + adc->pga[req_channel] = i; + + config &= ~MCP3422_CHANNEL_MASK; + config |= MCP3422_CHANNEL_VALUE(req_channel); + config &= ~MCP3422_PGA_MASK; + config |= MCP3422_PGA_VALUE(adc->pga[req_channel]); + + return mcp3422_update_config(adc, config); + } + } + return -EINVAL; + + case IIO_CHAN_INFO_SAMP_FREQ: + switch (val1) { + case 240: + temp = MCP3422_SRATE_240; + break; + case 60: + temp = MCP3422_SRATE_60; + break; + case 15: + temp = MCP3422_SRATE_15; + break; + case 3: + if (adc->id > 4) + return -EINVAL; + temp = MCP3422_SRATE_3; + break; + default: + return -EINVAL; + } + + config &= ~MCP3422_CHANNEL_MASK; + config |= MCP3422_CHANNEL_VALUE(req_channel); + config &= ~MCP3422_SRATE_MASK; + config |= MCP3422_SAMPLE_RATE_VALUE(temp); + + return mcp3422_update_config(adc, config); + + default: + break; + } + + return -EINVAL; +} + +static int mcp3422_write_raw_get_fmt(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, long mask) +{ + switch (mask) { + case IIO_CHAN_INFO_SCALE: + return IIO_VAL_INT_PLUS_NANO; + case IIO_CHAN_INFO_SAMP_FREQ: + return IIO_VAL_INT_PLUS_MICRO; + default: + return -EINVAL; + } +} + +static ssize_t mcp3422_show_samp_freqs(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct mcp3422 *adc = iio_priv(dev_to_iio_dev(dev)); + + if (adc->id > 4) + return sprintf(buf, "240 60 15\n"); + + return sprintf(buf, "240 60 15 3\n"); +} + +static ssize_t mcp3422_show_scales(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct mcp3422 *adc = iio_priv(dev_to_iio_dev(dev)); + u8 sample_rate = MCP3422_SAMPLE_RATE(adc->config); + + return sprintf(buf, "0.%09u 0.%09u 0.%09u 0.%09u\n", + mcp3422_scales[sample_rate][0], + mcp3422_scales[sample_rate][1], + mcp3422_scales[sample_rate][2], + mcp3422_scales[sample_rate][3]); +} + +static IIO_DEVICE_ATTR(sampling_frequency_available, S_IRUGO, + mcp3422_show_samp_freqs, NULL, 0); +static IIO_DEVICE_ATTR(in_voltage_scale_available, S_IRUGO, + mcp3422_show_scales, NULL, 0); + +static struct attribute *mcp3422_attributes[] = { + &iio_dev_attr_sampling_frequency_available.dev_attr.attr, + &iio_dev_attr_in_voltage_scale_available.dev_attr.attr, + NULL, +}; + +static const struct attribute_group mcp3422_attribute_group = { + .attrs = mcp3422_attributes, +}; + +static const struct iio_chan_spec mcp3421_channels[] = { + MCP3422_CHAN(0), +}; + +static const struct iio_chan_spec mcp3422_channels[] = { + MCP3422_CHAN(0), + MCP3422_CHAN(1), +}; + +static const struct iio_chan_spec mcp3424_channels[] = { + MCP3422_CHAN(0), + MCP3422_CHAN(1), + MCP3422_CHAN(2), + MCP3422_CHAN(3), +}; + +static const struct iio_info mcp3422_info = { + .read_raw = mcp3422_read_raw, + .write_raw = mcp3422_write_raw, + .write_raw_get_fmt = mcp3422_write_raw_get_fmt, + .attrs = &mcp3422_attribute_group, + .driver_module = THIS_MODULE, +}; + +static int mcp3422_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct iio_dev *indio_dev; + struct mcp3422 *adc; + int err; + u8 config; +#if 0 + if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) + return -EOPNOTSUPP; +#endif + indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*adc)); + if (!indio_dev) + return -ENOMEM; + + adc = iio_priv(indio_dev); + adc->i2c = client; + adc->id = (u8)(id->driver_data); + + mutex_init(&adc->lock); + + indio_dev->dev.parent = &client->dev; + indio_dev->dev.of_node = client->dev.of_node; + indio_dev->name = dev_name(&client->dev); + indio_dev->modes = INDIO_DIRECT_MODE; + indio_dev->info = &mcp3422_info; + + switch (adc->id) { + case 1: + case 5: + indio_dev->channels = mcp3421_channels; + indio_dev->num_channels = ARRAY_SIZE(mcp3421_channels); + break; + } + + /* meaningful default configuration */ + config = (MCP3422_CONT_SAMPLING + | MCP3422_CHANNEL_VALUE(1) + | MCP3422_PGA_VALUE(MCP3422_PGA_1) + | MCP3422_SAMPLE_RATE_VALUE(MCP3422_SRATE_240)); + mcp3422_update_config(adc, config); + + err = devm_iio_device_register(&client->dev, indio_dev); + if (err < 0) + return err; + + i2c_set_clientdata(client, indio_dev); + + return 0; +} + +static const struct i2c_device_id mcp3422_id[] = { + + { "mcp3425_smbus", 5 }, + + { } +}; +MODULE_DEVICE_TABLE(i2c, mcp3422_id); + +static struct i2c_driver mcp3422_driver = { + .driver = { + .name = "mcp3425_smbus", + .of_match_table = of_match_ptr(mcp3422_of_match), + }, + .probe = mcp3422_probe, + .id_table = mcp3422_id, +}; +module_i2c_driver(mcp3422_driver); + +MODULE_AUTHOR("Angelo Compagnucci "); +MODULE_DESCRIPTION("Modify from mcp3422.c(Microchip mcp3421/2/3/4/5/6/7/8 driver)"); +MODULE_LICENSE("GPL v2"); diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/modules/nct7511.c b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/modules/nct7511.c new file mode 100644 index 0000000000..8ddf1919f5 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/modules/nct7511.c @@ -0,0 +1,765 @@ +/* + + */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRVNAME "nct7511" + + +#define REG_BANK 0x00 +#define REG_TEMP_LSB 0x05 +#define REG_FANCOUNT_LOW 0x13 +#define REG_START 0x21 +#define REG_MODE 0x22 /* 7.2.32 Mode Selection Register */ +#define REG_FAN_ENABLE 0x24 +#define REG_PWM(x) (0x60 + (x)) +#define REG_SMARTFAN_EN(x) (0x64 + (x) / 2) +#define SMARTFAN_EN_SHIFT(x) ((x) % 2 * 4) +#define REG_VENDOR_ID 0xfd +#define REG_CHIP_ID 0xfe +#define REG_VERSION_ID 0xff + +/* + * Data structures and manipulation thereof + */ + +struct nct7511_data { + struct regmap *regmap; + struct mutex access_lock; /* for multi-byte read and write operations */ +}; + +static ssize_t show_temp_type(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct nct7511_data *data = dev_get_drvdata(dev); + struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr); + unsigned int mode; + int ret; + + ret = regmap_read(data->regmap, REG_MODE, &mode); + if (ret < 0) + return ret; + + return sprintf(buf, "%u\n", (mode >> (2 * sattr->index) & 3) + 2); +} + +static ssize_t store_temp_type(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct nct7511_data *data = dev_get_drvdata(dev); + struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr); + unsigned int type; + int err; + + err = kstrtouint(buf, 0, &type); + if (err < 0) + return err; + if (sattr->index == 2 && type != 4) /* RD3 */ + return -EINVAL; + if (type < 3 || type > 4) + return -EINVAL; + err = regmap_update_bits(data->regmap, REG_MODE, + 3 << 2 * sattr->index, (type - 2) << 2 * sattr->index); + return err ? : count; +} + +static ssize_t show_pwm_mode(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr); + struct nct7511_data *data = dev_get_drvdata(dev); + unsigned int regval; + int ret; + + if (sattr->index > 1) + return sprintf(buf, "1\n"); + + ret = regmap_read(data->regmap, 0x5E, ®val); + if (ret < 0) + return ret; + + return sprintf(buf, "%u\n", !(regval & (1 << sattr->index))); +} + +static ssize_t show_pwm(struct device *dev, struct device_attribute *devattr, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct nct7511_data *data = dev_get_drvdata(dev); + unsigned int val; + int ret; + + if (!attr->index) + return sprintf(buf, "255\n"); + + ret = regmap_read(data->regmap, attr->index, &val); + if (ret < 0) + return ret; + + return sprintf(buf, "%d\n", val); +} + +static ssize_t store_pwm(struct device *dev, struct device_attribute *devattr, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct nct7511_data *data = dev_get_drvdata(dev); + int err; + u8 val; + + err = kstrtou8(buf, 0, &val); + if (err < 0) + return err; + + err = regmap_write(data->regmap, attr->index, val); + return err ? : count; +} + +static ssize_t show_pwm_enable(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct nct7511_data *data = dev_get_drvdata(dev); + struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr); + unsigned int reg, enabled; + int ret; + + ret = regmap_read(data->regmap, REG_SMARTFAN_EN(sattr->index), ®); + if (ret < 0) + return ret; + enabled = reg >> SMARTFAN_EN_SHIFT(sattr->index) & 1; + return sprintf(buf, "%u\n", enabled + 1); +} + +static ssize_t store_pwm_enable(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct nct7511_data *data = dev_get_drvdata(dev); + struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr); + u8 val; + int ret; + + ret = kstrtou8(buf, 0, &val); + if (ret < 0) + return ret; + if (val < 1 || val > 2) + return -EINVAL; + ret = regmap_update_bits(data->regmap, REG_SMARTFAN_EN(sattr->index), + 1 << SMARTFAN_EN_SHIFT(sattr->index), + (val - 1) << SMARTFAN_EN_SHIFT(sattr->index)); + return ret ? : count; +} + +static int nct7511_read_temp(struct nct7511_data *data, + u8 reg_temp, u8 reg_temp_low, int *temp) +{ + unsigned int t1, t2 = 0; + int err; + + *temp = 0; + + mutex_lock(&data->access_lock); + err = regmap_read(data->regmap, reg_temp, &t1); + if (err < 0) + goto abort; + t1 <<= 8; + if (reg_temp_low) { /* 11 bit data */ + err = regmap_read(data->regmap, reg_temp_low, &t2); + if (err < 0) + goto abort; + } + t1 |= t2 & 0xe0; + *temp = (s16)t1 / 32 * 125; +abort: + mutex_unlock(&data->access_lock); + return err; +} + +static int nct7511_read_fan(struct nct7511_data *data, u8 reg_fan) +{ + unsigned int f1, f2; + int ret; + + mutex_lock(&data->access_lock); + ret = regmap_read(data->regmap, reg_fan, &f1); + if (ret < 0) + goto abort; + ret = regmap_read(data->regmap, REG_FANCOUNT_LOW, &f2); + if (ret < 0) + goto abort; + ret = (f1 << 5) | (f2 >> 3); + /* convert fan count to rpm */ + if (ret == 0x1fff) /* maximum value, assume fan is stopped */ + ret = 0; + else if (ret) + ret = DIV_ROUND_CLOSEST(1350000U, ret); +abort: + mutex_unlock(&data->access_lock); + return ret; +} + +static int nct7511_read_fan_min(struct nct7511_data *data, u8 reg_fan_low, + u8 reg_fan_high) +{ + unsigned int f1, f2; + int ret; + + mutex_lock(&data->access_lock); + ret = regmap_read(data->regmap, reg_fan_low, &f1); + if (ret < 0) + goto abort; + ret = regmap_read(data->regmap, reg_fan_high, &f2); + if (ret < 0) + goto abort; + ret = f1 | ((f2 & 0xf8) << 5); + /* convert fan count to rpm */ + if (ret == 0x1fff) /* maximum value, assume no limit */ + ret = 0; + else if (ret) + ret = DIV_ROUND_CLOSEST(1350000U, ret); + else + ret = 1350000U; +abort: + mutex_unlock(&data->access_lock); + return ret; +} + +static int nct7511_write_fan_min(struct nct7511_data *data, u8 reg_fan_low, + u8 reg_fan_high, unsigned long limit) +{ + int err; + + if (limit) + limit = DIV_ROUND_CLOSEST(1350000U, limit); + else + limit = 0x1fff; + limit = clamp_val(limit, 0, 0x1fff); + + mutex_lock(&data->access_lock); + err = regmap_write(data->regmap, reg_fan_low, limit & 0xff); + if (err < 0) + goto abort; + + err = regmap_write(data->regmap, reg_fan_high, (limit & 0x1f00) >> 5); +abort: + mutex_unlock(&data->access_lock); + return err; +} + +static ssize_t show_temp(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct nct7511_data *data = dev_get_drvdata(dev); + struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); + int err, temp; + + err = nct7511_read_temp(data, sattr->nr, sattr->index, &temp); + if (err < 0) + return err; + + return sprintf(buf, "%d\n", temp); +} + +static ssize_t store_temp(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); + struct nct7511_data *data = dev_get_drvdata(dev); + int nr = sattr->nr; + long val; + int err; + + err = kstrtol(buf, 10, &val); + if (err < 0) + return err; + + val = DIV_ROUND_CLOSEST(clamp_val(val, -128000, 127000), 1000); + + err = regmap_write(data->regmap, nr, val & 0xff); + return err ? : count; +} + +static ssize_t show_fan(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr); + struct nct7511_data *data = dev_get_drvdata(dev); + int speed; + + speed = nct7511_read_fan(data, sattr->index); + if (speed < 0) + return speed; + + return sprintf(buf, "%d\n", speed); +} + +static ssize_t show_fan_min(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); + struct nct7511_data *data = dev_get_drvdata(dev); + int speed; + + speed = nct7511_read_fan_min(data, sattr->nr, sattr->index); + if (speed < 0) + return speed; + + return sprintf(buf, "%d\n", speed); +} + +static ssize_t store_fan_min(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); + struct nct7511_data *data = dev_get_drvdata(dev); + unsigned long val; + int err; + + err = kstrtoul(buf, 10, &val); + if (err < 0) + return err; + + err = nct7511_write_fan_min(data, sattr->nr, sattr->index, val); + return err ? : count; +} + +static ssize_t show_alarm(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct nct7511_data *data = dev_get_drvdata(dev); + struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); + int bit = sattr->index; + unsigned int val; + int ret; + + ret = regmap_read(data->regmap, sattr->nr, &val); + if (ret < 0) + return ret; + + return sprintf(buf, "%u\n", !!(val & (1 << bit))); +} + +static ssize_t +show_beep(struct device *dev, struct device_attribute *attr, char *buf) +{ + struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); + struct nct7511_data *data = dev_get_drvdata(dev); + unsigned int regval; + int err; + + err = regmap_read(data->regmap, sattr->nr, ®val); + if (err) + return err; + + return sprintf(buf, "%u\n", !!(regval & (1 << sattr->index))); +} + +static ssize_t +store_beep(struct device *dev, struct device_attribute *attr, const char *buf, + size_t count) +{ + struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); + struct nct7511_data *data = dev_get_drvdata(dev); + unsigned long val; + int err; + + err = kstrtoul(buf, 10, &val); + if (err < 0) + return err; + if (val > 1) + return -EINVAL; + + err = regmap_update_bits(data->regmap, sattr->nr, 1 << sattr->index, + val ? 1 << sattr->index : 0); + return err ? : count; +} + +static SENSOR_DEVICE_ATTR(temp1_type, S_IRUGO | S_IWUSR, + show_temp_type, store_temp_type, 0); +static SENSOR_DEVICE_ATTR_2(temp1_input, S_IRUGO, show_temp, NULL, 0x01, + REG_TEMP_LSB); +static SENSOR_DEVICE_ATTR_2(temp1_min, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x31, 0); +static SENSOR_DEVICE_ATTR_2(temp1_max, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x30, 0); +static SENSOR_DEVICE_ATTR_2(temp1_crit, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x3a, 0); + +static SENSOR_DEVICE_ATTR(temp2_type, S_IRUGO | S_IWUSR, + show_temp_type, store_temp_type, 1); +static SENSOR_DEVICE_ATTR_2(temp2_input, S_IRUGO, show_temp, NULL, 0x02, + REG_TEMP_LSB); +static SENSOR_DEVICE_ATTR_2(temp2_min, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x33, 0); +static SENSOR_DEVICE_ATTR_2(temp2_max, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x32, 0); +static SENSOR_DEVICE_ATTR_2(temp2_crit, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x3b, 0); + +static SENSOR_DEVICE_ATTR(temp3_type, S_IRUGO | S_IWUSR, + show_temp_type, store_temp_type, 2); +static SENSOR_DEVICE_ATTR_2(temp3_input, S_IRUGO, show_temp, NULL, 0x03, + REG_TEMP_LSB); +static SENSOR_DEVICE_ATTR_2(temp3_min, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x35, 0); +static SENSOR_DEVICE_ATTR_2(temp3_max, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x34, 0); +static SENSOR_DEVICE_ATTR_2(temp3_crit, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x3c, 0); + +static SENSOR_DEVICE_ATTR_2(temp4_input, S_IRUGO, show_temp, NULL, 0x04, 0); +static SENSOR_DEVICE_ATTR_2(temp4_min, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x37, 0); +static SENSOR_DEVICE_ATTR_2(temp4_max, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x36, 0); +static SENSOR_DEVICE_ATTR_2(temp4_crit, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x3d, 0); + + +static SENSOR_DEVICE_ATTR_2(temp1_min_alarm, S_IRUGO, show_alarm, NULL, + 0x18, 0); +static SENSOR_DEVICE_ATTR_2(temp2_min_alarm, S_IRUGO, show_alarm, NULL, + 0x18, 1); +static SENSOR_DEVICE_ATTR_2(temp3_min_alarm, S_IRUGO, show_alarm, NULL, + 0x18, 2); +static SENSOR_DEVICE_ATTR_2(temp4_min_alarm, S_IRUGO, show_alarm, NULL, + 0x18, 3); + +static SENSOR_DEVICE_ATTR_2(temp1_max_alarm, S_IRUGO, show_alarm, NULL, + 0x19, 0); +static SENSOR_DEVICE_ATTR_2(temp2_max_alarm, S_IRUGO, show_alarm, NULL, + 0x19, 1); +static SENSOR_DEVICE_ATTR_2(temp3_max_alarm, S_IRUGO, show_alarm, NULL, + 0x19, 2); +static SENSOR_DEVICE_ATTR_2(temp4_max_alarm, S_IRUGO, show_alarm, NULL, + 0x19, 3); + + +static SENSOR_DEVICE_ATTR_2(temp1_crit_alarm, S_IRUGO, show_alarm, NULL, + 0x1b, 0); +static SENSOR_DEVICE_ATTR_2(temp2_crit_alarm, S_IRUGO, show_alarm, NULL, + 0x1b, 1); +static SENSOR_DEVICE_ATTR_2(temp3_crit_alarm, S_IRUGO, show_alarm, NULL, + 0x1b, 2); +static SENSOR_DEVICE_ATTR_2(temp4_crit_alarm, S_IRUGO, show_alarm, NULL, + 0x1b, 3); + +static SENSOR_DEVICE_ATTR_2(temp1_fault, S_IRUGO, show_alarm, NULL, 0x17, 0); +static SENSOR_DEVICE_ATTR_2(temp2_fault, S_IRUGO, show_alarm, NULL, 0x17, 1); +static SENSOR_DEVICE_ATTR_2(temp3_fault, S_IRUGO, show_alarm, NULL, 0x17, 2); + +static SENSOR_DEVICE_ATTR_2(temp1_beep, S_IRUGO | S_IWUSR, show_beep, + store_beep, 0x5c, 0); +static SENSOR_DEVICE_ATTR_2(temp2_beep, S_IRUGO | S_IWUSR, show_beep, + store_beep, 0x5c, 1); +static SENSOR_DEVICE_ATTR_2(temp3_beep, S_IRUGO | S_IWUSR, show_beep, + store_beep, 0x5c, 2); +static SENSOR_DEVICE_ATTR_2(temp4_beep, S_IRUGO | S_IWUSR, show_beep, + store_beep, 0x5c, 3); + +static struct attribute *nct7511_temp_attrs[] = { + &sensor_dev_attr_temp1_type.dev_attr.attr, + &sensor_dev_attr_temp1_input.dev_attr.attr, + &sensor_dev_attr_temp1_min.dev_attr.attr, + &sensor_dev_attr_temp1_max.dev_attr.attr, + &sensor_dev_attr_temp1_crit.dev_attr.attr, + &sensor_dev_attr_temp1_min_alarm.dev_attr.attr, + &sensor_dev_attr_temp1_max_alarm.dev_attr.attr, + &sensor_dev_attr_temp1_crit_alarm.dev_attr.attr, + &sensor_dev_attr_temp1_fault.dev_attr.attr, + &sensor_dev_attr_temp1_beep.dev_attr.attr, + + &sensor_dev_attr_temp2_type.dev_attr.attr, /* 10 */ + &sensor_dev_attr_temp2_input.dev_attr.attr, + &sensor_dev_attr_temp2_min.dev_attr.attr, + &sensor_dev_attr_temp2_max.dev_attr.attr, + &sensor_dev_attr_temp2_crit.dev_attr.attr, + &sensor_dev_attr_temp2_min_alarm.dev_attr.attr, + &sensor_dev_attr_temp2_max_alarm.dev_attr.attr, + &sensor_dev_attr_temp2_crit_alarm.dev_attr.attr, + &sensor_dev_attr_temp2_fault.dev_attr.attr, + &sensor_dev_attr_temp2_beep.dev_attr.attr, + + &sensor_dev_attr_temp3_type.dev_attr.attr, /* 20 */ + &sensor_dev_attr_temp3_input.dev_attr.attr, + &sensor_dev_attr_temp3_min.dev_attr.attr, + &sensor_dev_attr_temp3_max.dev_attr.attr, + &sensor_dev_attr_temp3_crit.dev_attr.attr, + &sensor_dev_attr_temp3_min_alarm.dev_attr.attr, + &sensor_dev_attr_temp3_max_alarm.dev_attr.attr, + &sensor_dev_attr_temp3_crit_alarm.dev_attr.attr, + &sensor_dev_attr_temp3_fault.dev_attr.attr, + &sensor_dev_attr_temp3_beep.dev_attr.attr, + + &sensor_dev_attr_temp4_input.dev_attr.attr, /* 30 */ + &sensor_dev_attr_temp4_min.dev_attr.attr, + &sensor_dev_attr_temp4_max.dev_attr.attr, + &sensor_dev_attr_temp4_crit.dev_attr.attr, + &sensor_dev_attr_temp4_min_alarm.dev_attr.attr, + &sensor_dev_attr_temp4_max_alarm.dev_attr.attr, + &sensor_dev_attr_temp4_crit_alarm.dev_attr.attr, + &sensor_dev_attr_temp4_beep.dev_attr.attr, + + NULL +}; + +static umode_t nct7511_temp_is_visible(struct kobject *kobj, + struct attribute *attr, int index) +{ + struct device *dev = container_of(kobj, struct device, kobj); + struct nct7511_data *data = dev_get_drvdata(dev); + unsigned int reg; + int err; + + err = regmap_read(data->regmap, REG_MODE, ®); + if (err < 0) + return 0; + + if (index < 10 && + (reg & 03) != 0x01 && (reg & 0x03) != 0x02) /* RD1 */ + return 0; + + if (index >= 10 && index < 20 && + (reg & 0x0c) != 0x04 && (reg & 0x0c) != 0x08) /* RD2 */ + return 0; + if (index >= 20 && index < 30 && (reg & 0x30) != 0x20) /* RD3 */ + return 0; + + if (index >= 30 && index < 38) /* local */ + return attr->mode; + + return attr->mode; +} + +static struct attribute_group nct7511_temp_group = { + .attrs = nct7511_temp_attrs, + .is_visible = nct7511_temp_is_visible, +}; + + +static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_fan, NULL, 0x10); +static SENSOR_DEVICE_ATTR_2(fan1_min, S_IRUGO | S_IWUSR, show_fan_min, + store_fan_min, 0x49, 0x4c); +static SENSOR_DEVICE_ATTR_2(fan1_alarm, S_IRUGO, show_alarm, NULL, 0x1a, 0); +static SENSOR_DEVICE_ATTR_2(fan1_beep, S_IRUGO | S_IWUSR, show_beep, store_beep, + 0x5b, 0); + +/* 7.2.89 Fan Control Output Type */ +static SENSOR_DEVICE_ATTR(pwm1_mode, S_IRUGO, show_pwm_mode, NULL, 0); + +/* 7.2.91... Fan Control Output Value */ +static SENSOR_DEVICE_ATTR(pwm1, S_IRUGO | S_IWUSR, show_pwm, store_pwm, + REG_PWM(0)); + + +/* 7.2.95... Temperature to Fan mapping Relationships Register */ +static SENSOR_DEVICE_ATTR(pwm1_enable, S_IRUGO | S_IWUSR, show_pwm_enable, + store_pwm_enable, 0); + + +static struct attribute *nct7511_fan_attrs[] = { + &sensor_dev_attr_fan1_input.dev_attr.attr, + &sensor_dev_attr_fan1_min.dev_attr.attr, + &sensor_dev_attr_fan1_alarm.dev_attr.attr, + &sensor_dev_attr_fan1_beep.dev_attr.attr, + NULL +}; + +static umode_t nct7511_fan_is_visible(struct kobject *kobj, + struct attribute *attr, int index) +{ + struct device *dev = container_of(kobj, struct device, kobj); + struct nct7511_data *data = dev_get_drvdata(dev); + int fan = index / 4; /* 4 attributes per fan */ + unsigned int reg; + int err; + + err = regmap_read(data->regmap, REG_FAN_ENABLE, ®); + if (err < 0 || !(reg & (1 << fan))) + return 0; + + return attr->mode; +} + +static struct attribute_group nct7511_fan_group = { + .attrs = nct7511_fan_attrs, + .is_visible = nct7511_fan_is_visible, +}; + +static struct attribute *nct7511_pwm_attrs[] = { + &sensor_dev_attr_pwm1_enable.dev_attr.attr, + &sensor_dev_attr_pwm1_mode.dev_attr.attr, + &sensor_dev_attr_pwm1.dev_attr.attr, + NULL +}; + +static struct attribute_group nct7511_pwm_group = { + .attrs = nct7511_pwm_attrs, +}; + +/* 7.2.115... 0x80-0x83, 0x84 Temperature (X-axis) transition */ +static SENSOR_DEVICE_ATTR_2(pwm1_auto_point1_temp, S_IRUGO | S_IWUSR, + show_temp, store_temp, 0x80, 0); +static SENSOR_DEVICE_ATTR_2(pwm1_auto_point2_temp, S_IRUGO | S_IWUSR, + show_temp, store_temp, 0x81, 0); +static SENSOR_DEVICE_ATTR_2(pwm1_auto_point3_temp, S_IRUGO | S_IWUSR, + show_temp, store_temp, 0x82, 0); +static SENSOR_DEVICE_ATTR_2(pwm1_auto_point4_temp, S_IRUGO | S_IWUSR, + show_temp, store_temp, 0x83, 0); +static SENSOR_DEVICE_ATTR_2(pwm1_auto_point5_temp, S_IRUGO | S_IWUSR, + show_temp, store_temp, 0x84, 0); + +/* 7.2.120... 0x85-0x88 PWM (Y-axis) transition */ +static SENSOR_DEVICE_ATTR(pwm1_auto_point1_pwm, S_IRUGO | S_IWUSR, + show_pwm, store_pwm, 0x85); +static SENSOR_DEVICE_ATTR(pwm1_auto_point2_pwm, S_IRUGO | S_IWUSR, + show_pwm, store_pwm, 0x86); +static SENSOR_DEVICE_ATTR(pwm1_auto_point3_pwm, S_IRUGO | S_IWUSR, + show_pwm, store_pwm, 0x87); +static SENSOR_DEVICE_ATTR(pwm1_auto_point4_pwm, S_IRUGO | S_IWUSR, + show_pwm, store_pwm, 0x88); +static SENSOR_DEVICE_ATTR(pwm1_auto_point5_pwm, S_IRUGO, show_pwm, NULL, 0); + + +static struct attribute *nct7511_auto_point_attrs[] = { + &sensor_dev_attr_pwm1_auto_point1_temp.dev_attr.attr, + &sensor_dev_attr_pwm1_auto_point2_temp.dev_attr.attr, + &sensor_dev_attr_pwm1_auto_point3_temp.dev_attr.attr, + &sensor_dev_attr_pwm1_auto_point4_temp.dev_attr.attr, + &sensor_dev_attr_pwm1_auto_point5_temp.dev_attr.attr, + + &sensor_dev_attr_pwm1_auto_point1_pwm.dev_attr.attr, + &sensor_dev_attr_pwm1_auto_point2_pwm.dev_attr.attr, + &sensor_dev_attr_pwm1_auto_point3_pwm.dev_attr.attr, + &sensor_dev_attr_pwm1_auto_point4_pwm.dev_attr.attr, + &sensor_dev_attr_pwm1_auto_point5_pwm.dev_attr.attr, + + NULL +}; + +static struct attribute_group nct7511_auto_point_group = { + .attrs = nct7511_auto_point_attrs, +}; + +static const struct attribute_group *nct7511_groups[] = { + &nct7511_temp_group, + &nct7511_fan_group, + &nct7511_pwm_group, + &nct7511_auto_point_group, + NULL +}; + +static int nct7511_detect(struct i2c_client *client, + struct i2c_board_info *info) +{ + int reg; + + reg = i2c_smbus_read_byte_data(client, REG_VENDOR_ID); + if (reg != 0x50) + return -ENODEV; + + reg = i2c_smbus_read_byte_data(client, REG_CHIP_ID); + if (reg != 0xc3) + return -ENODEV; + + reg = i2c_smbus_read_byte_data(client, REG_VERSION_ID); + if (reg < 0 || (reg & 0xf0) != 0x20) + return -ENODEV; + + /* Also validate lower bits of voltage and temperature registers */ + reg = i2c_smbus_read_byte_data(client, REG_TEMP_LSB); + if (reg < 0 || (reg & 0x1f)) + return -ENODEV; + + strlcpy(info->type, "nct7511", I2C_NAME_SIZE); + return 0; +} + +static bool nct7511_regmap_is_volatile(struct device *dev, unsigned int reg) +{ + return (reg != REG_BANK && reg <= 0x20) || + (reg >= REG_PWM(0) && reg <= REG_PWM(2)); +} + +static const struct regmap_config nct7511_regmap_config = { + .reg_bits = 8, + .val_bits = 8, + .cache_type = REGCACHE_RBTREE, + .volatile_reg = nct7511_regmap_is_volatile, +}; + +static int nct7511_init_chip(struct nct7511_data *data) +{ + int err; + + /* Enable ADC */ + err = regmap_update_bits(data->regmap, REG_START, 0x01, 0x01); + if (err) + return err; + /* Enable local temperature sensor */ + return regmap_update_bits(data->regmap, REG_MODE, 0x40, 0x40); +} + +static int nct7511_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct device *dev = &client->dev; + struct nct7511_data *data; + struct device *hwmon_dev; + int ret; + + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + if (data == NULL) + return -ENOMEM; + + data->regmap = devm_regmap_init_i2c(client, &nct7511_regmap_config); + if (IS_ERR(data->regmap)) + return PTR_ERR(data->regmap); + + mutex_init(&data->access_lock); + + ret = nct7511_init_chip(data); + if (ret < 0) + return ret; + + hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name, + data, + nct7511_groups); + return PTR_ERR_OR_ZERO(hwmon_dev); +} + + +static const struct i2c_device_id nct7511_idtable[] = { + { "nct7511", 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, nct7511_idtable); + +static struct i2c_driver nct7511_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = DRVNAME, + }, + .detect = nct7511_detect, + .probe = nct7511_probe, + .id_table = nct7511_idtable, +}; + +module_i2c_driver(nct7511_driver); + +MODULE_AUTHOR("Cameo "); +MODULE_DESCRIPTION("NCT7511Y Hardware Monitoring Driver"); +MODULE_LICENSE("GPL v2"); diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/modules/phy_cpld640.c b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/modules/phy_cpld640.c new file mode 100644 index 0000000000..db2a5b3055 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/modules/phy_cpld640.c @@ -0,0 +1,1102 @@ +/* An hwmon driver for Cameo ESC600-128Q i2c Module */ + +#pragma GCC diagnostic ignored "-Wformat-zero-length" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define ESC_600_INT_WANTED +//#define PREVIOUS_CHECK_TYPE + +#define DEBUG_MSG +#ifdef DEBUG_MSG + #define debug_print(s) printk s +#else + #define debug_print(s) +#endif + +#define TURN_OFF 0 +#define TURN_ON 1 + +enum model_type{ + MODEL_TYPE_100G = 0, + MODEL_TYPE_400G = 1, + MODEL_TYPE_UNKNOWN = 2 +}; + +/* Addresses scanned */ +static const unsigned short normal_i2c[] = { 0x32, I2C_CLIENT_END }; + +/*0x32 PHY CPLD*/ +static ssize_t portnum_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t model_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t phy_reset_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +#ifdef ESC_600_INT_WANTED +static ssize_t QSFP_int_get(struct device *dev, struct device_attribute *da, char *buf); +#endif +static ssize_t QSFP_status_all_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t low_power_all_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t low_power_all_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t low_power_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t low_power_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t qsfp_reset_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t qsfp_status_get(struct device *dev, struct device_attribute *da, char *buf); + +/* struct i2c_data */ +struct Cameo_i2c_data +{ + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ +#ifdef PREVIOUS_CHECK_TYPE + u8 model_type; +#endif +}; + +/* struct i2c_sysfs_attributes */ +enum Cameo_i2c_sysfs_attributes +{ + /*0x32 PHY CPLD*/ + SLOT_PORTNUM, + SLOT_MODEL, + QSFP_LOW_POWER_ALL, + QSFP_RESET, + QSFP_PRESENT, + QSFP_INT +}; +/* end of struct i2c_sysfs_attributes */ + +/* sysfs attributes for SENSOR_DEVICE_ATTR */ +/*phy_cpld640_QSFP_attributes*/ +#ifdef ESC_600_INT_WANTED +static SENSOR_DEVICE_ATTR(QSFP_int , S_IRUGO , QSFP_int_get , NULL , QSFP_INT); +#endif +static SENSOR_DEVICE_ATTR(phy_reset , S_IRUGO | S_IWUSR , NULL , phy_reset_set , 0); +static SENSOR_DEVICE_ATTR(portnum , S_IRUGO , portnum_get , NULL , SLOT_PORTNUM); +static SENSOR_DEVICE_ATTR(model , S_IRUGO , model_get , NULL , SLOT_MODEL); +static SENSOR_DEVICE_ATTR(QSFP_reset_1 , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 1); +static SENSOR_DEVICE_ATTR(QSFP_reset_2 , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 2); +static SENSOR_DEVICE_ATTR(QSFP_reset_3 , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 3); +static SENSOR_DEVICE_ATTR(QSFP_reset_4 , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 4); +static SENSOR_DEVICE_ATTR(QSFP_reset_5 , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 5); +static SENSOR_DEVICE_ATTR(QSFP_reset_6 , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 6); +static SENSOR_DEVICE_ATTR(QSFP_reset_7 , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 7); +static SENSOR_DEVICE_ATTR(QSFP_reset_8 , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 8); +static SENSOR_DEVICE_ATTR(QSFP_reset_9 , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 9); +static SENSOR_DEVICE_ATTR(QSFP_reset_10 , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 10); +static SENSOR_DEVICE_ATTR(QSFP_reset_11 , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 11); +static SENSOR_DEVICE_ATTR(QSFP_reset_12 , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 12); +static SENSOR_DEVICE_ATTR(QSFP_reset_13 , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 13); +static SENSOR_DEVICE_ATTR(QSFP_reset_14 , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 14); +static SENSOR_DEVICE_ATTR(QSFP_reset_15 , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 15); +static SENSOR_DEVICE_ATTR(QSFP_reset_16 , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 16); +static SENSOR_DEVICE_ATTR(QSFP_low_power_1 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 1); +static SENSOR_DEVICE_ATTR(QSFP_low_power_2 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 2); +static SENSOR_DEVICE_ATTR(QSFP_low_power_3 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 3); +static SENSOR_DEVICE_ATTR(QSFP_low_power_4 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 4); +static SENSOR_DEVICE_ATTR(QSFP_low_power_5 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 5); +static SENSOR_DEVICE_ATTR(QSFP_low_power_6 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 6); +static SENSOR_DEVICE_ATTR(QSFP_low_power_7 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 7); +static SENSOR_DEVICE_ATTR(QSFP_low_power_8 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 8); +static SENSOR_DEVICE_ATTR(QSFP_low_power_9 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 9); +static SENSOR_DEVICE_ATTR(QSFP_low_power_10 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 10); +static SENSOR_DEVICE_ATTR(QSFP_low_power_11 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 11); +static SENSOR_DEVICE_ATTR(QSFP_low_power_12 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 12); +static SENSOR_DEVICE_ATTR(QSFP_low_power_13 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 13); +static SENSOR_DEVICE_ATTR(QSFP_low_power_14 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 14); +static SENSOR_DEVICE_ATTR(QSFP_low_power_15 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 15); +static SENSOR_DEVICE_ATTR(QSFP_low_power_16 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 16); + +static SENSOR_DEVICE_ATTR(QSFP_low_power_all , S_IRUGO | S_IWUSR , low_power_all_get , low_power_all_set , QSFP_LOW_POWER_ALL); +//static SENSOR_DEVICE_ATTR(QSFP_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , QSFP_RESET); +static SENSOR_DEVICE_ATTR(QSFP_present_all , S_IRUGO , QSFP_status_all_get , NULL , QSFP_PRESENT); +static SENSOR_DEVICE_ATTR(QSFP_present_1 , S_IRUGO , qsfp_status_get , NULL , 1); +static SENSOR_DEVICE_ATTR(QSFP_present_2 , S_IRUGO , qsfp_status_get , NULL , 2); +static SENSOR_DEVICE_ATTR(QSFP_present_3 , S_IRUGO , qsfp_status_get , NULL , 3); +static SENSOR_DEVICE_ATTR(QSFP_present_4 , S_IRUGO , qsfp_status_get , NULL , 4); +static SENSOR_DEVICE_ATTR(QSFP_present_5 , S_IRUGO , qsfp_status_get , NULL , 5); +static SENSOR_DEVICE_ATTR(QSFP_present_6 , S_IRUGO , qsfp_status_get , NULL , 6); +static SENSOR_DEVICE_ATTR(QSFP_present_7 , S_IRUGO , qsfp_status_get , NULL , 7); +static SENSOR_DEVICE_ATTR(QSFP_present_8 , S_IRUGO , qsfp_status_get , NULL , 8); +static SENSOR_DEVICE_ATTR(QSFP_present_9 , S_IRUGO , qsfp_status_get , NULL , 9); +static SENSOR_DEVICE_ATTR(QSFP_present_10 , S_IRUGO , qsfp_status_get , NULL , 10); +static SENSOR_DEVICE_ATTR(QSFP_present_11 , S_IRUGO , qsfp_status_get , NULL , 11); +static SENSOR_DEVICE_ATTR(QSFP_present_12 , S_IRUGO , qsfp_status_get , NULL , 12); +static SENSOR_DEVICE_ATTR(QSFP_present_13 , S_IRUGO , qsfp_status_get , NULL , 13); +static SENSOR_DEVICE_ATTR(QSFP_present_14 , S_IRUGO , qsfp_status_get , NULL , 14); +static SENSOR_DEVICE_ATTR(QSFP_present_15 , S_IRUGO , qsfp_status_get , NULL , 15); +static SENSOR_DEVICE_ATTR(QSFP_present_16 , S_IRUGO , qsfp_status_get , NULL , 16); +/* end of sysfs attributes for SENSOR_DEVICE_ATTR */ + + +/* sysfs attributes for hwmon */ +static struct attribute *phy_cpld640_QSFP_attributes[] = +{ +#ifdef ESC_600_INT_WANTED + &sensor_dev_attr_QSFP_int.dev_attr.attr, +#endif + &sensor_dev_attr_portnum.dev_attr.attr, + &sensor_dev_attr_model.dev_attr.attr, + &sensor_dev_attr_phy_reset.dev_attr.attr, + &sensor_dev_attr_QSFP_reset_1.dev_attr.attr, + &sensor_dev_attr_QSFP_reset_2.dev_attr.attr, + &sensor_dev_attr_QSFP_reset_3.dev_attr.attr, + &sensor_dev_attr_QSFP_reset_4.dev_attr.attr, + &sensor_dev_attr_QSFP_reset_5.dev_attr.attr, + &sensor_dev_attr_QSFP_reset_6.dev_attr.attr, + &sensor_dev_attr_QSFP_reset_7.dev_attr.attr, + &sensor_dev_attr_QSFP_reset_8.dev_attr.attr, + &sensor_dev_attr_QSFP_reset_9.dev_attr.attr, + &sensor_dev_attr_QSFP_reset_10.dev_attr.attr, + &sensor_dev_attr_QSFP_reset_11.dev_attr.attr, + &sensor_dev_attr_QSFP_reset_12.dev_attr.attr, + &sensor_dev_attr_QSFP_reset_13.dev_attr.attr, + &sensor_dev_attr_QSFP_reset_14.dev_attr.attr, + &sensor_dev_attr_QSFP_reset_15.dev_attr.attr, + &sensor_dev_attr_QSFP_reset_16.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_all.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_1.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_2.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_3.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_4.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_5.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_6.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_7.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_8.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_9.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_10.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_11.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_12.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_13.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_14.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_15.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_16.dev_attr.attr, +// &sensor_dev_attr_QSFP_reset.dev_attr.attr, + &sensor_dev_attr_QSFP_present_all.dev_attr.attr, + &sensor_dev_attr_QSFP_present_1.dev_attr.attr, + &sensor_dev_attr_QSFP_present_2.dev_attr.attr, + &sensor_dev_attr_QSFP_present_3.dev_attr.attr, + &sensor_dev_attr_QSFP_present_4.dev_attr.attr, + &sensor_dev_attr_QSFP_present_5.dev_attr.attr, + &sensor_dev_attr_QSFP_present_6.dev_attr.attr, + &sensor_dev_attr_QSFP_present_7.dev_attr.attr, + &sensor_dev_attr_QSFP_present_8.dev_attr.attr, + &sensor_dev_attr_QSFP_present_9.dev_attr.attr, + &sensor_dev_attr_QSFP_present_10.dev_attr.attr, + &sensor_dev_attr_QSFP_present_11.dev_attr.attr, + &sensor_dev_attr_QSFP_present_12.dev_attr.attr, + &sensor_dev_attr_QSFP_present_13.dev_attr.attr, + &sensor_dev_attr_QSFP_present_14.dev_attr.attr, + &sensor_dev_attr_QSFP_present_15.dev_attr.attr, + &sensor_dev_attr_QSFP_present_16.dev_attr.attr, + NULL +}; +/* end of sysfs attributes for hwmon */ + + +#ifdef PREVIOUS_CHECK_TYPE + +static umode_t phy_cpld640_is_attribute_visible(struct kobject *kobj, + struct attribute *attr, int n) +{ + struct device *dev = kobj_to_dev(kobj); + struct Cameo_i2c_data *data = dev_get_drvdata(dev); + umode_t mode = attr->mode; + + if (attr == &sensor_dev_attr_QSFP_reset_5.dev_attr.attr || + attr == &sensor_dev_attr_QSFP_reset_6.dev_attr.attr || + attr == &sensor_dev_attr_QSFP_reset_7.dev_attr.attr || + attr == &sensor_dev_attr_QSFP_reset_8.dev_attr.attr || + attr == &sensor_dev_attr_QSFP_reset_9.dev_attr.attr || + attr == &sensor_dev_attr_QSFP_reset_10.dev_attr.attr || + attr == &sensor_dev_attr_QSFP_reset_11.dev_attr.attr || + attr == &sensor_dev_attr_QSFP_reset_12.dev_attr.attr || + attr == &sensor_dev_attr_QSFP_reset_13.dev_attr.attr || + attr == &sensor_dev_attr_QSFP_reset_14.dev_attr.attr || + attr == &sensor_dev_attr_QSFP_reset_15.dev_attr.attr || + attr == &sensor_dev_attr_QSFP_reset_16.dev_attr.attr){ + + if (data->model_type == MODEL_TYPE_400G) + mode = 0; + } + + + if (attr == &sensor_dev_attr_QSFP_low_power_5.dev_attr.attr || + attr == &sensor_dev_attr_QSFP_low_power_6.dev_attr.attr || + attr == &sensor_dev_attr_QSFP_low_power_7.dev_attr.attr || + attr == &sensor_dev_attr_QSFP_low_power_8.dev_attr.attr || + attr == &sensor_dev_attr_QSFP_low_power_9.dev_attr.attr || + attr == &sensor_dev_attr_QSFP_low_power_10.dev_attr.attr || + attr == &sensor_dev_attr_QSFP_low_power_11.dev_attr.attr || + attr == &sensor_dev_attr_QSFP_low_power_12.dev_attr.attr || + attr == &sensor_dev_attr_QSFP_low_power_13.dev_attr.attr || + attr == &sensor_dev_attr_QSFP_low_power_14.dev_attr.attr || + attr == &sensor_dev_attr_QSFP_low_power_15.dev_attr.attr || + attr == &sensor_dev_attr_QSFP_low_power_16.dev_attr.attr){ + + if (data->model_type == MODEL_TYPE_400G) + mode = 0; + } + + if (attr == &sensor_dev_attr_QSFP_present_5.dev_attr.attr || + attr == &sensor_dev_attr_QSFP_present_6.dev_attr.attr || + attr == &sensor_dev_attr_QSFP_present_7.dev_attr.attr || + attr == &sensor_dev_attr_QSFP_present_8.dev_attr.attr || + attr == &sensor_dev_attr_QSFP_present_9.dev_attr.attr || + attr == &sensor_dev_attr_QSFP_present_10.dev_attr.attr || + attr == &sensor_dev_attr_QSFP_present_11.dev_attr.attr || + attr == &sensor_dev_attr_QSFP_present_12.dev_attr.attr || + attr == &sensor_dev_attr_QSFP_present_13.dev_attr.attr || + attr == &sensor_dev_attr_QSFP_present_14.dev_attr.attr || + attr == &sensor_dev_attr_QSFP_present_15.dev_attr.attr || + attr == &sensor_dev_attr_QSFP_present_16.dev_attr.attr){ + + if (data->model_type == MODEL_TYPE_400G) + mode = 0; + } + + return mode; +} + + +#else + +static u8 get_model_type(struct i2c_client *client, struct Cameo_i2c_data *data) +{ + u8 card_model = -EPERM; + + mutex_lock(&data->update_lock); + card_model = i2c_smbus_read_byte_data(client, 0xb0); + mutex_unlock(&data->update_lock); + + switch (card_model) + { + case 0x00: + case 0x10: + return MODEL_TYPE_100G; + + case 0x01: + case 0x11: + return MODEL_TYPE_400G; + + default: + return MODEL_TYPE_UNKNOWN; + } +} + +#endif //PREVIOUS_CHECK_TYPE + + + +static const struct attribute_group phy_cpld640_QSFP_group = +{ +#ifdef PREVIOUS_CHECK_TYPE + .is_visible = phy_cpld640_is_attribute_visible, +#endif + .attrs = phy_cpld640_QSFP_attributes, +}; + +/*function */ + +static ssize_t portnum_get(struct device *dev, struct device_attribute *da, char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct Cameo_i2c_data *data = i2c_get_clientdata(client); + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + u8 res = 0; + + sprintf(buf, "\n"); + if (attr->index == SLOT_PORTNUM) + { + #ifdef PREVIOUS_CHECK_TYPE + if (data->model_type == MODEL_TYPE_100G) + res = 16; + else if (data->model_type == MODEL_TYPE_400G) + res = 4; + #else + if (get_model_type(client, data) == MODEL_TYPE_100G) + res = 16; + else if (get_model_type(client, data) == MODEL_TYPE_400G) + res = 4; + #endif + else + res = 0; + } + + return sprintf(buf, "%s%d\n", buf, res); +} + + +/********************************************************************************/ +/* Function Name : model_get */ +/* Description : This is the function to get module id 100G/400G */ +/* */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : String. */ +/********************************************************************************/ +static ssize_t model_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 card_model = -EPERM; + struct i2c_client *client = to_i2c_client(dev); + struct Cameo_i2c_data *data = i2c_get_clientdata(client); + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + if (attr->index == SLOT_MODEL) + { + mutex_lock(&data->update_lock); + card_model = i2c_smbus_read_byte_data(client, 0xb0); + mutex_unlock(&data->update_lock); + + if (card_model < 0) + { + return sprintf(buf, "%serr(%d)\n", buf, card_model); + } + + if (card_model == 0x00) //Inphi 100G 16 Port + { + sprintf(buf, "%sInphi 100G", buf); + } + else if(card_model == 0x01) //Inphi 400G 4 Port + { + sprintf(buf, "%sInphi 400G", buf); + } + else if(card_model == 0x10) //Credo 100G 16 Port + { + sprintf(buf, "%sCredo 100G", buf); + } + else if(card_model == 0x11) //Credo 400G 4 Port + { + sprintf(buf, "%sCredo 400G", buf); + } + else + { + sprintf(buf, "%sUnknown", buf); + } + } + + return sprintf(buf, "%s\n", buf); +} + +/********************************************************************************/ +/* Function Name : slot_phy_reset_set */ +/* Description : This is the function to reset PHY module */ +/* */ +/* Input(s) : PHY module number. */ +/* Output(s) : None. */ +/* Returns : None. */ +/********************************************************************************/ +static ssize_t phy_reset_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 status = -EPERM; + u8 value = -EPERM; + + struct i2c_client *client = to_i2c_client(dev); + struct Cameo_i2c_data *data = i2c_get_clientdata(client); + int input = 0; + + input = simple_strtol(buf, NULL, 10); + if (input == 0 || input == 1) + { + if(input == 0) + { + value = 0x00; //turn off + } + else if (input == 1) + { + value = 0xff; //turn on + } + printk(KERN_ALERT "phy_reset_set value = %x\n", value); + + mutex_lock(&data->update_lock); + status = i2c_smbus_write_byte_data(client, 0xa0, value); //to reset phy + mutex_unlock(&data->update_lock); + if(status < 0) + { + printk(KERN_ALERT "ERROR: phy_reset_set FAILED\n"); + return count; + } + printk(KERN_ALERT "phy_reset_set set value Done\n"); + + } + else + { + printk(KERN_ALERT "phy_reset_set wrong value\n"); + return count; + } + return count; +} + +#ifdef ESC_600_INT_WANTED +/********************************************************************************/ +/* Function Name : qsfp_int_get */ +/* Description : This is the function to get qsfp interrupt status */ +/* 0x33 0xd0 */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : String. */ +/********************************************************************************/ +static ssize_t QSFP_int_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u32 qsfp_stat = 0; + u8 res = 0; + u8 max_port_num = 4; + int l; + struct i2c_client *client = to_i2c_client(dev); + struct Cameo_i2c_data *data = i2c_get_clientdata(client); + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + u8 model_type = MODEL_TYPE_UNKNOWN; + + if (attr->index == QSFP_INT) + { + #ifdef PREVIOUS_CHECK_TYPE + model_type = data->model_type; + #else + model_type = get_model_type(client, data); + #endif + + if (model_type == MODEL_TYPE_UNKNOWN) + return sprintf(buf, "%sTYPEERR\n", buf); + + res = i2c_smbus_read_byte_data(client, 0x90); //to get register 0x32 0x90 + qsfp_stat = res; + if (model_type == MODEL_TYPE_100G) + { + max_port_num = 16; + qsfp_stat = i2c_smbus_read_byte_data(client, 0x91); //to get register 0x32 0x91 + qsfp_stat = (qsfp_stat<<8) | res; + } + + debug_print((KERN_DEBUG "DEBUG : QSFP_int_get status = %x\n", qsfp_stat)); + + for (l = 1; l <= max_port_num; l++) + { + if (qsfp_stat & 0x01) + { + sprintf(buf, "%sQSFP %03d is abnormal\n", buf, l); + } + else + { + sprintf(buf, "%sQSFP %03d is OK\n", buf, l); + } + qsfp_stat = qsfp_stat >> 1; + } + + } + + return sprintf(buf, "%s\n", buf); +} +#endif + +/*0x32 PHY CPLD*/ +/********************************************************************************/ +/* Function Name : low_power_all_get */ +/* Description : This is the function to get all QSFP low power mode */ +/* 0x32 0x60 0x61 */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : String. */ +/********************************************************************************/ +static ssize_t low_power_all_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u32 qsfp_stat = 0; + u8 res = 0; + u8 max_port_num = 4; + u8 model_type = MODEL_TYPE_UNKNOWN; + int l; + struct i2c_client *client = to_i2c_client(dev); + struct Cameo_i2c_data *data = i2c_get_clientdata(client); + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + if (attr->index == QSFP_LOW_POWER_ALL) + { + + #ifdef PREVIOUS_CHECK_TYPE + model_type = data->model_type; + #else + model_type = get_model_type(client, data); + #endif + + if (model_type == MODEL_TYPE_UNKNOWN) + return sprintf(buf, "%sTYPEERR\n", buf); + + res = i2c_smbus_read_byte_data(client, 0x60); //to get register 0x32 0x60 + qsfp_stat = res; + + if (model_type == MODEL_TYPE_100G) + { + max_port_num = 16; + qsfp_stat = i2c_smbus_read_byte_data(client, 0x61); //to get register 0x32 0x61 + qsfp_stat = (qsfp_stat<<8) | res; + } + + debug_print((KERN_DEBUG "DEBUG : low_power_all_get status = %x\n",qsfp_stat)); + + for (l = 1; l <= max_port_num; l++) + { + if (qsfp_stat & 0x01) + { + sprintf(buf, "%sQSFP %02d low power mode: ON\n", buf, l); + } + else + { + sprintf(buf, "%sQSFP %02d low power mode: OFF\n", buf, l); + } + qsfp_stat = qsfp_stat >>1; + } + + } + return sprintf(buf, "%s\n", buf); +} + +/********************************************************************************/ +/* Function Name : low_power_all_set */ +/* Description : This is the function to set all QSFP low power mode */ +/* 0x32 0x60 0x61 */ +/* Input(s) : 1 or 0. */ +/* Output(s) : None. */ +/* Returns : None. */ +/********************************************************************************/ +static ssize_t low_power_all_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 value = 0x0; + u8 result = 0; + u8 enable = 0; + u8 model_type = MODEL_TYPE_UNKNOWN; + struct i2c_client *client = to_i2c_client(dev); + struct Cameo_i2c_data *data = i2c_get_clientdata(client); + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + if (attr->index == QSFP_LOW_POWER_ALL) + { + enable = simple_strtol(buf, NULL, 10); + + if (enable == TURN_ON) + { + value = 0xff; + } + else if(enable == TURN_OFF) + { + value = 0x0; + } + else + { + printk(KERN_ALERT "QSFP_LOW_POWER_ALL set wrong value\n"); + } + + #ifdef PREVIOUS_CHECK_TYPE + model_type = data->model_type; + #else + model_type = get_model_type(client, data); + #endif + + if (model_type == MODEL_TYPE_UNKNOWN) + { + printk(KERN_ALERT "ERROR: QSFP_LOW_POWER_ALL type ERR\n"); + return count; + } + + mutex_lock(&data->update_lock); + result = i2c_smbus_write_byte_data(client, 0x60, value); //to set register 0x32 0x60 + mutex_unlock(&data->update_lock); + + if (model_type == MODEL_TYPE_100G) + { + mutex_lock(&data->update_lock); + result = i2c_smbus_write_byte_data(client, 0x61, value); //to set register 0x32 0x61 + mutex_unlock(&data->update_lock); + } + + if (result < 0) + { + printk(KERN_ALERT "ERROR: QSFP_LOW_POWER_ALL set FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "QSFP_LOW_POWER_ALL set %d\n", enable)); + } + + } + return count; +} + +/********************************************************************************/ +/* Function Name : low_power_get */ +/* Description : This is the function to get QSFP low power mode */ +/* 0x32 0x60 0x61 */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : String. */ +/********************************************************************************/ +static ssize_t low_power_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 ret = -EPERM; + u8 reg = 0; + u8 offset = 0; + u8 model_type = MODEL_TYPE_UNKNOWN; + struct i2c_client *client = to_i2c_client(dev); + struct Cameo_i2c_data *data = i2c_get_clientdata(client); + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + +#ifdef PREVIOUS_CHECK_TYPE + model_type = data->model_type; +#else + model_type = get_model_type(client, data); +#endif + + if (model_type == MODEL_TYPE_UNKNOWN) + return sprintf(buf, "TYPEERR\n"); + +#ifndef PREVIOUS_CHECK_TYPE + if (model_type == MODEL_TYPE_400G) + { + if (attr->index > 4) + return sprintf(buf, "out of range\n"); + } +#endif + + if (attr->index <= 8) + { + reg = 0x60; + offset = attr->index-1; + } + else + { + reg = 0x61; + offset = attr->index-9; + } + + ret = i2c_smbus_read_byte_data(client, reg); + if (ret < 0) + { + return sprintf(buf, "%serr(%d)\n", buf, ret); + } + + ret = (ret>>offset) & 0x1; + + return sprintf(buf, "%s%d\n", buf, ret); +} + +/********************************************************************************/ +/* Function Name : low_power_set */ +/* Description : This is the function to set QSFP low power mode */ +/* 0x32 0x60 0x61 */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : None. */ +/********************************************************************************/ +static ssize_t low_power_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 ret = -EPERM; + u8 value = 0; + u8 reg = 0; + u8 offset = 0; + u8 input; + u8 model_type = MODEL_TYPE_UNKNOWN; + + struct i2c_client *client = to_i2c_client(dev); + struct Cameo_i2c_data *data = i2c_get_clientdata(client); + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + +#ifdef PREVIOUS_CHECK_TYPE + model_type = data->model_type; +#else + model_type = get_model_type(client, data); +#endif + + if (model_type == MODEL_TYPE_UNKNOWN) + { + printk(KERN_ALERT "low_power_set type ERR\n"); + return count; + } +#ifndef PREVIOUS_CHECK_TYPE + if (model_type == MODEL_TYPE_400G) + { + if (attr->index > 4) + { + printk(KERN_ALERT "low_power_set out of range\n"); + return count; + } + } +#endif + + input = simple_strtol(buf, NULL, 10); + if(input == 0 || input == 1) + { + if (attr->index <= 8) + { + reg = 0x60; + offset = attr->index-1; + } + else { + reg = 0x61; + offset = attr->index-9; + } + + if (model_type == MODEL_TYPE_400G && reg == 0x61) + { + printk(KERN_ALERT "low_power_set out of range\n"); + return count; + } + + // read current setting + ret = i2c_smbus_read_byte_data(client, reg); + if (ret < 0) + { + printk(KERN_ALERT "low_power_set read err(%d)\n", ret); + return count; + } + + // set new setting + if (input == 0) + value = ret & ( ~(1<update_lock); + ret = i2c_smbus_write_byte_data(client, reg, value); //to set register 0x32 0x60 + mutex_unlock(&data->update_lock); + + if (ret < 0) + { + printk(KERN_ALERT "low_power_set write err(%d)\n", ret); + } + + } + else + { + printk(KERN_ALERT "low_power_set wrong value\n"); + return count; + } + return count; +} + +/********************************************************************************/ +/* Function Name : qsfp_reset_set */ +/* Description : This is the function to reset QSFP module */ +/* 0x32 0x70 0x71 */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : None. */ +/********************************************************************************/ +static ssize_t qsfp_reset_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 ret = -EPERM; + u8 value = 0; + u8 offset = 0; + u8 reg = 0; + u8 model_type = MODEL_TYPE_UNKNOWN; + struct i2c_client *client = to_i2c_client(dev); + struct Cameo_i2c_data *data = i2c_get_clientdata(client); + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + +#ifdef PREVIOUS_CHECK_TYPE + model_type = data->model_type; +#else + model_type = get_model_type(client, data); +#endif + + if (model_type == MODEL_TYPE_UNKNOWN) + { + printk(KERN_ALERT "qsfp_reset_set type ERR\n"); + return count; + } + +#ifndef PREVIOUS_CHECK_TYPE + if (model_type == MODEL_TYPE_400G) + { + if (attr->index > 4) + { + printk(KERN_ALERT "qsfp_reset_set out of range\n"); + return count; + } + } +#endif + + if (attr->index == QSFP_RESET) + { + if (attr->index <= 8) + { + reg = 0x70; + offset = attr->index-1; + } + else + { + reg = 0x71; + offset = attr->index-9; + } + + debug_print((KERN_DEBUG "DEBUG : qsfp_reset_set port %03d\n", attr->index)); + + value = ret & ( ~( 1<update_lock); + i2c_smbus_write_byte_data(client, reg, value); //to set register 0x32 0x70 + mutex_unlock(&data->update_lock); + debug_print((KERN_DEBUG "DEBUG : qsfp_reset_set_%03d set = %x\n", attr->index, value)); + if (ret < 0) + { + printk(KERN_ALERT "qsfp_reset_set write err(%d)\n", ret); + } + } + + return count; +} + +/********************************************************************************/ +/* Function Name : QSFP_status_all_get */ +/* Description : This is the function to get all QSFP insert status */ +/* 0x32 0x80 0x81 */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : String. */ +/********************************************************************************/ +static ssize_t QSFP_status_all_get(struct device *dev, struct device_attribute *da, char *buf) +{ + + u32 qsfp_stat = 0; + u8 res = 0; + u8 max_port_num = 4; + u8 model_type = MODEL_TYPE_UNKNOWN; + int port_num; + struct i2c_client *client = to_i2c_client(dev); + struct Cameo_i2c_data *data = i2c_get_clientdata(client); + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + if (attr->index == QSFP_PRESENT) + { + res = i2c_smbus_read_byte_data(client, 0x80); //to get register 0x32 0x80 + qsfp_stat = res; + + #ifdef PREVIOUS_CHECK_TYPE + model_type = data->model_type; + #else + model_type = get_model_type(client, data); + #endif + + if (model_type == MODEL_TYPE_UNKNOWN) + return sprintf(buf, "TYPEERR\n"); + + if (model_type == MODEL_TYPE_100G) + { + max_port_num = 16; + qsfp_stat = i2c_smbus_read_byte_data(client, 0x81); //to get register 0x32 0x81 + qsfp_stat = (qsfp_stat<<8) | res; + } + + debug_print((KERN_DEBUG "DEBUG : QSFP_status_all_get status = %x\n",qsfp_stat)); + + for (port_num = 1; port_num <= max_port_num; port_num++) + { + if (qsfp_stat & 0x01) + { + sprintf(buf, "%sQSFP %02d is not present\n", buf, port_num); + } + else + { + sprintf(buf, "%sQSFP %02d is present\n", buf, port_num); + } + qsfp_stat = qsfp_stat >> 1; + } + + } + return sprintf(buf, "%s\n", buf); + +} + +/********************************************************************************/ +/* Function Name : qsfp_status_get */ +/* Description : This is the function to get QSFP insert status */ +/* 0x32 0x80 0x81 */ +/* Input(s) : attr->index. */ +/* Output(s) : None. */ +/* Returns : String. */ +/********************************************************************************/ +static ssize_t qsfp_status_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 ret = -EPERM; + u8 reg = 0; + u8 offset = 0; + u8 model_type = MODEL_TYPE_UNKNOWN; + struct i2c_client *client = to_i2c_client(dev); + struct Cameo_i2c_data *data = i2c_get_clientdata(client); + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + +#ifdef PREVIOUS_CHECK_TYPE + model_type = data->model_type; +#else + model_type = get_model_type(client, data); +#endif + + if (model_type == MODEL_TYPE_UNKNOWN) + return sprintf(buf, "TYPEERR\n"); + +#ifndef PREVIOUS_CHECK_TYPE + if (model_type == MODEL_TYPE_400G) + { + if (attr->index > 4) + return sprintf(buf, "out of range\n"); + } +#endif + + if (attr->index <= 8) + { + reg = 0x80; + offset = attr->index-1; + } + else + { + reg = 0x81; + offset = attr->index-9; + } + + ret = i2c_smbus_read_byte_data(client, reg); + if (ret < 0) + { + return sprintf(buf, "%serr(%d)\n", buf, ret); + } + + ret = (ret>>offset) & 0x1; + + return sprintf(buf, "%s%d\n", buf, ((ret)?0:1)); + +} + +/* end of function */ +/********************************************************************************/ +/* Function Name : Cameo_i2c_probe */ +/* Description : To probe i2c device */ +/* */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : None. */ +/********************************************************************************/ +static int phy_cpld640_probe(struct i2c_client *client, const struct i2c_device_id *dev_id) +{ + + struct Cameo_i2c_data *data; +#ifdef PREVIOUS_CHECK_TYPE + u8 card_model; +#endif + + int status; + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA)) + { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct Cameo_i2c_data), GFP_KERNEL); + if (!data) + { + printk(KERN_ALERT "Cameo_PHY_CPLD_data kzalloc fail\n"); + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + + mutex_init(&data->update_lock); + data->valid = 0; + dev_info(&client->dev, "chip found\n"); + +#ifdef PREVIOUS_CHECK_TYPE + /* check model type */ + mutex_lock(&data->update_lock); + card_model = i2c_smbus_read_byte_data(client, 0xb0); + mutex_unlock(&data->update_lock); + if (card_model < 0) + { + status = -EPERM; + goto exit_free; + } + + switch (card_model) + { + case 0x00: + case 0x10: + data->model_type = MODEL_TYPE_100G; + break; + case 0x01: + case 0x11: + data->model_type = MODEL_TYPE_400G; + break; + default: + return -EPERM; + } + +#endif + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &phy_cpld640_QSFP_group); + if (status) + { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) + { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + dev_info(&client->dev, "%s: '%s'\n", dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &phy_cpld640_QSFP_group); + +exit_free: + kfree(data); +exit: + return status; +} + +static int phy_cpld640_remove(struct i2c_client *client) +{ + struct Cameo_i2c_data *data = i2c_get_clientdata(client); + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &phy_cpld640_QSFP_group); + kfree(data); + return 0; +} + +static const struct i2c_device_id phy_cpld640_id[] = +{ + { "phy_cpld640", 0 }, + {}, +}; +MODULE_DEVICE_TABLE(i2c, phy_cpld640_id); + +static struct i2c_driver phy_cpld640_driver = +{ + .class = I2C_CLASS_HWMON, + .driver = + { + .name = "phy_cpld640", + }, + .probe = phy_cpld640_probe, + .remove = phy_cpld640_remove, + .id_table = phy_cpld640_id, + .address_list = normal_i2c, +}; + + +module_i2c_driver(phy_cpld640_driver) +MODULE_AUTHOR("Cameo Inc."); +MODULE_DESCRIPTION("Cameo phy_cpld640 i2c driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/modules/pmbus.h b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/modules/pmbus.h new file mode 100644 index 0000000000..4efa2bd4f6 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/modules/pmbus.h @@ -0,0 +1,425 @@ +/* + * pmbus.h - Common defines and structures for PMBus devices + * + * Copyright (c) 2010, 2011 Ericsson AB. + * Copyright (c) 2012 Guenter Roeck + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef PMBUS_H +#define PMBUS_H + +#include +#include + +/* + * Registers + */ +enum pmbus_regs { + PMBUS_PAGE = 0x00, + PMBUS_OPERATION = 0x01, + PMBUS_ON_OFF_CONFIG = 0x02, + PMBUS_CLEAR_FAULTS = 0x03, + PMBUS_PHASE = 0x04, + + PMBUS_CAPABILITY = 0x19, + PMBUS_QUERY = 0x1A, + + PMBUS_VOUT_MODE = 0x20, + PMBUS_VOUT_COMMAND = 0x21, + PMBUS_VOUT_TRIM = 0x22, + PMBUS_VOUT_CAL_OFFSET = 0x23, + PMBUS_VOUT_MAX = 0x24, + PMBUS_VOUT_MARGIN_HIGH = 0x25, + PMBUS_VOUT_MARGIN_LOW = 0x26, + PMBUS_VOUT_TRANSITION_RATE = 0x27, + PMBUS_VOUT_DROOP = 0x28, + PMBUS_VOUT_SCALE_LOOP = 0x29, + PMBUS_VOUT_SCALE_MONITOR = 0x2A, + + PMBUS_COEFFICIENTS = 0x30, + PMBUS_POUT_MAX = 0x31, + + PMBUS_FAN_CONFIG_12 = 0x3A, + PMBUS_FAN_COMMAND_1 = 0x3B, + PMBUS_FAN_COMMAND_2 = 0x3C, + PMBUS_FAN_CONFIG_34 = 0x3D, + PMBUS_FAN_COMMAND_3 = 0x3E, + PMBUS_FAN_COMMAND_4 = 0x3F, + + PMBUS_VOUT_OV_FAULT_LIMIT = 0x40, + PMBUS_VOUT_OV_FAULT_RESPONSE = 0x41, + PMBUS_VOUT_OV_WARN_LIMIT = 0x42, + PMBUS_VOUT_UV_WARN_LIMIT = 0x43, + PMBUS_VOUT_UV_FAULT_LIMIT = 0x44, + PMBUS_VOUT_UV_FAULT_RESPONSE = 0x45, + PMBUS_IOUT_OC_FAULT_LIMIT = 0x46, + PMBUS_IOUT_OC_FAULT_RESPONSE = 0x47, + PMBUS_IOUT_OC_LV_FAULT_LIMIT = 0x48, + PMBUS_IOUT_OC_LV_FAULT_RESPONSE = 0x49, + PMBUS_IOUT_OC_WARN_LIMIT = 0x4A, + PMBUS_IOUT_UC_FAULT_LIMIT = 0x4B, + PMBUS_IOUT_UC_FAULT_RESPONSE = 0x4C, + + PMBUS_OT_FAULT_LIMIT = 0x4F, + PMBUS_OT_FAULT_RESPONSE = 0x50, + PMBUS_OT_WARN_LIMIT = 0x51, + PMBUS_UT_WARN_LIMIT = 0x52, + PMBUS_UT_FAULT_LIMIT = 0x53, + PMBUS_UT_FAULT_RESPONSE = 0x54, + PMBUS_VIN_OV_FAULT_LIMIT = 0x55, + PMBUS_VIN_OV_FAULT_RESPONSE = 0x56, + PMBUS_VIN_OV_WARN_LIMIT = 0x57, + PMBUS_VIN_UV_WARN_LIMIT = 0x58, + PMBUS_VIN_UV_FAULT_LIMIT = 0x59, + + PMBUS_IIN_OC_FAULT_LIMIT = 0x5B, + PMBUS_IIN_OC_WARN_LIMIT = 0x5D, + + PMBUS_POUT_OP_FAULT_LIMIT = 0x68, + PMBUS_POUT_OP_WARN_LIMIT = 0x6A, + PMBUS_PIN_OP_WARN_LIMIT = 0x6B, + + PMBUS_STATUS_BYTE = 0x78, + PMBUS_STATUS_WORD = 0x79, + PMBUS_STATUS_VOUT = 0x7A, + PMBUS_STATUS_IOUT = 0x7B, + PMBUS_STATUS_INPUT = 0x7C, + PMBUS_STATUS_TEMPERATURE = 0x7D, + PMBUS_STATUS_CML = 0x7E, + PMBUS_STATUS_OTHER = 0x7F, + PMBUS_STATUS_MFR_SPECIFIC = 0x80, + PMBUS_STATUS_FAN_12 = 0x81, + PMBUS_STATUS_FAN_34 = 0x82, + + PMBUS_READ_VIN = 0x88, + PMBUS_READ_IIN = 0x89, + PMBUS_READ_VCAP = 0x8A, + PMBUS_READ_VOUT = 0x8B, + PMBUS_READ_IOUT = 0x8C, + PMBUS_READ_TEMPERATURE_1 = 0x8D, + PMBUS_READ_TEMPERATURE_2 = 0x8E, + PMBUS_READ_TEMPERATURE_3 = 0x8F, + PMBUS_READ_FAN_SPEED_1 = 0x90, + PMBUS_READ_FAN_SPEED_2 = 0x91, + PMBUS_READ_FAN_SPEED_3 = 0x92, + PMBUS_READ_FAN_SPEED_4 = 0x93, + PMBUS_READ_DUTY_CYCLE = 0x94, + PMBUS_READ_FREQUENCY = 0x95, + PMBUS_READ_POUT = 0x96, + PMBUS_READ_PIN = 0x97, + + PMBUS_REVISION = 0x98, + PMBUS_MFR_ID = 0x99, + PMBUS_MFR_MODEL = 0x9A, + PMBUS_MFR_REVISION = 0x9B, + PMBUS_MFR_LOCATION = 0x9C, + PMBUS_MFR_DATE = 0x9D, + PMBUS_MFR_SERIAL = 0x9E, + +/* + * Virtual registers. + * Useful to support attributes which are not supported by standard PMBus + * registers but exist as manufacturer specific registers on individual chips. + * Must be mapped to real registers in device specific code. + * + * Semantics: + * Virtual registers are all word size. + * READ registers are read-only; writes are either ignored or return an error. + * RESET registers are read/write. Reading reset registers returns zero + * (used for detection), writing any value causes the associated history to be + * reset. + * Virtual registers have to be handled in device specific driver code. Chip + * driver code returns non-negative register values if a virtual register is + * supported, or a negative error code if not. The chip driver may return + * -ENODATA or any other error code in this case, though an error code other + * than -ENODATA is handled more efficiently and thus preferred. Either case, + * the calling PMBus core code will abort if the chip driver returns an error + * code when reading or writing virtual registers. + */ + PMBUS_VIRT_BASE = 0x100, + PMBUS_VIRT_READ_TEMP_AVG, + PMBUS_VIRT_READ_TEMP_MIN, + PMBUS_VIRT_READ_TEMP_MAX, + PMBUS_VIRT_RESET_TEMP_HISTORY, + PMBUS_VIRT_READ_VIN_AVG, + PMBUS_VIRT_READ_VIN_MIN, + PMBUS_VIRT_READ_VIN_MAX, + PMBUS_VIRT_RESET_VIN_HISTORY, + PMBUS_VIRT_READ_IIN_AVG, + PMBUS_VIRT_READ_IIN_MIN, + PMBUS_VIRT_READ_IIN_MAX, + PMBUS_VIRT_RESET_IIN_HISTORY, + PMBUS_VIRT_READ_PIN_AVG, + PMBUS_VIRT_READ_PIN_MIN, + PMBUS_VIRT_READ_PIN_MAX, + PMBUS_VIRT_RESET_PIN_HISTORY, + PMBUS_VIRT_READ_POUT_AVG, + PMBUS_VIRT_READ_POUT_MIN, + PMBUS_VIRT_READ_POUT_MAX, + PMBUS_VIRT_RESET_POUT_HISTORY, + PMBUS_VIRT_READ_VOUT_AVG, + PMBUS_VIRT_READ_VOUT_MIN, + PMBUS_VIRT_READ_VOUT_MAX, + PMBUS_VIRT_RESET_VOUT_HISTORY, + PMBUS_VIRT_READ_IOUT_AVG, + PMBUS_VIRT_READ_IOUT_MIN, + PMBUS_VIRT_READ_IOUT_MAX, + PMBUS_VIRT_RESET_IOUT_HISTORY, + PMBUS_VIRT_READ_TEMP2_AVG, + PMBUS_VIRT_READ_TEMP2_MIN, + PMBUS_VIRT_READ_TEMP2_MAX, + PMBUS_VIRT_RESET_TEMP2_HISTORY, + + PMBUS_VIRT_READ_VMON, + PMBUS_VIRT_VMON_UV_WARN_LIMIT, + PMBUS_VIRT_VMON_OV_WARN_LIMIT, + PMBUS_VIRT_VMON_UV_FAULT_LIMIT, + PMBUS_VIRT_VMON_OV_FAULT_LIMIT, + PMBUS_VIRT_STATUS_VMON, +}; + +/* + * OPERATION + */ +#define PB_OPERATION_CONTROL_ON BIT(7) + +/* + * CAPABILITY + */ +#define PB_CAPABILITY_SMBALERT BIT(4) +#define PB_CAPABILITY_ERROR_CHECK BIT(7) + +/* + * VOUT_MODE + */ +#define PB_VOUT_MODE_MODE_MASK 0xe0 +#define PB_VOUT_MODE_PARAM_MASK 0x1f + +#define PB_VOUT_MODE_LINEAR 0x00 +#define PB_VOUT_MODE_VID 0x20 +#define PB_VOUT_MODE_DIRECT 0x40 + +/* + * Fan configuration + */ +#define PB_FAN_2_PULSE_MASK (BIT(0) | BIT(1)) +#define PB_FAN_2_RPM BIT(2) +#define PB_FAN_2_INSTALLED BIT(3) +#define PB_FAN_1_PULSE_MASK (BIT(4) | BIT(5)) +#define PB_FAN_1_RPM BIT(6) +#define PB_FAN_1_INSTALLED BIT(7) + +/* + * STATUS_BYTE, STATUS_WORD (lower) + */ +#define PB_STATUS_NONE_ABOVE BIT(0) +#define PB_STATUS_CML BIT(1) +#define PB_STATUS_TEMPERATURE BIT(2) +#define PB_STATUS_VIN_UV BIT(3) +#define PB_STATUS_IOUT_OC BIT(4) +#define PB_STATUS_VOUT_OV BIT(5) +#define PB_STATUS_OFF BIT(6) +#define PB_STATUS_BUSY BIT(7) + +/* + * STATUS_WORD (upper) + */ +#define PB_STATUS_UNKNOWN BIT(8) +#define PB_STATUS_OTHER BIT(9) +#define PB_STATUS_FANS BIT(10) +#define PB_STATUS_POWER_GOOD_N BIT(11) +#define PB_STATUS_WORD_MFR BIT(12) +#define PB_STATUS_INPUT BIT(13) +#define PB_STATUS_IOUT_POUT BIT(14) +#define PB_STATUS_VOUT BIT(15) + +/* + * STATUS_IOUT + */ +#define PB_POUT_OP_WARNING BIT(0) +#define PB_POUT_OP_FAULT BIT(1) +#define PB_POWER_LIMITING BIT(2) +#define PB_CURRENT_SHARE_FAULT BIT(3) +#define PB_IOUT_UC_FAULT BIT(4) +#define PB_IOUT_OC_WARNING BIT(5) +#define PB_IOUT_OC_LV_FAULT BIT(6) +#define PB_IOUT_OC_FAULT BIT(7) + +/* + * STATUS_VOUT, STATUS_INPUT + */ +#define PB_VOLTAGE_UV_FAULT BIT(4) +#define PB_VOLTAGE_UV_WARNING BIT(5) +#define PB_VOLTAGE_OV_WARNING BIT(6) +#define PB_VOLTAGE_OV_FAULT BIT(7) + +/* + * STATUS_INPUT + */ +#define PB_PIN_OP_WARNING BIT(0) +#define PB_IIN_OC_WARNING BIT(1) +#define PB_IIN_OC_FAULT BIT(2) + +/* + * STATUS_TEMPERATURE + */ +#define PB_TEMP_UT_FAULT BIT(4) +#define PB_TEMP_UT_WARNING BIT(5) +#define PB_TEMP_OT_WARNING BIT(6) +#define PB_TEMP_OT_FAULT BIT(7) + +/* + * STATUS_FAN + */ +#define PB_FAN_AIRFLOW_WARNING BIT(0) +#define PB_FAN_AIRFLOW_FAULT BIT(1) +#define PB_FAN_FAN2_SPEED_OVERRIDE BIT(2) +#define PB_FAN_FAN1_SPEED_OVERRIDE BIT(3) +#define PB_FAN_FAN2_WARNING BIT(4) +#define PB_FAN_FAN1_WARNING BIT(5) +#define PB_FAN_FAN2_FAULT BIT(6) +#define PB_FAN_FAN1_FAULT BIT(7) + +/* + * CML_FAULT_STATUS + */ +#define PB_CML_FAULT_OTHER_MEM_LOGIC BIT(0) +#define PB_CML_FAULT_OTHER_COMM BIT(1) +#define PB_CML_FAULT_PROCESSOR BIT(3) +#define PB_CML_FAULT_MEMORY BIT(4) +#define PB_CML_FAULT_PACKET_ERROR BIT(5) +#define PB_CML_FAULT_INVALID_DATA BIT(6) +#define PB_CML_FAULT_INVALID_COMMAND BIT(7) + +enum pmbus_sensor_classes { + PSC_VOLTAGE_IN = 0, + PSC_VOLTAGE_OUT, + PSC_CURRENT_IN, + PSC_CURRENT_OUT, + PSC_POWER, + PSC_TEMPERATURE, + PSC_FAN, + PSC_NUM_CLASSES /* Number of power sensor classes */ +}; + +#define PMBUS_PAGES 32 /* Per PMBus specification */ + +/* Functionality bit mask */ +#define PMBUS_HAVE_VIN BIT(0) +#define PMBUS_HAVE_VCAP BIT(1) +#define PMBUS_HAVE_VOUT BIT(2) +#define PMBUS_HAVE_IIN BIT(3) +#define PMBUS_HAVE_IOUT BIT(4) +#define PMBUS_HAVE_PIN BIT(5) +#define PMBUS_HAVE_POUT BIT(6) +#define PMBUS_HAVE_FAN12 BIT(7) +#define PMBUS_HAVE_FAN34 BIT(8) +#define PMBUS_HAVE_TEMP BIT(9) +#define PMBUS_HAVE_TEMP2 BIT(10) +#define PMBUS_HAVE_TEMP3 BIT(11) +#define PMBUS_HAVE_STATUS_VOUT BIT(12) +#define PMBUS_HAVE_STATUS_IOUT BIT(13) +#define PMBUS_HAVE_STATUS_INPUT BIT(14) +#define PMBUS_HAVE_STATUS_TEMP BIT(15) +#define PMBUS_HAVE_STATUS_FAN12 BIT(16) +#define PMBUS_HAVE_STATUS_FAN34 BIT(17) +#define PMBUS_HAVE_VMON BIT(18) +#define PMBUS_HAVE_STATUS_VMON BIT(19) + +enum pmbus_data_format { linear = 0, direct, vid }; +enum vrm_version { vr11 = 0, vr12, vr13 }; + +struct pmbus_driver_info { + int pages; /* Total number of pages */ + enum pmbus_data_format format[PSC_NUM_CLASSES]; + enum vrm_version vrm_version; + /* + * Support one set of coefficients for each sensor type + * Used for chips providing data in direct mode. + */ + int m[PSC_NUM_CLASSES]; /* mantissa for direct data format */ + int b[PSC_NUM_CLASSES]; /* offset */ + int R[PSC_NUM_CLASSES]; /* exponent */ + + u32 func[PMBUS_PAGES]; /* Functionality, per page */ + /* + * The following functions map manufacturing specific register values + * to PMBus standard register values. Specify only if mapping is + * necessary. + * Functions return the register value (read) or zero (write) if + * successful. A return value of -ENODATA indicates that there is no + * manufacturer specific register, but that a standard PMBus register + * may exist. Any other negative return value indicates that the + * register does not exist, and that no attempt should be made to read + * the standard register. + */ + int (*read_byte_data)(struct i2c_client *client, int page, int reg); + int (*read_word_data)(struct i2c_client *client, int page, int reg); + int (*write_word_data)(struct i2c_client *client, int page, int reg, + u16 word); + int (*write_byte)(struct i2c_client *client, int page, u8 value); + /* + * The identify function determines supported PMBus functionality. + * This function is only necessary if a chip driver supports multiple + * chips, and the chip functionality is not pre-determined. + */ + int (*identify)(struct i2c_client *client, + struct pmbus_driver_info *info); + + /* Regulator functionality, if supported by this chip driver. */ + int num_regulators; + const struct regulator_desc *reg_desc; +}; + +/* Regulator ops */ + +extern const struct regulator_ops pmbus_regulator_ops; + +/* Macro for filling in array of struct regulator_desc */ +#define PMBUS_REGULATOR(_name, _id) \ + [_id] = { \ + .name = (_name # _id), \ + .id = (_id), \ + .of_match = of_match_ptr(_name # _id), \ + .regulators_node = of_match_ptr("regulators"), \ + .ops = &pmbus_regulator_ops, \ + .type = REGULATOR_VOLTAGE, \ + .owner = THIS_MODULE, \ + } + +/* Function declarations */ + +void pmbus_clear_cache(struct i2c_client *client); +int pmbus_set_page(struct i2c_client *client, u8 page); +int pmbus_read_word_data(struct i2c_client *client, u8 page, u8 reg); +int pmbus_write_word_data(struct i2c_client *client, u8 page, u8 reg, u16 word); +int pmbus_read_byte_data(struct i2c_client *client, int page, u8 reg); +int pmbus_write_byte(struct i2c_client *client, int page, u8 value); +int pmbus_write_byte_data(struct i2c_client *client, int page, u8 reg, + u8 value); +int pmbus_update_byte_data(struct i2c_client *client, int page, u8 reg, + u8 mask, u8 value); +void pmbus_clear_faults(struct i2c_client *client); +bool pmbus_check_byte_register(struct i2c_client *client, int page, int reg); +bool pmbus_check_word_register(struct i2c_client *client, int page, int reg); +int pmbus_do_probe(struct i2c_client *client, const struct i2c_device_id *id, + struct pmbus_driver_info *info); +int pmbus_do_remove(struct i2c_client *client); +const struct pmbus_driver_info *pmbus_get_driver_info(struct i2c_client + *client); + +#endif /* PMBUS_H */ diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/modules/powr1014.c b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/modules/powr1014.c new file mode 100644 index 0000000000..8b49f39533 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/modules/powr1014.c @@ -0,0 +1,433 @@ +/* + * powr1220.c - Driver for the Lattice POWR1220 programmable power supply + * and monitor. Users can read all ADC inputs along with their labels + * using the sysfs nodes. + * + * Copyright (c) 2014 Echo360 http://www.echo360.com + * Scott Kanowitz + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define ID_POWR1014 1014 +#define ID_POWR1220 1220 + +#define ADC_STEP_MV 2 +#define ADC_MAX_LOW_MEASUREMENT_MV 2000 + +enum powr1220_regs { + VMON_STATUS0, + VMON_STATUS1, + VMON_STATUS2, + OUTPUT_STATUS0, + OUTPUT_STATUS1, + OUTPUT_STATUS2, + INPUT_STATUS, + ADC_VALUE_LOW, + ADC_VALUE_HIGH, + ADC_MUX, + UES_BYTE0, + UES_BYTE1, + UES_BYTE2, + UES_BYTE3, + GP_OUTPUT1, + GP_OUTPUT2, + GP_OUTPUT3, + INPUT_VALUE, + RESET, + TRIM1_TRIM, + TRIM2_TRIM, + TRIM3_TRIM, + TRIM4_TRIM, + TRIM5_TRIM, + TRIM6_TRIM, + TRIM7_TRIM, + TRIM8_TRIM, + MAX_POWR1220_REGS +}; + +enum powr1220_adc_values { + VMON1, + VMON2, + VMON3, + VMON4, + VMON5, + VMON6, + VMON7, + VMON8, + VMON9, + VMON10, + VMON11, + VMON12, + VCCA, + VCCINP, + MAX_POWR1220_ADC_VALUES +}; + + + +struct powr1220_data { + struct i2c_client *client; + struct mutex update_lock; + bool adc_valid[MAX_POWR1220_ADC_VALUES]; + /* the next value is in jiffies */ + unsigned long adc_last_updated[MAX_POWR1220_ADC_VALUES]; + + /*save id*/ + int id; + + /* values */ + int adc_maxes[MAX_POWR1220_ADC_VALUES]; + int adc_values[MAX_POWR1220_ADC_VALUES]; +}; + +static const char * const input_names[] = { + [VMON1] = "vmon1", + [VMON2] = "vmon2", + [VMON3] = "vmon3", + [VMON4] = "vmon4", + [VMON5] = "vmon5", + [VMON6] = "vmon6", + [VMON7] = "vmon7", + [VMON8] = "vmon8", + [VMON9] = "vmon9", + [VMON10] = "vmon10", + [VMON11] = "vmon11", + [VMON12] = "vmon12", + [VCCA] = "vcca", + [VCCINP] = "vccinp", +}; + +/* Reads the specified ADC channel */ +static int powr1220_read_adc(struct device *dev, int ch_num) +{ + struct powr1220_data *data = dev_get_drvdata(dev); + int reading; + int result; + int adc_range = 0; + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->adc_last_updated[ch_num] + HZ) || + !data->adc_valid[ch_num]) { + /* + * figure out if we need to use the attenuator for + * high inputs or inputs that we don't yet have a measurement + * for. We dynamically set the attenuator depending on the + * max reading. + */ + if (data->adc_maxes[ch_num] > ADC_MAX_LOW_MEASUREMENT_MV || + data->adc_maxes[ch_num] == 0) + adc_range = 1 << 4; + + /* set the attenuator and mux */ + result = i2c_smbus_write_byte_data(data->client, ADC_MUX, + adc_range | ch_num); + if (result) + goto exit; + + /* + * wait at least Tconvert time (200 us) for the + * conversion to complete + */ + udelay(200); + + /* get the ADC reading */ + result = i2c_smbus_read_byte_data(data->client, ADC_VALUE_LOW); + if (result < 0) + goto exit; + + reading = result >> 4; + + /* get the upper half of the reading */ + result = i2c_smbus_read_byte_data(data->client, ADC_VALUE_HIGH); + if (result < 0) + goto exit; + + reading |= result << 4; + + /* now convert the reading to a voltage */ + reading *= ADC_STEP_MV; + data->adc_values[ch_num] = reading; + data->adc_valid[ch_num] = true; + data->adc_last_updated[ch_num] = jiffies; + result = reading; + + if (reading > data->adc_maxes[ch_num]) + data->adc_maxes[ch_num] = reading; + } else { + result = data->adc_values[ch_num]; + } + +exit: + mutex_unlock(&data->update_lock); + + return result; +} + +/* Shows the voltage associated with the specified ADC channel */ +static ssize_t powr1220_show_voltage(struct device *dev, + struct device_attribute *dev_attr, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + int adc_val = powr1220_read_adc(dev, attr->index); + + if (adc_val < 0) + return adc_val; + + return sprintf(buf, "%d\n", adc_val); +} + +/* Shows the maximum setting associated with the specified ADC channel */ +static ssize_t powr1220_show_max(struct device *dev, + struct device_attribute *dev_attr, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + struct powr1220_data *data = dev_get_drvdata(dev); + + return sprintf(buf, "%d\n", data->adc_maxes[attr->index]); +} + +/* Shows the label associated with the specified ADC channel */ +static ssize_t powr1220_show_label(struct device *dev, + struct device_attribute *dev_attr, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + + return sprintf(buf, "%s\n", input_names[attr->index]); +} + +static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, powr1220_show_voltage, NULL, + VMON1); +static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, powr1220_show_voltage, NULL, + VMON2); +static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, powr1220_show_voltage, NULL, + VMON3); +static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, powr1220_show_voltage, NULL, + VMON4); +static SENSOR_DEVICE_ATTR(in4_input, S_IRUGO, powr1220_show_voltage, NULL, + VMON5); +static SENSOR_DEVICE_ATTR(in5_input, S_IRUGO, powr1220_show_voltage, NULL, + VMON6); +static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, powr1220_show_voltage, NULL, + VMON7); +static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, powr1220_show_voltage, NULL, + VMON8); +static SENSOR_DEVICE_ATTR(in8_input, S_IRUGO, powr1220_show_voltage, NULL, + VMON9); +static SENSOR_DEVICE_ATTR(in9_input, S_IRUGO, powr1220_show_voltage, NULL, + VMON10); +static SENSOR_DEVICE_ATTR(in10_input, S_IRUGO, powr1220_show_voltage, NULL, + VMON11); +static SENSOR_DEVICE_ATTR(in11_input, S_IRUGO, powr1220_show_voltage, NULL, + VMON12); +static SENSOR_DEVICE_ATTR(in12_input, S_IRUGO, powr1220_show_voltage, NULL, + VCCA); +static SENSOR_DEVICE_ATTR(in13_input, S_IRUGO, powr1220_show_voltage, NULL, + VCCINP); + +static SENSOR_DEVICE_ATTR(in0_highest, S_IRUGO, powr1220_show_max, NULL, + VMON1); +static SENSOR_DEVICE_ATTR(in1_highest, S_IRUGO, powr1220_show_max, NULL, + VMON2); +static SENSOR_DEVICE_ATTR(in2_highest, S_IRUGO, powr1220_show_max, NULL, + VMON3); +static SENSOR_DEVICE_ATTR(in3_highest, S_IRUGO, powr1220_show_max, NULL, + VMON4); +static SENSOR_DEVICE_ATTR(in4_highest, S_IRUGO, powr1220_show_max, NULL, + VMON5); +static SENSOR_DEVICE_ATTR(in5_highest, S_IRUGO, powr1220_show_max, NULL, + VMON6); +static SENSOR_DEVICE_ATTR(in6_highest, S_IRUGO, powr1220_show_max, NULL, + VMON7); +static SENSOR_DEVICE_ATTR(in7_highest, S_IRUGO, powr1220_show_max, NULL, + VMON8); +static SENSOR_DEVICE_ATTR(in8_highest, S_IRUGO, powr1220_show_max, NULL, + VMON9); +static SENSOR_DEVICE_ATTR(in9_highest, S_IRUGO, powr1220_show_max, NULL, + VMON10); +static SENSOR_DEVICE_ATTR(in10_highest, S_IRUGO, powr1220_show_max, NULL, + VMON11); +static SENSOR_DEVICE_ATTR(in11_highest, S_IRUGO, powr1220_show_max, NULL, + VMON12); +static SENSOR_DEVICE_ATTR(in12_highest, S_IRUGO, powr1220_show_max, NULL, + VCCA); +static SENSOR_DEVICE_ATTR(in13_highest, S_IRUGO, powr1220_show_max, NULL, + VCCINP); + +static SENSOR_DEVICE_ATTR(in0_label, S_IRUGO, powr1220_show_label, NULL, + VMON1); +static SENSOR_DEVICE_ATTR(in1_label, S_IRUGO, powr1220_show_label, NULL, + VMON2); +static SENSOR_DEVICE_ATTR(in2_label, S_IRUGO, powr1220_show_label, NULL, + VMON3); +static SENSOR_DEVICE_ATTR(in3_label, S_IRUGO, powr1220_show_label, NULL, + VMON4); +static SENSOR_DEVICE_ATTR(in4_label, S_IRUGO, powr1220_show_label, NULL, + VMON5); +static SENSOR_DEVICE_ATTR(in5_label, S_IRUGO, powr1220_show_label, NULL, + VMON6); +static SENSOR_DEVICE_ATTR(in6_label, S_IRUGO, powr1220_show_label, NULL, + VMON7); +static SENSOR_DEVICE_ATTR(in7_label, S_IRUGO, powr1220_show_label, NULL, + VMON8); +static SENSOR_DEVICE_ATTR(in8_label, S_IRUGO, powr1220_show_label, NULL, + VMON9); +static SENSOR_DEVICE_ATTR(in9_label, S_IRUGO, powr1220_show_label, NULL, + VMON10); +static SENSOR_DEVICE_ATTR(in10_label, S_IRUGO, powr1220_show_label, NULL, + VMON11); +static SENSOR_DEVICE_ATTR(in11_label, S_IRUGO, powr1220_show_label, NULL, + VMON12); +static SENSOR_DEVICE_ATTR(in12_label, S_IRUGO, powr1220_show_label, NULL, + VCCA); +static SENSOR_DEVICE_ATTR(in13_label, S_IRUGO, powr1220_show_label, NULL, + VCCINP); + +static struct attribute *powr1220_attrs[] = { + &sensor_dev_attr_in0_input.dev_attr.attr, + &sensor_dev_attr_in1_input.dev_attr.attr, + &sensor_dev_attr_in2_input.dev_attr.attr, + &sensor_dev_attr_in3_input.dev_attr.attr, + &sensor_dev_attr_in4_input.dev_attr.attr, + &sensor_dev_attr_in5_input.dev_attr.attr, + &sensor_dev_attr_in6_input.dev_attr.attr, + &sensor_dev_attr_in7_input.dev_attr.attr, + &sensor_dev_attr_in8_input.dev_attr.attr, + &sensor_dev_attr_in9_input.dev_attr.attr, + &sensor_dev_attr_in10_input.dev_attr.attr, + &sensor_dev_attr_in11_input.dev_attr.attr, + &sensor_dev_attr_in12_input.dev_attr.attr, + &sensor_dev_attr_in13_input.dev_attr.attr, + + &sensor_dev_attr_in0_highest.dev_attr.attr, + &sensor_dev_attr_in1_highest.dev_attr.attr, + &sensor_dev_attr_in2_highest.dev_attr.attr, + &sensor_dev_attr_in3_highest.dev_attr.attr, + &sensor_dev_attr_in4_highest.dev_attr.attr, + &sensor_dev_attr_in5_highest.dev_attr.attr, + &sensor_dev_attr_in6_highest.dev_attr.attr, + &sensor_dev_attr_in7_highest.dev_attr.attr, + &sensor_dev_attr_in8_highest.dev_attr.attr, + &sensor_dev_attr_in9_highest.dev_attr.attr, + &sensor_dev_attr_in10_highest.dev_attr.attr, + &sensor_dev_attr_in11_highest.dev_attr.attr, + &sensor_dev_attr_in12_highest.dev_attr.attr, + &sensor_dev_attr_in13_highest.dev_attr.attr, + + &sensor_dev_attr_in0_label.dev_attr.attr, + &sensor_dev_attr_in1_label.dev_attr.attr, + &sensor_dev_attr_in2_label.dev_attr.attr, + &sensor_dev_attr_in3_label.dev_attr.attr, + &sensor_dev_attr_in4_label.dev_attr.attr, + &sensor_dev_attr_in5_label.dev_attr.attr, + &sensor_dev_attr_in6_label.dev_attr.attr, + &sensor_dev_attr_in7_label.dev_attr.attr, + &sensor_dev_attr_in8_label.dev_attr.attr, + &sensor_dev_attr_in9_label.dev_attr.attr, + &sensor_dev_attr_in10_label.dev_attr.attr, + &sensor_dev_attr_in11_label.dev_attr.attr, + &sensor_dev_attr_in12_label.dev_attr.attr, + &sensor_dev_attr_in13_label.dev_attr.attr, + + NULL +}; + + +static umode_t powr1220_is_attribute_visible(struct kobject *kobj, + struct attribute *attr, int n) +{ + struct device *dev = kobj_to_dev(kobj); + struct powr1220_data *data = dev_get_drvdata(dev); + umode_t mode = attr->mode; + + if (attr == &sensor_dev_attr_in10_input.dev_attr.attr || + attr == &sensor_dev_attr_in11_input.dev_attr.attr || + attr == &sensor_dev_attr_in10_highest.dev_attr.attr || + attr == &sensor_dev_attr_in11_highest.dev_attr.attr || + attr == &sensor_dev_attr_in10_label.dev_attr.attr || + attr == &sensor_dev_attr_in11_label.dev_attr.attr){ + + if (data->id == ID_POWR1014) + mode = 0; + } + + return mode; +} + +//ATTRIBUTE_GROUPS(powr1220); +static const struct attribute_group powr1220_group = { + .is_visible = powr1220_is_attribute_visible, + .attrs = powr1220_attrs, +}; + +const struct attribute_group *powr1220_groups[] = { + &powr1220_group, + NULL +}; + + +static int powr1220_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct powr1220_data *data; + struct device *hwmon_dev; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) + return -ENODEV; + + data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + mutex_init(&data->update_lock); + data->client = client; + data->id = (int)id->driver_data; + + hwmon_dev = devm_hwmon_device_register_with_groups(&client->dev, + client->name, data, powr1220_groups); + + return PTR_ERR_OR_ZERO(hwmon_dev); +} + +static const struct i2c_device_id powr1220_ids[] = { + { "powr1220", ID_POWR1220, }, + { "powr1014", ID_POWR1014, }, + { } +}; + +MODULE_DEVICE_TABLE(i2c, powr1220_ids); + +static struct i2c_driver powr1220_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "powr1220", + }, + .probe = powr1220_probe, + .id_table = powr1220_ids, +}; + +module_i2c_driver(powr1220_driver); + +MODULE_AUTHOR("Scott Kanowitz"); +MODULE_DESCRIPTION("POWR1220 driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/modules/sysDefs.h b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/modules/sysDefs.h new file mode 100644 index 0000000000..94d07a2021 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/modules/sysDefs.h @@ -0,0 +1,86 @@ +/* + * COPYRIGHT (c) 2008 by Lattice Semiconductor Corporation + * + * All rights reserved. All use of this software and documentation is + * subject to the License Agreement located in the file LICENSE. + */ + + +/** @file + * Custom definitions to support a particular OS/platform. + * Common data type definitions for usability on a particular platform. + * Customized per platform/project depending on the OS and system environment + * that the code will be built with and run on. + * If the platform/build environment doesn't support certain POSIX standard + * types, defines, etc. specify them here. This file is customized per build + * platform (ie. one version for building with Linux, another for VxWorks, etc.) + * + */ + + +#ifndef LATTICE_SEMI_SYSDEFS_H +#define LATTICE_SEMI_SYSDEFS_H + + +/* + * Include specific header files for the OS that the code will run on. + */ +#include + + +typedef int status_t; + + +// Check if Linux 2.6 header files already define these types +#ifndef __BIT_TYPES_DEFINED__ +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; +#endif + + +/* These are Windows types (used in some shared files) so define them + * when not on a Windows platform. + */ +typedef unsigned char UCHAR; +typedef unsigned short USHORT; +typedef unsigned long ULONG; + +#ifndef __cplusplus +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)) +//typedef int bool; +#endif +#endif + +#ifndef OK +#define OK 0 +#endif + +#ifndef ERROR +#define ERROR -1 +#endif + +#ifndef true +#define true 1 +#endif + +#ifndef false +#define false 0 +#endif + + + +/*============ Unsupported Functions in Linux =============*/ + +// Windows Sleep() is in milliseconds +// Linux has a usleep() which is microseconds +#define Sleep(a) usleep(a * 1000) + + + +// Port some Windows concepts to Linux +typedef int HANDLE; +#define GUID char + + +#endif diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/modules/tps40425.c b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/modules/tps40425.c new file mode 100644 index 0000000000..b80190ee57 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/modules/tps40425.c @@ -0,0 +1,67 @@ +/* + * Hardware monitoring driver for TI TPS40422 + * + * Copyright (c) 2014 Nokia Solutions and Networks. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include "pmbus.h" + +enum chips { tps40422, tps40425 }; + +static struct pmbus_driver_info tps40422_info = { + .pages = 2, + .format[PSC_VOLTAGE_IN] = linear, + .format[PSC_VOLTAGE_OUT] = linear, + .format[PSC_TEMPERATURE] = linear, + .func[0] = PMBUS_HAVE_VOUT | PMBUS_HAVE_TEMP2 + | PMBUS_HAVE_STATUS_VOUT | PMBUS_HAVE_STATUS_TEMP + | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT, + .func[1] = PMBUS_HAVE_VOUT | PMBUS_HAVE_TEMP2 + | PMBUS_HAVE_STATUS_VOUT | PMBUS_HAVE_STATUS_TEMP + | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT, +}; + +static int tps40422_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + return pmbus_do_probe(client, id, &tps40422_info); +} + +static const struct i2c_device_id tps40422_id[] = { + {"tps40422", tps40422}, + {"tps40425", tps40425}, + {} +}; + +MODULE_DEVICE_TABLE(i2c, tps40422_id); + +/* This is the driver that will be inserted */ +static struct i2c_driver tps40422_driver = { + .driver = { + .name = "tps4042x", + }, + .probe = tps40422_probe, + .remove = pmbus_do_remove, + .id_table = tps40422_id, +}; + +module_i2c_driver(tps40422_driver); + +MODULE_AUTHOR("Zhu Laiwen "); +MODULE_DESCRIPTION("PMBus driver for TI TPS40422"); +MODULE_LICENSE("GPL"); diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/modules/x86-64-cameo-esc600-128q.c b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/modules/x86-64-cameo-esc600-128q.c new file mode 100644 index 0000000000..18fbf781e9 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/modules/x86-64-cameo-esc600-128q.c @@ -0,0 +1,4545 @@ +/* An hwmon driver for Cameo ESC600-128Q i2c Module */ +#pragma GCC diagnostic ignored "-Wformat-zero-length" +#include "x86-64-cameo-esc600-128q.h" + +/* Addresses scanned */ +static const unsigned short normal_i2c[] = { 0x30, 0x31, 0x33, I2C_CLIENT_END }; + +/*function */ +/*0x31 CPLD-1 700HC*/ +#ifdef LED_CTRL_WANTED +/********************************************************************************/ +/* Function Name : led_ctrl_get */ +/* Description : This is the function to get Ctrl LED Reg 0x31 0xa0 */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : String. */ +/********************************************************************************/ +static ssize_t led_ctrl_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 res = 0x1; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + if (attr->index == LED_CTRL) + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0xa0); //to get register 0x31 0xa0 + debug_print((KERN_DEBUG "DEBUG : LED_CTRL status = %x\n",status)); + sprintf(buf, ""); + if (status & res) + { + sprintf(buf, "%sFront port LED is enabled\n", buf); + } + else + { + sprintf(buf, "%sFront port LED is disabled\n", buf); + } + } + return sprintf(buf, "%s", buf); +} + +/********************************************************************************/ +/* Function Name : led_ctrl_set */ +/* Description : This is the function to set Ctrl LED Reg 0x31 0xa0 */ +/* Input(s) : 1 or 0. */ +/* Output(s) : None. */ +/* Returns : None. */ +/********************************************************************************/ +static ssize_t led_ctrl_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 status = 0; + u8 value = 0; + u8 result = 0; + u16 i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *CPLD_3_data = i2c_get_clientdata(Cameo_CPLD_3_client); + + mutex_lock(&CPLD_3_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : led_ctrl_set lock\n")); + if (attr->index == LED_CTRL) + { + i = simple_strtol(buf, NULL, 10); + switch(i) + { + case TURN_ON: + status = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0xa0); //to get register 0x31 0xa0 + debug_print((KERN_ALERT "DEBUG : LED_CTRL status = %x\n",status)); + value = status | LED_ON; + debug_print((KERN_ALERT "DEBUG : LED_CTRL value = %x\n",value)); + result = i2c_smbus_write_byte_data(Cameo_CPLD_3_client, 0xa0, value); //to set register 0x31 0xa0 + debug_print((KERN_ALERT "DEBUG : LED_CTRL result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: led_ctrl_set on FAILED!\n"); + } + else + { + debug_print((KERN_ALERT "DEBUG : Fiber LED is Enable\n")); + } + break; + + case TURN_OFF: + status = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0xa0); //to get register 0x31 0xa0 + debug_print((KERN_DEBUG "DEBUG : LED_CTRL status = %x\n",status)); + value = status & LED_OFF; + debug_print((KERN_DEBUG "DEBUG : LED_CTRL value = %x\n",value)); + result = i2c_smbus_write_byte_data(Cameo_CPLD_3_client, 0xa0, value); //to set register 0x31 0xa0 + debug_print((KERN_DEBUG "DEBUG : LED_CTRL result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: led_ctrl_set off FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "DEBUG : Fiber LED is Disable\n")); + } + break; + + default: + printk(KERN_ALERT "LED set wrong Value\n"); + } + } + mutex_unlock(&CPLD_3_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : led_ctrl_set unlock\n")); + return count; +} +#endif + +/********************************************************************************/ +/* Function Name : sensor_status_get */ +/* Description : This is the function to get thermal sensor alert */ +/* status 0x31 0xc0 */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : String. */ +/********************************************************************************/ +static ssize_t sensor_status_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 res = 0x1; + int i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + status = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0xc0); //to get register 0x31 0xc0 + debug_print((KERN_DEBUG "DEBUG : sensor_status_get status = %x\n",status)); + sprintf(buf, ""); + if (attr->index == SENSOR_STATUS) + { + for (i = 1; i <= 6; i++) + { + switch(i) + { + case ALERT_TH0: + if (!(status & res)) + { + sprintf(buf, "%sInterrupt is triggered by ALERT_TH0 (LM63)\n", buf); + } + break; + + case ALERT_TH1: + if (!(status & res)) + { + sprintf(buf, "%sInterrupt is triggered by ALERT_TH1\n", buf); + } + break; + + case ALERT_TH2: + if (!(status & res)) + { + sprintf(buf, "%sInterrupt is triggered by ALERT_TH2\n", buf); + } + break; + + case ALERT_TH3: + if (!(status & res)) + { + sprintf(buf, "%sInterrupt is triggered by ALERT_TH3\n", buf); + } + break; + + case ALERT_TH4: + if (!(status & res)) + { + sprintf(buf, "%sInterrupt is triggered by ALERT_TH4\n", buf); + } + break; + + case ALERT_TH5: + if (!(status & res)) + { + sprintf(buf, "%sInterrupt is triggered by ALERT_TH5 (IO Board)\n", buf); + } + break; + } + res = res << 1; + } + if(status == 0xf) + { + sprintf(buf, "%sNo interrupt is triggered\n", buf); + } + } + return sprintf(buf, "%s", buf); +} + +/********************************************************************************/ +/* Function Name : sersor_status_mask_all_get */ +/* Description : This is the function to get all thermal sensor alert */ +/* status mask 0x31 0xc1 */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : String. */ +/********************************************************************************/ +static ssize_t sersor_status_mask_all_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 res = 0x1; + int i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + status = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0xc1); //to get register 0x31 0xc1 + debug_print((KERN_DEBUG "DEBUG : sersor_status_mask_all_get status = %x\n",status)); + sprintf(buf, ""); + if (attr->index == SENSOR_STATUS_MASK) + { + for (i = 1; i <= 6; i++) + { + switch(i) + { + case ALERT_TH0_MASK: + if (status & res) + { + sprintf(buf, "%sALERT_TH1 Mask is enabled\n", buf); + } + else + { + sprintf(buf, "%sALERT_TH1 Mask is disabled\n", buf); + } + break; + case ALERT_TH1_MASK: + if (status & res) + { + sprintf(buf, "%sALERT_TH2 Mask is enabled\n", buf); + } + else + { + sprintf(buf, "%sALERT_TH2 Mask is disabled\n", buf); + } + break; + case ALERT_TH2_MASK: + if (status & res) + { + sprintf(buf, "%sALERT_TH3 Mask is enabled\n", buf); + } + else + { + sprintf(buf, "%sALERT_TH3 Mask is disabled\n", buf); + } + break; + case ALERT_TH3_MASK: + if (status & res) + { + sprintf(buf, "%sALERT_TH4 Mask is enabled\n", buf); + } + else + { + sprintf(buf, "%sALERT_TH4 Mask is disabled\n", buf); + } + break; + case ALERT_TH4_MASK: + if (status & res) + { + sprintf(buf, "%sALERT_TH5 Mask is enabled\n", buf); + } + else + { + sprintf(buf, "%sALERT_TH5 Mask is disabled\n", buf); + } + break; + case ALERT_TH5_MASK: + if (status & res) + { + sprintf(buf, "%sALERT_TH6 Mask is enabled\n", buf); + } + else + { + sprintf(buf, "%sALERT_TH6 Mask is disabled\n", buf); + } + break; + } + res = res << 1; + } + } + return sprintf(buf, "%s", buf); +} + +/********************************************************************************/ +/* Function Name : sersor_status_mask_get */ +/* Description : This is the function to get thermal sensor alert */ +/* status mask 0x31 0xc1 */ +/* Input(s) : attr->index. */ +/* Output(s) : None. */ +/* Returns : String. */ +/********************************************************************************/ +static ssize_t sersor_status_mask_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + status = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0xc1); //to get register 0x31 0xc1 + debug_print((KERN_DEBUG "DEBUG : sersor_status_mask_get status = %x\n",status)); + sprintf(buf, ""); + switch(attr->index) + { + case ALERT_TH0_MASK: + if (status & 0x1) + { + sprintf(buf, "%sALERT_TH1 Mask is enabled\n", buf); + } + else + { + sprintf(buf, "%sALERT_TH1 Mask is disabled\n", buf); + } + break; + case ALERT_TH1_MASK: + if (status & 0x2) + { + sprintf(buf, "%sALERT_TH2 Mask is enabled\n", buf); + } + else + { + sprintf(buf, "%sALERT_TH2 Mask is disabled\n", buf); + } + break; + case ALERT_TH2_MASK: + if (status & 0x4) + { + sprintf(buf, "%sALERT_TH3 Mask is enabled\n", buf); + } + else + { + sprintf(buf, "%sALERT_TH3 Mask is disabled\n", buf); + } + break; + case ALERT_TH3_MASK: + if (status & 0x8) + { + sprintf(buf, "%sALERT_TH4 Mask is enabled\n", buf); + } + else + { + sprintf(buf, "%sALERT_TH4 Mask is disabled\n", buf); + } + break; + case ALERT_TH4_MASK: + if (status & 0x10) + { + sprintf(buf, "%sALERT_TH5 Mask is enabled\n", buf); + } + else + { + sprintf(buf, "%sALERT_TH5 Mask is disabled\n", buf); + } + break; + case ALERT_TH5_MASK: + if (status & 0x20) + { + sprintf(buf, "%sALERT_TH6 Mask is enabled\n", buf); + } + else + { + sprintf(buf, "%sALERT_TH6 Mask is disabled\n", buf); + } + break; + } + return sprintf(buf, "%s", buf); +} + +/********************************************************************************/ +/* Function Name : sersor_status_mask_set */ +/* Description : This is the function to set thermal sensor alert */ +/* status mask 0x31 0xc1 */ +/* Input(s) : 1 or 0. */ +/* Output(s) : None. */ +/* Returns : None. */ +/********************************************************************************/ +static ssize_t sersor_status_mask_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 status = -EPERM; + u8 result = 0; + int i = 0; + int j = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *CPLD_3_data = i2c_get_clientdata(Cameo_CPLD_3_client); + + i = attr->index; + j = simple_strtol(buf, NULL, 10); //get input ON or OFF + debug_print((KERN_DEBUG "DEBUG : sersor_status_mask_set i: %d\n", i)); + debug_print((KERN_DEBUG "DEBUG : sersor_status_mask_set j: %d\n", j)); + mutex_lock(&CPLD_3_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : sersor_status_mask_set lock\n")); + if (i >= 1 && i <= 6) + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0xc1); //to get register 0x31 0xc1 + debug_print((KERN_DEBUG "DEBUG : sersor_status_mask_set status = %x\n",status)); + if( j == TURN_ON) + { + status |= (1 << (i-1)); + debug_print((KERN_DEBUG "DEBUG : sersor_status_mask_set value = %x\n",status)); + result = i2c_smbus_write_byte_data(Cameo_CPLD_3_client, 0xc1, status); //to set register 0x31 0xc1 + debug_print((KERN_DEBUG "DEBUG : sersor_status_mask_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: sersor_status_mask_%d set ON FAILED!\n", i); + } + else + { + debug_print((KERN_DEBUG "sersor_status_mask_set %02d ON\n", i)); + } + } + else if( j == TURN_OFF) + { + status &= ~(1 << (i-1)); + debug_print((KERN_DEBUG "DEBUG : sersor_status_mask_set value = %x\n",status)); + result = i2c_smbus_write_byte_data(Cameo_CPLD_3_client, 0xc1, status); //to set register 0x31 0xc1 + debug_print((KERN_DEBUG "DEBUG : sersor_status_mask_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: sersor_status_mask_%d set set OFF FAILED!\n", i); + } + else + { + debug_print((KERN_DEBUG "sersor_status_mask_set %02d OFF\n", i)); + } + } + else + { + printk(KERN_ALERT "sersor_status_mask_%d set wrong value\n", i); + } + } + mutex_unlock(&CPLD_3_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : sersor_status_mask_set unlock\n")); + return count; +} + +/********************************************************************************/ +/* Function Name : switch_alarm_get */ +/* Description : This is the function to get thermal sensor alert */ +/* status switch board 0x31 0xc2 */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : String. */ +/********************************************************************************/ +static ssize_t switch_alarm_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 res = 0x1; + int i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + res = 0x1; + status = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0xc2); //to get register 0x31 0xc2 + debug_print((KERN_DEBUG "DEBUG : switch_alarm_get status = %x\n",status)); + sprintf(buf, ""); + if (attr->index == SWITCH_ALARM) + { + for (i = 1; i <= 4; i++) + { + if ( i == SW_ALERT_TH0) + { + if (!(status & res)) + { + sprintf(buf, "%sInterrupt is triggered by SW_ALERT_TH0\n", buf); + } + } + else if( i == SW_ALERT_TH1) + { + if (!(status & res)) + { + sprintf(buf, "%sInterrupt is triggered by SW_ALERT_TH1\n", buf); + } + } + else if( i == SW_ALERT_TH2) + { + if (!(status & res)) + { + sprintf(buf, "%sInterrupt is triggered by SW_ALERT_TH2\n", buf); + } + } + else if( i == SW_ALERT_TH3) + { + if (!(status & res)) + { + sprintf(buf, "%sInterrupt is triggered by SW_ALERT_TH3\n", buf); + } + } + res = res << 1; + } + if(status == 0xf) + { + sprintf(buf, "%sNo interrupt is triggered\n", buf); + } + } + return sprintf(buf, "%s", buf); +} + +/********************************************************************************/ +/* Function Name : switch_alarm_mask_all_get */ +/* Description : This is the function to get all thermal sensor alert */ +/* status switch board mask 0x31 0xc3 */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : String. */ +/********************************************************************************/ +static ssize_t switch_alarm_mask_all_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 res = 0x1; + int i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + status = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0xc3); //to get register 0x31 0xc3 + debug_print((KERN_DEBUG "DEBUG : switch_alarm_mask_all_get status = %x\n",status)); + sprintf(buf, ""); + if (attr->index == SWITCH_ALARM_MASK) + { + for (i = 1; i <= 4; i++) + { + if ( i == SW_ALERT_TH0) + { + if (status & res) + { + sprintf(buf, "%sSW_ALERT_TH1 Mask is enabled\n", buf); + } + else + { + sprintf(buf, "%sSW_ALERT_TH1 Mask is disabled\n", buf); + } + } + else if( i == SW_ALERT_TH1) + { + if (status & res) + { + sprintf(buf, "%sSW_ALERT_TH2 Mask is enabled\n", buf); + } + else + { + sprintf(buf, "%sSW_ALERT_TH2 Mask is disabled\n", buf); + } + } + else if( i == SW_ALERT_TH2) + { + if (status & res) + { + sprintf(buf, "%sSW_ALERT_TH3 Mask is enabled\n", buf); + } + else + { + sprintf(buf, "%sSW_ALERT_TH3 Mask is disabled\n", buf); + } + } + else if( i == SW_ALERT_TH3) + { + if (status & res) + { + sprintf(buf, "%sSW_ALERT_TH4 Mask is enabled\n", buf); + } + else + { + sprintf(buf, "%sSW_ALERT_TH4 Mask is disabled\n", buf); + } + } + res = res << 1; + } + } + return sprintf(buf, "%s", buf); +} + +/********************************************************************************/ +/* Function Name : switch_alarm_mask_get */ +/* Description : This is the function to get thermal sensor alert */ +/* status switch board mask 0x31 0xc3 */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : String. */ +/********************************************************************************/ +static ssize_t switch_alarm_mask_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + status = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0xc3); //to get register 0x31 0xc3 + debug_print((KERN_DEBUG "DEBUG : switch_alarm_mask_get status = %x\n",status)); + sprintf(buf, ""); + if (attr->index == SW_ALERT_TH0_MASK) + { + if (status & 0x1) + { + sprintf(buf, "%sALERT_TH1 Mask is enabled\n", buf); + } + else + { + sprintf(buf, "%sALERT_TH1 Mask is disabled\n", buf); + } + } + else if(attr->index == SW_ALERT_TH1_MASK) + { + if (status & 0x2) + { + sprintf(buf, "%sALERT_TH2 Mask is enabled\n", buf); + } + else + { + sprintf(buf, "%sALERT_TH2 Mask is disabled\n", buf); + } + } + else if(attr->index == SW_ALERT_TH2_MASK) + { + if (status & 0x4) + { + sprintf(buf, "%sALERT_TH3 Mask is enabled\n", buf); + } + else + { + sprintf(buf, "%sALERT_TH3 Mask is disabled\n", buf); + } + } + else if(attr->index == SW_ALERT_TH3_MASK) + { + if (status & 0x8) + { + sprintf(buf, "%sALERT_TH4 Mask is enabled\n", buf); + } + else + { + sprintf(buf, "%sALERT_TH4 Mask is disabled\n", buf); + } + } + return sprintf(buf, "%s", buf); +} + +/********************************************************************************/ +/* Function Name : switch_alarm_mask_set */ +/* Description : This is the function to set thermal sensor alert */ +/* status switch board mask 0x31 0xc3 */ +/* Input(s) : 1 or 0. */ +/* Output(s) : None. */ +/* Returns : None. */ +/********************************************************************************/ +static ssize_t switch_alarm_mask_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 status = -EPERM; + u8 result = 0; + int i = 0; + int j = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *CPLD_3_data = i2c_get_clientdata(Cameo_CPLD_3_client); + + i = attr->index; + j = simple_strtol(buf, NULL, 10); + debug_print((KERN_DEBUG "DEBUG : switch_alarm_mask_set i: %d\n", i)); + debug_print((KERN_DEBUG "DEBUG : switch_alarm_mask_set j: %d\n", j)); + mutex_lock(&CPLD_3_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : switch_alarm_mask_set lock\n")); + if (i >= 1 && i <= 4) + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0xc3); //to get register 0x31 0xc3 + debug_print((KERN_DEBUG "DEBUG : switch_alarm_mask_set status = %x\n",status)); + if( j == TURN_ON) + { + status |= (1 << (i-1)); + debug_print((KERN_DEBUG "DEBUG : switch_alarm_mask_set value = %x\n",status)); + result = i2c_smbus_write_byte_data(Cameo_CPLD_3_client, 0xc3, status); //to set register 0x31 0xc3 + debug_print((KERN_DEBUG "DEBUG : switch_alarm_mask_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: switch_alarm_mask_%d set ON FAILED!\n", i); + } + else + { + debug_print((KERN_DEBUG "switch_alarm_mask_set %02d ON\n", i)); + } + } + else if( j == TURN_OFF) + { + status &= ~(1 << (i-1)); + debug_print((KERN_DEBUG "DEBUG : switch_alarm_mask_set value = %x\n",status)); + result = i2c_smbus_write_byte_data(Cameo_CPLD_3_client, 0xc3, status); //to set register 0x31 0xc3 + debug_print((KERN_DEBUG "DEBUG : switch_alarm_mask_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: switch_alarm_mask_%d set set OFF FAILED!\n", i); + } + else + { + debug_print((KERN_DEBUG "switch_alarm_mask_set %02d OFF\n", i)); + } + } + else + { + printk(KERN_ALERT "switch_alarm_mask_%d set wrong value\n", i); + } + } + mutex_unlock(&CPLD_3_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : switch_alarm_mask_set unlock\n")); + return count; +} + +/********************************************************************************/ +/* Function Name : sensor_int_get */ +/* Description : This is the function to get thermal sensor interrupt */ +/* 0x31 0xd0 */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : String. */ +/********************************************************************************/ +static ssize_t sensor_int_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 res = 0x1; + int i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + status = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0xd0); //to get register 0x31 0xd0 + debug_print((KERN_DEBUG "DEBUG : sensor_int_get status = %x\n",status)); + sprintf(buf, ""); + if (attr->index == SENSOR_INT) + { + for (i = 1; i <= 2; i++) + { + if ( i == SENSOR_INT_0) + { + if (!(status & res)) + { + sprintf(buf, "%sInterrupt is triggered by Switch Board\n", buf); + } + } + else if( i == SENSOR_INT_1) + { + if (!(status & res)) + { + sprintf(buf, "%sInterrupt is triggered by Carrier Board\n", buf); + } + } + res = res << 1; + } + if(status == 0x3) + { + sprintf(buf, "%sNo interrupt is triggered\n", buf); + } + } + return sprintf(buf, "%s", buf); +} + +/********************************************************************************/ +/* Function Name : sersor_int_mask_all_get */ +/* Description : This is function to get all thermal sensor interrupt */ +/* mask 0x31 0xd1 */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : String. */ +/********************************************************************************/ +static ssize_t sersor_int_mask_all_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 res = 0x1; + int i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + status = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0xd1); //to get register 0x31 0xd1 + debug_print((KERN_DEBUG "DEBUG : sersor_int_mask_all_get status = %x\n",status)); + sprintf(buf, ""); + if (attr->index == SENSOR_STATUS_MASK) + { + for (i = 1; i <= 2; i++) + { + if ( i == SENSOR_INT_0) + { + if (status & res) + { + sprintf(buf, "%sSENSOR_INT_1 Mask is enabled\n", buf); + } + else + { + sprintf(buf, "%sSENSOR_INT_1 Mask is disabled\n", buf); + } + } + else if( i == SENSOR_INT_1) + { + if (status & res) + { + sprintf(buf, "%sSENSOR_INT_2 Mask is enabled\n", buf); + } + else + { + sprintf(buf, "%sSENSOR_INT_2 Mask is disabled\n", buf); + } + } + res = res << 1; + } + } + return sprintf(buf, "%s", buf); +} + +/********************************************************************************/ +/* Function Name : sersor_int_mask_get */ +/* Description : This is the function to get thermal sensor interrupt */ +/* mask 0x31 0xd1 */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : String. */ +/********************************************************************************/ +static ssize_t sersor_int_mask_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + status = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0xd1); //to get register 0x31 0xd1 + debug_print((KERN_DEBUG "DEBUG : sersor_int_mask_get status = %x\n",status)); + sprintf(buf, ""); + if (attr->index == SENSOR_INT_0_MASK) + { + if (status & 0x1) + { + sprintf(buf, "%sSENSOR_INT_1 Mask is enabled\n", buf); + } + else + { + sprintf(buf, "%sSENSOR_INT_1 Mask is disabled\n", buf); + } + } + else if(attr->index == SENSOR_INT_1_MASK) + { + if (status & 0x2) + { + sprintf(buf, "%sSENSOR_INT_2 Mask is enabled\n", buf); + } + else + { + sprintf(buf, "%sSENSOR_INT_2 Mask is disabled\n", buf); + } + } + return sprintf(buf, "%s", buf); +} + +/********************************************************************************/ +/* Function Name : sersor_int_mask_set */ +/* Description : This is the function to set thermal sensor interrupt */ +/* mask 0x31 0xd1 */ +/* Input(s) : 1 or 0. */ +/* Output(s) : None. */ +/* Returns : None. */ +/********************************************************************************/ +static ssize_t sersor_int_mask_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 status = -EPERM; + u8 result = 0; + int i = 0; + int j = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *CPLD_3_data = i2c_get_clientdata(Cameo_CPLD_3_client); + + i = attr->index; + j = simple_strtol(buf, NULL, 10); + debug_print((KERN_DEBUG "DEBUG : sersor_int_mask_set i: %d\n", i)); + debug_print((KERN_DEBUG "DEBUG : sersor_int_mask_set j: %d\n", j)); + mutex_lock(&CPLD_3_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : sersor_int_mask_set lock\n")); + + status = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0xd1); //to get register 0x31 0xd1 + debug_print((KERN_DEBUG "DEBUG : sersor_int_mask_set status = %x\n",status)); + if( j == TURN_ON) + { + status |= (1 << (i-1)); + debug_print((KERN_DEBUG "DEBUG : sersor_int_mask_set value = %x\n",status)); + result = i2c_smbus_write_byte_data(Cameo_CPLD_3_client, 0xd1, status); //to set register 0x31 0xd1 + debug_print((KERN_DEBUG "DEBUG : sersor_int_mask_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: sersor_int_mask_%d set ON FAILED!\n", i); + } + else + { + debug_print((KERN_DEBUG "sersor_int_mask_set %02d ON\n", i)); + } + } + else if( j == TURN_OFF) + { + status &= ~(1 << (i-1)); + debug_print((KERN_DEBUG "DEBUG : sersor_int_mask_set value = %x\n",status)); + result = i2c_smbus_write_byte_data(Cameo_CPLD_3_client, 0xd1, status); //to set register 0x31 0xd1 + debug_print((KERN_DEBUG "DEBUG : sersor_int_mask_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: sersor_int_mask_%d set set OFF FAILED!\n", i); + } + else + { + debug_print((KERN_DEBUG "sersor_int_mask_set %02d OFF\n", i)); + } + } + else + { + printk(KERN_ALERT "sersor_int_mask_%d set wrong value\n", i); + } + + mutex_unlock(&CPLD_3_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : sersor_int_mask_set unlock\n")); + return count; +} + +/********************************************************************************/ +/* Function Name : fan_status_get */ +/* Description : This is the function to get fan status 0x30 0x00 */ +/* */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : String. */ +/********************************************************************************/ +/*0x30 CPLD-1 640UHC*/ +static ssize_t fan_status_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 bmc_present = -EPERM; + u8 mask = 0x1; + u8 res = 0x1; + u16 fan_speed; + int i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *target_client = NULL; + + debug_print((KERN_DEBUG "DEBUG : fan_status_get status = %x\n",status)); + sprintf(buf, ""); + if (attr->index == FAN_STATUS) + { + bmc_present = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0xa3); //to get 0x31 0xa3 + if (bmc_present & mask) + { + status = i2c_smbus_read_byte_data(Cameo_BMC_client, 0xe9); //to get register 0x14 0xe9 + } + else + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_4_client, 0xa1); //to get register 0x35 0xa1 + } + for (i = 1; i <= 8; i++) + { + if ( i >= 5 && i <= 8 ) + { + if (status & res) + { + sprintf(buf, "%sFan module %d status is Good\n", buf, i-4); + } + else + { + sprintf(buf, "%sFan module %d status is Fail\n", buf, i-4); + } + } + res = res << 1; + } + } + else if (attr->index == FAN_SPEED_RPM) + { + bmc_present = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0xa3); //to get 0x31 0xa3 + if (bmc_present & mask) + { + target_client = Cameo_BMC_client; + res = i2c_smbus_read_byte_data(Cameo_BMC_client, 0xe9); //to get register 0x14 0xe9 + } + else + { + target_client = Cameo_CPLD_4_client; + res = i2c_smbus_read_byte_data(Cameo_CPLD_4_client, 0xa1); //to get register 0x35 0xa1 + } + if(res < 0) { + sprintf(buf, "%sCheck fan present error\n", buf); + return sprintf(buf, "%s\n",buf); + } + for(i=0; i<4; i++) + { + // skip the fan which is not present + if(!(res & (0x01<index == FAN_INSERT) + { + for (i = 1; i <= 4; i++) + { + if (status & res) + { + sprintf(buf, "%sFan module %d is Insert\n", buf, i); + } + else + { + sprintf(buf, "%sFan module %d is Absent\n", buf, i); + } + res = res << 1; + } + } + return sprintf(buf, "%s", buf); +} + +/********************************************************************************/ +/* Function Name : fan_power_get */ +/* Description : This is the function to get fan power 0x30 0x02 */ +/* */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : String. */ +/********************************************************************************/ +static ssize_t fan_power_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 bmc_present = -EPERM; + u8 mask = 0x1; + u8 res = 0x1; + int i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + bmc_present = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0xa3); //to get 0x31 0xa3 + if (bmc_present & mask) + { + status = i2c_smbus_read_byte_data(Cameo_BMC_client, 0xea); //to get register 0x14 0xe9 + } + else + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_4_client, 0xa2); //to get register 0x35 0xa1 + } + debug_print((KERN_DEBUG "DEBUG : fan_power_get status = %x\n",status)); + sprintf(buf, ""); + if (attr->index == FAN_POWER) + { + for (i = 1; i <= 8; i++) + { + if ( i >= 5 && i <= 8 ) + { + if (status & res) + { + sprintf(buf, "%sFan module %d status is Power ON\n", buf, i-4); + } + else + { + sprintf(buf, "%sFan module %d status is Power OFF\n", buf, i-4); + } + } + res = res << 1; + } + } + return sprintf(buf, "%s", buf); +} + +/********************************************************************************/ +/* Function Name : fan_direct_get */ +/* Description : This is the function to get fan direct 0x30 0x03 */ +/* */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : String. */ +/********************************************************************************/ +static ssize_t fan_direct_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 bmc_present = -EPERM; + u8 mask = 0x1; + u8 res = 0x1; + int i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + bmc_present = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0xa3); //to get 0x31 0xa3 + if (bmc_present & mask) + { + status = i2c_smbus_read_byte_data(Cameo_BMC_client, 0xea); //to get register 0x14 0xe9 + } + else + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_4_client, 0xa2); //to get register 0x35 0xa1 + } + debug_print((KERN_DEBUG "DEBUG : fan_direct_get status = %x\n",status)); + sprintf(buf, ""); + if (attr->index == FAN_DIRECT) + { + for (i = 1; i <= 4; i++) + { + if (status & res) + { + sprintf(buf, "%sFan module %d direction is OUT\n", buf, i); + } + else + { + sprintf(buf, "%sFan module %d direction is IN\n", buf, i); + } + res = res << 1; + } + } + return sprintf(buf, "%s", buf); +} + +/********************************************************************************/ +/* Function Name : usb_power_get */ +/* Description : This is the function to get usb power 0x30 0xa0 */ +/* */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : String. */ +/********************************************************************************/ +static ssize_t usb_power_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 res = 0x1; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + if (attr->index == USB_POWER) + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_2_client, 0xa0); //to get register 0x30 0xa0 + debug_print((KERN_DEBUG "DEBUG : USB_POWER status = %x\n",status)); + sprintf(buf, ""); + if (status & res) + { + sprintf(buf, "%sUSB Power is ON\n", buf); + } + else + { + sprintf(buf, "%sUSB Power is OFF\n", buf); + } + } + return sprintf(buf, "%s", buf); +} + +/********************************************************************************/ +/* Function Name : usb_power_set */ +/* Description : This is the function to set usb power 0x30 0xa0 */ +/* */ +/* Input(s) : 1 or 0. */ +/* Output(s) : None. */ +/* Returns : None. */ +/********************************************************************************/ +static ssize_t usb_power_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 status = -EPERM; + u8 value = -EPERM; + u8 result = -EPERM; + u16 i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *CPLD_2_data = i2c_get_clientdata(Cameo_CPLD_2_client); + + mutex_lock(&CPLD_2_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : usb_power_set lock\n")); + status = i2c_smbus_read_byte_data(Cameo_CPLD_2_client, 0xa0); //to get register 0x30 0xa0 + debug_print((KERN_DEBUG "DEBUG : usb_power_set status = %x\n",status)); + if (attr->index == USB_POWER) + { + i = simple_strtol(buf, NULL, 10); //get input ON or OFF + if (i == TURN_ON) + { + value = status | USB_ON; + debug_print((KERN_DEBUG "DEBUG : usb_power_set value = %x\n",value)); + result = i2c_smbus_write_byte_data(Cameo_CPLD_2_client, 0xa0, value); //to set register 0x30 0xa0 + debug_print((KERN_DEBUG "DEBUG : usb_power_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: usb_ctrl_set ON FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "USB Power is ON\n")); + } + } + else if (i == TURN_OFF) + { + value = status & USB_OFF; + debug_print((KERN_DEBUG "DEBUG : usb_power_set value = %x\n",value)); + result = i2c_smbus_write_byte_data(Cameo_CPLD_2_client, 0xa0, value); //to set register 0x30 0xa0 + debug_print((KERN_DEBUG "DEBUG : usb_power_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: usb_power_set OFF FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "USB Power is OFF\n")); + } + } + else + { + printk(KERN_ALERT "USB_POWER set wrong Value\n"); + } + } + mutex_unlock(&CPLD_2_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : usb_power_set unlock\n")); + return count; +} + +#ifdef WDT_CTRL_WANTED +/********************************************************************************/ +/* Function Name : wdt_status_get */ +/* Description : This is the function to get WDT timer */ +/* */ +/* Input(s) : 1 or 0. */ +/* Output(s) : None. */ +/* Returns : None. */ +/********************************************************************************/ +static ssize_t wdt_status_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 res = 0x10; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + if (attr->index == WDT_CTRL) + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_2_client, 0xa0); //to get register 0x30 0xa0 + debug_print((KERN_DEBUG "DEBUG : WDT status = %x\n",status)); + sprintf(buf, ""); + if (status & res) + { + sprintf(buf, "%sWDT is Enable\n", buf); + } + else + { + sprintf(buf, "%sWDT is Disable\n", buf); + } + } + return sprintf(buf, "%s", buf); +} +/********************************************************************************/ +/* Function Name : wdt_status_set */ +/* Description : This is the function to set WDT timer */ +/* */ +/* Input(s) : 1 or 0. */ +/* Output(s) : None. */ +/* Returns : None. */ +/********************************************************************************/ +static ssize_t wdt_status_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 status = -EPERM; + u8 value = -EPERM; + u8 result = -EPERM; + u16 i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *CPLD_2_data = i2c_get_clientdata(Cameo_CPLD_2_client); + + mutex_lock(&CPLD_2_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : wdt_status_set lock\n")); + status = i2c_smbus_read_byte_data(Cameo_CPLD_2_client, 0xa0); //to get register 0x30 0xa0 + debug_print((KERN_DEBUG "DEBUG : wdt_status_set status = %x\n",status)); + if (attr->index == WDT_CTRL) + { + i = simple_strtol(buf, NULL, 10); //get input ON or OFF + if (i == TURN_ON) + { + value = status | 0x10; + debug_print((KERN_DEBUG "DEBUG : wdt_status_set value = %x\n",value)); + result = i2c_smbus_write_byte_data(Cameo_CPLD_2_client, 0xa0, value); //to set register 0x30 0xa0 + debug_print((KERN_DEBUG "DEBUG : wdt_status_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: usb_ctrl_set ON FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "WDT is Enable\n")); + } + } + else if (i == TURN_OFF) + { + value = status & 0xef; + debug_print((KERN_DEBUG "DEBUG : wdt_status_set value = %x\n",value)); + result = i2c_smbus_write_byte_data(Cameo_CPLD_2_client, 0xa0, value); //to set register 0x30 0xa0 + debug_print((KERN_DEBUG "DEBUG : wdt_status_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: wdt_status_set OFF FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "WDT is Disable\n")); + } + } + else + { + printk(KERN_ALERT "WDT set wrong Value\n"); + } + } + mutex_unlock(&CPLD_2_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : wdt_status_set unlock\n")); + return count; +} +#endif /*WDT_CTRL_WANTED*/ +/********************************************************************************/ +/* Function Name : shutdown_sys_get */ +/* Description : This is the function to get shutdown status */ +/* */ +/* Input(s) : 0. */ +/* Output(s) : None. */ +/* Returns : None. */ +static ssize_t shutdown_sys_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 res = 0x10; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + if (attr->index == SYS_SHUTDOWN) + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_2_client, 0xa1); //to get register 0x30 0xa1 + debug_print((KERN_DEBUG "DEBUG : Shutdown status = %x\n",status)); + sprintf(buf, ""); + if (status & res) + { + sprintf(buf, "%sShutdown is triggered\n", buf); + } + else + { + sprintf(buf, "%sShutdown is not triggered\n", buf); + } + } + return sprintf(buf, "%s", buf); +} +/********************************************************************************/ +/* Function Name : shutdown_sys_set */ +/* Description : This is the function to set shutdown status */ +/* */ +/* Input(s) : 0. */ +/* Output(s) : None. */ +/* Returns : None. */ +static ssize_t shutdown_sys_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 status = -EPERM; + u8 value = -EPERM; + u8 result = -EPERM; + u16 i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *CPLD_2_data = i2c_get_clientdata(Cameo_CPLD_2_client); + + mutex_lock(&CPLD_2_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : shutdown_sys_set lock\n")); + status = i2c_smbus_read_byte_data(Cameo_CPLD_2_client, 0xa1); //to get register 0x30 0xa0 + debug_print((KERN_DEBUG "DEBUG : shutdown_sys_set status = %x\n",status)); + if (attr->index == WDT_CTRL) + { + i = simple_strtol(buf, NULL, 10); //get input ON or OFF + if (i == TURN_ON) + { + value = status | 0x10; + debug_print((KERN_DEBUG "DEBUG : shutdown_sys_set value = %x\n",value)); + result = i2c_smbus_write_byte_data(Cameo_CPLD_2_client, 0xa1, value); //to set register 0x30 0xa0 + debug_print((KERN_DEBUG "DEBUG : shutdown_sys_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: usb_ctrl_set ON FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "Shutdown is Enable\n")); + } + } + else if (i == TURN_OFF) + { + value = status & 0xef; + debug_print((KERN_DEBUG "DEBUG : shutdown_sys_set value = %x\n",value)); + result = i2c_smbus_write_byte_data(Cameo_CPLD_2_client, 0xa1, value); //to set register 0x30 0xa0 + debug_print((KERN_DEBUG "DEBUG : shutdown_sys_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: shutdown_sys_set OFF FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "Shutdown is Disable\n")); + } + } + else + { + printk(KERN_ALERT "Shutdown set wrong Value\n"); + } + } + mutex_unlock(&CPLD_2_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : shutdown_sys_set unlock\n")); + return count; +} +/********************************************************************************/ +/* Function Name : reset_sys_set */ +/* Description : This is the function to reset system 0x30 0xa1 */ +/* */ +/* Input(s) : 0. */ +/* Output(s) : None. */ +/* Returns : None. */ +/********************************************************************************/ +static ssize_t reset_sys_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 status = 0; + u8 value = 0; + u8 result = 0; + u16 i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *CPLD_2_data = i2c_get_clientdata(Cameo_CPLD_2_client); + + mutex_lock(&CPLD_2_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : reset_sys_set lock\n")); + status = i2c_smbus_read_byte_data(Cameo_CPLD_2_client, 0xa1); //to get register 0x30 0xa1 + debug_print((KERN_DEBUG "DEBUG : SYS_RESET status = %x\n",status)); + if (attr->index == SYS_RESET) + { + i = simple_strtol(buf, NULL, 10); //get input 0 to reset system + if (i == 0) + { + value = 0x0; //value 0 to reset system + debug_print((KERN_DEBUG "DEBUG : reset_sys_set value = %x\n",value)); + result = i2c_smbus_write_byte_data(Cameo_CPLD_2_client, 0xa1, value); //to set register 0x30 0xa1 + debug_print((KERN_DEBUG "DEBUG : reset_sys_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: reset_sys_set set FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "Switch is reset\n")); + } + } + else + { + printk(KERN_ALERT "reset_sys_set set wrong Value\n"); + } + } + mutex_unlock(&CPLD_2_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : reset_sys_set unlock\n")); + return count; +} + +/********************************************************************************/ +/* Function Name : module_reset_set */ +/* Description : This is the function to reset PHY module 0x30 0xa2 */ +/* */ +/* Input(s) : PHY module number. */ +/* Output(s) : None. */ +/* Returns : None. */ +/********************************************************************************/ +static ssize_t module_reset_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 status = -EPERM; + u8 result = 0; + int card_num = 0; + int input = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *CPLD_2_data = i2c_get_clientdata(Cameo_CPLD_2_client); + + if (attr->index == MODULE_RESET) + { + input = simple_strtol(buf, NULL, 10); //get input module number + if(input <= 0 || input > 8) + { + printk(KERN_ALERT "ERROR: module_reset_%d RESET FAILED!\n", input); + } + else + { + mutex_lock(&CPLD_2_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : module_reset_set lock\n")); + status = i2c_smbus_read_byte_data(Cameo_CPLD_2_client, 0xa2); //to get register 0x30 0xa2 + debug_print((KERN_DEBUG "DEBUG : module_reset_set status = %x\n",status)); + status &= ~(1 << (input-1)); + debug_print((KERN_DEBUG "DEBUG : module_reset_set value = %x\n",status)); + result = i2c_smbus_write_byte_data(Cameo_CPLD_2_client, 0xa2, status); //to set register 0x30 0xa2 + debug_print((KERN_DEBUG "DEBUG : module_reset_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: module_reset_%d RESET FAILED!\n", card_num); + } + else + { + debug_print((KERN_DEBUG "module_reset_%02d SUCCESS\n", card_num)); + } + } + } + mutex_unlock(&CPLD_2_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : module_reset_set unlock\n")); + return count; +} + +/********************************************************************************/ +/* Function Name : module_insert_get */ +/* Description : This is the function to get module insert 0x30 0xa3 */ +/* */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : String. */ +/********************************************************************************/ +static ssize_t module_insert_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 res = 0x1; + int i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + status = i2c_smbus_read_byte_data(Cameo_CPLD_2_client, 0xa3); //get slot present status 0x30 0xa3 + debug_print((KERN_DEBUG "DEBUG : module_insert_get status = %x\n",status)); + sprintf(buf, ""); + if (attr->index == MODULE_INSERT) + { + for (i = 1; i <= 8; i++) + { + if (status & res) + { + sprintf(buf, "%sModule %d is present\n", buf , i); + } + else + { + sprintf(buf, "%sModule %d is not present\n", buf, i); + } + res = res << 1; + } + } + return sprintf(buf, "%s", buf); +} +/********************************************************************************/ +/* Function Name : module_power_get */ +/* Description : This is the function to get module insert 0x30 0xa3 */ +/* */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : String. */ +/********************************************************************************/ +static ssize_t module_power_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 res = 0x1; + int i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + status = i2c_smbus_read_byte_data(Cameo_CPLD_2_client, 0xa4); //get slot present status 0x30 0xa3 + debug_print((KERN_DEBUG "DEBUG : module_power_get status = %x\n",status)); + sprintf(buf, ""); + if (attr->index == MODULE_POWER) + { + for (i = 1; i <= 8; i++) + { + if (status & res) + { + sprintf(buf, "%sModule %d is power good\n", buf , i); + } + else + { + sprintf(buf, "%sModule %d is not power good\n", buf, i); + } + res = res << 1; + } + } + return sprintf(buf, "%s", buf); +} + +/********************************************************************************/ +/* Function Name : module_12v_status_get */ +/* Description : This is the function to get module insert 0x30 0xa3 */ +/* */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : String. */ +/********************************************************************************/ +static ssize_t module_12v_status_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 res = 0x1; + int i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + status = i2c_smbus_read_byte_data(Cameo_CPLD_2_client, 0xa5); //get slot present status 0x30 0xa3 + debug_print((KERN_DEBUG "DEBUG : module_12v_status_get status = %x\n",status)); + sprintf(buf, ""); + if (attr->index == MODULE_12V_STAT) + { + for (i = 1; i <= 8; i++) + { + if (status & res) + { + sprintf(buf, "%sModule %d 12V is enable\n", buf , i); + } + else + { + sprintf(buf, "%sModule %d 12V is disable\n", buf, i); + } + res = res << 1; + } + } + return sprintf(buf, "%s", buf); +} + +/********************************************************************************/ +/* Function Name : module_enable_get */ +/* Description : This is the function to get module insert 0x30 0xa3 */ +/* */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : String. */ +/********************************************************************************/ +static ssize_t module_enable_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + status = i2c_smbus_read_byte_data(Cameo_CPLD_2_client, 0xa5); //get slot present status 0x30 0xa3 + debug_print((KERN_DEBUG "DEBUG : module_enable_get status = %x\n",status)); + if (attr->index == MODULE_ENABLE) + { + sprintf(buf, "%s0x%x\n", buf, status); + } + return sprintf(buf, "%s", buf); +} +/********************************************************************************/ +/* Function Name : module_enable_set */ +/* Description : This is the function to reset PHY module 0x30 0xa2 */ +/* */ +/* Input(s) : PHY module number. */ +/* Output(s) : None. */ +/* Returns : None. */ +/********************************************************************************/ +static ssize_t module_enable_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 result = 0; + int input = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *CPLD_2_data = i2c_get_clientdata(Cameo_CPLD_2_client); + + if (attr->index == MODULE_ENABLE) + { + input = simple_strtol(buf, NULL, 16); //get input module number + debug_print((KERN_DEBUG "DEBUG : module_enable_set input = %x \n",input)); + + mutex_lock(&CPLD_2_data->update_lock); + result = i2c_smbus_write_byte_data(Cameo_CPLD_2_client, 0xa5, input); //to set register 0x30 0xa2 + debug_print((KERN_DEBUG "DEBUG : module_enable_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: module RESET FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "module enable SUCCESS\n")); + } + mdelay(1000); + } + mutex_unlock(&CPLD_2_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : module_enable_set unlock\n")); + return count; +} +/********************************************************************************/ +/* Function Name : switch_int_get */ +/* Description : This is the function to get switch interrupt status */ +/* 0x30 0xd0 */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : String. */ +/********************************************************************************/ +static ssize_t switch_int_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 res = 0x1; + int i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + status = i2c_smbus_read_byte_data(Cameo_CPLD_2_client, 0xd0); //to get register 0x30 0xd0 + debug_print((KERN_DEBUG "DEBUG : switch_int_get status = %x\n",status)); + sprintf(buf, ""); + if (attr->index == SWITCH_INT) + { + for (i = 1; i <= 6; i++) + { + switch(i) + { + case MODULE_INS_INT: + if (!(status & res)) + { + sprintf(buf, "%sInterrupt is triggered by Module insert\n", buf); + } + break; + case MODULE_INT: + if (!(status & res)) + { + sprintf(buf, "%sInterrupt is triggered by Module\n", buf); + } + break; + case MODULE_POWER_INT: + if (!(status & res)) + { + sprintf(buf, "%sInterrupt is triggered by Module Power\n", buf); + } + break; + case THER_SENSOR_INT: + if (!(status & res)) + { + sprintf(buf, "%sInterrupt is triggered by Thermal Sensor\n", buf); + } + break; + case IO_BOARD_INT: + if (!(status & res)) + { + sprintf(buf, "%sInterrupt is triggered by IO Board\n", buf); + } + break; + case FAN_ERROR_INT: + if (!(status & res)) + { + sprintf(buf, "%sInterrupt is triggered by FAN ERROR\n", buf); + } + break; + } + res = res << 1; + } + if(status == 0xf) + { + sprintf(buf, "%sNo interrupt is triggered\n", buf); + } + } + return sprintf(buf, "%s", buf); +} + +/********************************************************************************/ +/* Function Name : switch_int_mask_all_get */ +/* Description : This is the function to get all switch interrupt */ +/* mask status 0x30 0xd1 */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : String. */ +/********************************************************************************/ +static ssize_t switch_int_mask_all_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 res = 0x1; + int i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + status = i2c_smbus_read_byte_data(Cameo_CPLD_2_client, 0xd1); //to get register 0x30 0xd1 + debug_print((KERN_DEBUG "DEBUG : switch_int_mask_all_get status = %x\n",status)); + sprintf(buf, ""); + if (attr->index == SWITCH_INT_MASK) + { + for (i = 1; i <= 6; i++) + { + switch(i) + { + case MODULE_INS_INT_MASK: + if (status & res) + { + sprintf(buf, "%sModule insert interrupt Mask is enabled\n", buf); + } + else + { + sprintf(buf, "%sModule insert interrupt Mask is disabled\n", buf); + } + break; + case MODULE_INT_MASK: + if (status & res) + { + sprintf(buf, "%sModule interrupt Mask is enabled\n", buf); + } + else + { + sprintf(buf, "%sModule interrupt Mask is disabled\n", buf); + } + break; + case MODULE_POW_INT_MASK: + if (status & res) + { + sprintf(buf, "%sModule power interrupt Mask is enabled\n", buf); + } + else + { + sprintf(buf, "%sModule power interrupt Mask is disabled\n", buf); + } + break; + case THER_SEN_INT_MASK: + if (status & res) + { + sprintf(buf, "%sThermal Sensor interrupt Mask is enabled\n", buf); + } + else + { + sprintf(buf, "%sThermal Sensor interrupt Mask is disabled\n", buf); + } + break; + case IO_BOARD_INT_MASK: + if (status & res) + { + sprintf(buf, "%sIO Board interrupt Mask is enabled\n", buf); + } + else + { + sprintf(buf, "%sIO Board interrupt Mask is disabled\n", buf); + } + break; + case FAN_ERROR_INT_MASK: + if (status & res) + { + sprintf(buf, "%sFan error interrupt Mask is enabled\n", buf); + } + else + { + sprintf(buf, "%sFan error interrupt Mask is disabled\n", buf); + } + break; + } + res = res << 1; + } + } + return sprintf(buf, "%s", buf); +} + +/********************************************************************************/ +/* Function Name : switch_int_mask_get */ +/* Description : This is the function to get switch interrupt */ +/* mask status 0x30 0xd1 */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : String. */ +/********************************************************************************/ +static ssize_t switch_int_mask_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + status = i2c_smbus_read_byte_data(Cameo_CPLD_2_client, 0xd1); //to get register 0x30 0xd1 + debug_print((KERN_DEBUG "DEBUG : switch_int_mask_get status = %x\n",status)); + sprintf(buf, ""); + switch(attr->index) + { + case MODULE_INS_INT_MASK: + if (status & 0x1) + { + sprintf(buf, "%sModule insert interrupt Mask is enabled\n", buf); + } + else + { + sprintf(buf, "%sModule insert interrupt Mask is disabled\n", buf); + } + break; + case MODULE_INT_MASK: + if (status & 0x2) + { + sprintf(buf, "%sModule interrupt Mask is enabled\n", buf); + } + else + { + sprintf(buf, "%sModule interrupt Mask is disabled\n", buf); + } + break; + case MODULE_POW_INT_MASK: + if (status & 0x4) + { + sprintf(buf, "%sModule power interrupt Mask is enabled\n", buf); + } + else + { + sprintf(buf, "%sModule power interrupt Mask is disabled\n", buf); + } + break; + case THER_SEN_INT_MASK: + if (status & 0x8) + { + sprintf(buf, "%sThermal Sensor interrupt Mask is enabled\n", buf); + } + else + { + sprintf(buf, "%sThermal Sensor interrupt Mask is disabled\n", buf); + } + break; + case IO_BOARD_INT_MASK: + if (status & 0x10) + { + sprintf(buf, "%sIO Board interrupt Mask is enabled\n", buf); + } + else + { + sprintf(buf, "%sIO Board interrupt Mask is disabled\n", buf); + } + break; + case FAN_ERROR_INT_MASK: + if (status & 0x20) + { + sprintf(buf, "%sFan error interrupt Mask is enabled\n", buf); + } + else + { + sprintf(buf, "%sFan error interrupt Mask is disabled\n", buf); + } + break; + } + return sprintf(buf, "%s", buf); +} + +/********************************************************************************/ +/* Function Name : switch_int_mask_set */ +/* Description : This is the function to set switch interrupt */ +/* mask status 0x30 0xd1 */ +/* Input(s) : 1 or 0. */ +/* Output(s) : None. */ +/* Returns : None . */ +/********************************************************************************/ +static ssize_t switch_int_mask_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 status = -EPERM; + u8 result = 0; + int i = 0; + int j = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *CPLD_2_data = i2c_get_clientdata(Cameo_CPLD_2_client); + + i = attr->index; + j = simple_strtol(buf, NULL, 10); + debug_print((KERN_DEBUG "DEBUG : switch_int_mask_set i: %d\n", i)); + debug_print((KERN_DEBUG "DEBUG : switch_int_mask_set j: %d\n", j)); + mutex_lock(&CPLD_2_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : switch_int_mask_set lock\n")); + if (i >= 1 && i <= 6) + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_2_client, 0xd1); //to get register 0x30 0xd1 + debug_print((KERN_DEBUG "DEBUG : switch_int_mask_set status = %x\n",status)); + if( j == TURN_ON) + { + status |= (1 << (i-1)); + debug_print((KERN_DEBUG "DEBUG : switch_int_mask_set value = %x\n",status)); + result = i2c_smbus_write_byte_data(Cameo_CPLD_2_client, 0xd1, status); //to set register 0x30 0xd1 + debug_print((KERN_DEBUG "DEBUG : switch_int_mask_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: switch_int_mask_%d set ON FAILED!\n", i); + } + else + { + debug_print((KERN_DEBUG "switch_int_mask_set %02d ON\n", i)); + } + } + else if( j == TURN_OFF) + { + status &= ~(1 << (i-1)); + debug_print((KERN_DEBUG "DEBUG : switch_int_mask_set value = %x\n",status)); + result = i2c_smbus_write_byte_data(Cameo_CPLD_2_client, 0xd1, status); //to set register 0x30 0xd1 + debug_print((KERN_DEBUG "DEBUG : switch_int_mask_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: switch_int_mask_%d set set OFF FAILED!\n", i); + } + else + { + debug_print((KERN_DEBUG "switch_int_mask_set %02d OFF\n", i)); + } + } + else + { + printk(KERN_ALERT "switch_int_mask_%d set wrong value\n", i); + } + } + mutex_unlock(&CPLD_2_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : switch_int_mask_set unlock\n")); + return count; +} + +/*0x33 I/O Board CPLD*/ +/********************************************************************************/ +/* Function Name : sfp_select_get */ +/* Description : This is the function to get sfp i2c interface */ +/* status 0x33 0x20 */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : String. */ +/********************************************************************************/ +static ssize_t sfp_select_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + if (attr->index == SFP_SELECT) + { + status = i2c_smbus_read_byte_data(ESC_600_128q_client, 0x60); //to get register 0x33 0x60 + debug_print((KERN_DEBUG "DEBUG : SFP_SELECT status = %x\n",status)); + sprintf(buf, ""); + if (status & 0x1) + { + sprintf(buf, "%sI2C interface is set Port 1\n", buf); + } + else if (status & 0x2) + { + sprintf(buf, "%sI2C interface is set Port 2\n", buf); + } + else if (status & 0x3) + { + sprintf(buf, "%sI2C interface is set Port MGM\n", buf); + } + else + { + sprintf(buf, "%sI2C interface is NOT SET\n", buf); + } + } + return sprintf(buf, "%s", buf); +} + +/********************************************************************************/ +/* Function Name : sfp_select_set */ +/* Description : This is the function to set sfp i2c interface */ +/* status 0x33 0x20 */ +/* Input(s) : 1 or 0. */ +/* Output(s) : None. */ +/* Returns : None. */ +/********************************************************************************/ +static ssize_t sfp_select_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 status = -EPERM; + u8 value = -EPERM; + u8 result = -EPERM; + u16 i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *data = i2c_get_clientdata(ESC_600_128q_client); + + mutex_lock(&data->update_lock); + debug_print((KERN_DEBUG "DEBUG : sfp_select_set lock\n")); + status = i2c_smbus_read_byte_data(ESC_600_128q_client, 0x60); //to get register 0x33 0x60 + debug_print((KERN_DEBUG "DEBUG : sfp_select_set status = %x\n",status)); + if (attr->index == SFP_SELECT) + { + i = simple_strtol(buf, NULL, 10); + if (i == 0) + { + value = 0x0; + debug_print((KERN_DEBUG "DEBUG : sfp_select_set value = %x\n",value)); + result = i2c_smbus_write_byte_data(ESC_600_128q_client, 0x60, value); //to set register 0x33 0x60 + debug_print((KERN_DEBUG "DEBUG : sfp_select_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: I2C interface is set Port 1 FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "I2C interface is NOT set\n")); + } + } + else if (i == 1) + { + value = 0x1; + debug_print((KERN_DEBUG "DEBUG : sfp_select_set value = %x\n",value)); + result = i2c_smbus_write_byte_data(ESC_600_128q_client, 0x60, value); //to set register 0x33 0x60 + debug_print((KERN_DEBUG "DEBUG : sfp_select_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: I2C interface is set Port 1 FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "I2C interface is set Port 1\n")); + } + } + else if (i == 2) + { + value = 0x2; + debug_print((KERN_DEBUG "DEBUG : sfp_select_set value = %x\n",value)); + result = i2c_smbus_write_byte_data(ESC_600_128q_client, 0x60, value); //to set register 0x33 0x60 + debug_print((KERN_DEBUG "DEBUG : sfp_select_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: I2C interface is set Port 2 FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "I2C interface is set Port 2\n")); + } + } + else if (i == 3) + { + value = 0x3; + debug_print((KERN_DEBUG "DEBUG : sfp_select_set value = %x\n",value)); + result = i2c_smbus_write_byte_data(ESC_600_128q_client, 0x60, value); //to set register 0x33 0x60 + debug_print((KERN_DEBUG "DEBUG : sfp_select_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: I2C interface is set Port MGM FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "I2C interface is set Port MGM\n")); + } + } + else + { + printk(KERN_ALERT "SFP_SELECT set wrong Value\n"); + } + } + mutex_unlock(&data->update_lock); + debug_print((KERN_DEBUG "DEBUG : sfp_select_set unlock\n")); + return count; +} + +/********************************************************************************/ +/* Function Name : sfp_tx_get */ +/* Description : This is the function to get sfp tx status */ +/* 0x33 0x70 */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : String. */ +/********************************************************************************/ +static ssize_t sfp_tx_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 res = 0x1; + int i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + status = i2c_smbus_read_byte_data(ESC_600_128q_client, 0x70); //to get register 0x33 0x70 + debug_print((KERN_DEBUG "DEBUG : sfp_tx_get status = %x\n",status)); + sprintf(buf, ""); + if (attr->index == SFP_TX_DISABLE) + { + for (i = 1; i <= 3; i++) + { + if ( i == SFP_PORT_1) + { + if (status & res) + { + sprintf(buf, "%sTX of SFP port 1 is disabled\n", buf); + } + else + { + sprintf(buf, "%sTX of SFP port 1 is enabled\n", buf); + } + } + else if( i == SFP_PORT_2) + { + if (status & res) + { + sprintf(buf, "%sTX of SFP port 2 is disabled\n", buf); + } + else + { + sprintf(buf, "%sTX of SFP port 2 is enabled\n", buf); + } + } + else if( i == SFP_PORT_MGM) + { + if (status & res) + { + sprintf(buf, "%sTX of SFP port MGM is disabled\n", buf); + } + else + { + sprintf(buf, "%sTX of SFP port MGM is enabled\n", buf); + } + } + res = res << 1; + } + } + return sprintf(buf, "%s", buf); +} + +/********************************************************************************/ +/* Function Name : sfp_tx_set */ +/* Description : This is the function to set sfp tx status */ +/* 0x33 0x70 */ +/* Input(s) : 1 ~ 4. */ +/* Output(s) : None. */ +/* Returns : None. */ +/********************************************************************************/ +static ssize_t sfp_tx_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 status = -EPERM; + u8 value = -EPERM; + u8 result = -EPERM; + u16 i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *data = i2c_get_clientdata(ESC_600_128q_client); + + mutex_lock(&data->update_lock); + debug_print((KERN_DEBUG "DEBUG : sfp_tx_set lock\n")); + status = i2c_smbus_read_byte_data(ESC_600_128q_client, 0x70); //to get register 0x33 0xa0 + debug_print((KERN_DEBUG "DEBUG : sfp_tx_set status = %x\n",status)); + if (attr->index == SFP_TX_DISABLE) + { + i = simple_strtol(buf, NULL, 10); + if (i == SFP_PORT_1_OFF) //i = 1 + { + value = status | 0x1; + debug_print((KERN_DEBUG "DEBUG : sfp_tx_set value = %x\n",value)); + result = i2c_smbus_write_byte_data(ESC_600_128q_client, 0x70, value); //to set register 0x33 0xa0 + debug_print((KERN_DEBUG "DEBUG : sfp_tx_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: sfp_tx_set PORT_1 OFF FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "SFP_PORT_1 is OFF\n")); + } + } + else if (i == SFP_PORT_1_ON) //i = 2 + { + value = status & 0xfe; + debug_print((KERN_DEBUG "DEBUG : sfp_tx_set value = %x\n",value)); + result = i2c_smbus_write_byte_data(ESC_600_128q_client, 0x70, value); //to set register 0x33 0xa0 + debug_print((KERN_DEBUG "DEBUG : sfp_tx_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: sfp_tx_set PORT_1 ON FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "SFP_PORT_1 is ON\n")); + } + } + else if (i == SFP_PORT_2_OFF) //i = 3 + { + value = status | 0x2; + debug_print((KERN_DEBUG "DEBUG : sfp_tx_set value = %x\n",value)); + result = i2c_smbus_write_byte_data(ESC_600_128q_client, 0x70, value); //to set register 0x33 0xa0 + debug_print((KERN_DEBUG "DEBUG : sfp_tx_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: sfp_tx_set PORT_2 OFF FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "SFP_PORT_2 is OFF\n")); + } + } + else if (i == SFP_PORT_2_ON) //i = 4 + { + value = status & 0xfd; + debug_print((KERN_DEBUG "DEBUG : sfp_tx_set value = %x\n",value)); + result = i2c_smbus_write_byte_data(ESC_600_128q_client, 0x70, value); //to set register 0x33 0xa0 + debug_print((KERN_DEBUG "DEBUG : sfp_tx_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: sfp_tx_set PORT_2 ON FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "SFP_PORT_2 is ON\n")); + } + } + else if (i == SFP_PORT_MGM_OFF) //i = 5 + { + value = status | 0x4; + debug_print((KERN_DEBUG "DEBUG : sfp_tx_set value = %x\n",value)); + result = i2c_smbus_write_byte_data(ESC_600_128q_client, 0x70, value); //to set register 0x33 0xa0 + debug_print((KERN_DEBUG "DEBUG : sfp_tx_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: sfp_tx_set MGM OFF FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "SFP_PORT_MGM is OFF\n")); + } + } + else if (i == SFP_PORT_MGM_ON) //i = 6 + { + value = status & 0xfb; + debug_print((KERN_DEBUG "DEBUG : sfp_tx_set value = %x\n",value)); + result = i2c_smbus_write_byte_data(ESC_600_128q_client, 0x70, value); //to set register 0x33 0xa0 + debug_print((KERN_DEBUG "DEBUG : sfp_tx_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: sfp_tx_set MGM ON FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "SFP_PORT_MGM is ON\n")); + } + } + else + { + printk(KERN_ALERT "SFP_TX set wrong Value\n"); + } + } + mutex_unlock(&data->update_lock); + debug_print((KERN_DEBUG "DEBUG : usb_power_set unlock\n")); + return count; +} + +/********************************************************************************/ +/* Function Name : sfp_insert_get */ +/* Description : This is the function to get sfp insert status */ +/* 0x33 0x80 */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : String. */ +/********************************************************************************/ +static ssize_t sfp_insert_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 res = 0x1; + int i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + status = i2c_smbus_read_byte_data(ESC_600_128q_client, 0x80); //to get register 0x33 0x80 + debug_print((KERN_DEBUG "DEBUG : sfp_insert_get status = %x\n",status)); + sprintf(buf, ""); + if (attr->index == SFP_INSERT) + { + for (i = 1; i <= 3; i++) + { + if ( i == SFP_PORT_1) + { + if (status & res) + { + sprintf(buf, "%sSFP port 1 is not present\n", buf); + } + else + { + sprintf(buf, "%sSFP port 1 is present\n", buf); + } + } + else if( i == SFP_PORT_2) + { + if (status & res) + { + sprintf(buf, "%sSFP port 2 is not present\n", buf); + } + else + { + sprintf(buf, "%sSFP port 2 is present\n", buf); + } + } + else if( i == SFP_PORT_MGM) + { + if (status & res) + { + sprintf(buf, "%sSFP port MGM is not present\n", buf); + } + else + { + sprintf(buf, "%sSFP port MGM is present\n", buf); + } + } + res = res << 1; + } + } + return sprintf(buf, "%s", buf); +} + +/********************************************************************************/ +/* Function Name : sfp_rx_get */ +/* Description : This is the function to get sfp rx loss status */ +/* 0x33 0x90 */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : String. */ +/********************************************************************************/ +static ssize_t sfp_rx_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 res = 0x1; + int i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + status = i2c_smbus_read_byte_data(ESC_600_128q_client, 0x90); //to get register 0x33 0x90 + debug_print((KERN_DEBUG "DEBUG : sfp_rx_get status = %x\n",status)); + sprintf(buf, ""); + if (attr->index == SFP_RX_LOSS) + { + for (i = 1; i <= 3; i++) + { + if ( i == SFP_PORT_1) + { + if (status & res) + { + sprintf(buf, "%sSFP port 1 receiver loss of signal\n", buf); + } + else + { + sprintf(buf, "%sSFP port 1 receiver signal is detceted\n", buf); + } + } + else if( i == SFP_PORT_2) + { + if (status & res) + { + sprintf(buf, "%sSFP port 2 receiver loss of signal\n", buf); + } + else + { + sprintf(buf, "%sSFP port 2 receiver signal is detceted\n", buf); + } + } + else if( i == SFP_PORT_MGM) + { + if (status & res) + { + sprintf(buf, "%sSFP port MGM receiver loss of signal\n", buf); + } + else + { + sprintf(buf, "%sSFP port MGM receiver signal is detceted\n", buf); + } + } + res = res << 1; + } + } + return sprintf(buf, "%s", buf); +} + +/********************************************************************************/ +/* Function Name : psu_status_get */ +/* Description : This is the function to get psu status */ +/* 0x33 0xa0 */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : String. */ +/********************************************************************************/ +static ssize_t psu_status_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 bmc_present = -EPERM; + u8 res = 0x1; + u8 mask = 0x1; + int i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + bmc_present = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0xa3); //to get 0x31 0xa3 + if (bmc_present & mask) + { + status = i2c_smbus_read_byte_data(Cameo_BMC_client, 0xe8); //to get register 0x14 0xe8 + } + else + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_4_client, 0xa0); //to get register 0x35 0xa0 + } + debug_print((KERN_DEBUG "DEBUG : psu_status_get status = %x\n",status)); + sprintf(buf, ""); + switch (attr->index) + { + case PSU_PRESENT: + res = 0x1; + for (i = 1; i <= 4; i++) + { + if (status & res) + { + sprintf(buf, "%sPSU %d is present\n", buf, i); + } + else + { + sprintf(buf, "%sPSU %d is not present\n", buf, i); + } + res = res << 1; + } + break; + case PSU_STATUS: + res = 0x1; + for (i = 1; i <= 8; i++) + { + if (i >= 5 && i <=8) + { + if (status & res) + { + sprintf(buf, "%sPSU %d is not power good\n", buf, i - 4); + } + else + { + sprintf(buf, "%sPSU %d is power good\n", buf, i - 4); + } + } + res = res << 1; + } + break; + } + return sprintf(buf, "%s", buf); +} + +#ifdef LINEAR_CONVERT_FUNCTION +static long read_reg_linear(s32 data) +{ + s16 exponent; + s32 mantissa; + long val; + + exponent = ((s16)data) >> 11; + mantissa = ((s16)((data & 0x7ff) << 5)) >> 5; + + val = mantissa; + val = val * 1000L; + + if (exponent >= 0) + val <<= exponent; + else + val >>= -exponent; + + return val/1000; +} +#endif /*LINEAR_CONVERT_FUNCTION*/ +/********************************************************************************/ +/* Function Name : switch_button_get */ +/* Description : This is the function to get switch button status */ +/* 0x33 0xa1 */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : String. */ +/********************************************************************************/ +static ssize_t switch_button_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 res = 0x1; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + status = i2c_smbus_read_byte_data(ESC_600_128q_client, 0xa1); //to get register 0x33 0xa1 + debug_print((KERN_DEBUG "DEBUG : switch_button_get status = %x\n",status)); + sprintf(buf, ""); + if (attr->index == SWITCH_BUTTON) + { + if (status & res) + { + sprintf(buf, "%sSwitch button is normal\n", buf); + } + else + { + sprintf(buf, "%sSwitch button is press and hold\n", buf); + } + } + return sprintf(buf, "%s", buf); +} + +/********************************************************************************/ +/* Function Name : sys_led_get */ +/* Description : This is the function to get switch sys LED status */ +/* 0x33 0xa2 */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : String. */ +/********************************************************************************/ +static ssize_t sys_led_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 res = 0x1; + int i; + int led_a_status = 0; + int led_g_status = 0; + int led_b_status = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + status = i2c_smbus_read_byte_data(ESC_600_128q_client, 0xa2); //to get register 0x33 0xa2 + debug_print((KERN_DEBUG "DEBUG : sys_led_get status = %x\n",status)); + sprintf(buf, ""); + if (attr->index == SYS_LED) + { + for (i = 1; i <= 3; i++) + { + if ( i == SYS_LED_A) + { + if (status & res) + { + led_a_status = TURN_ON; + } + else + { + led_a_status = TURN_OFF; + } + } + else if( i == SYS_LED_G) + { + if (status & res) + { + led_g_status = TURN_ON; + } + else + { + led_g_status = TURN_OFF; + } + } + else if( i == SYS_LED_BLINK) + { + if (status & res) + { + led_b_status = TURN_ON; + } + else + { + led_b_status = TURN_OFF; + } + } + res = res << 1; + } + + if(led_a_status == TURN_ON && led_b_status == TURN_ON) + { + sprintf(buf, "%sSYS LED is set to amber and blink\n", buf); + } + else if(led_a_status == TURN_ON && led_b_status == TURN_OFF) + { + sprintf(buf, "%sSYS LED is set to amber\n", buf); + } + else if(led_g_status == TURN_ON && led_b_status == TURN_ON) + { + sprintf(buf, "%sSYS LED is set to green and blink\n", buf); + } + else if(led_g_status == TURN_ON && led_b_status == TURN_OFF) + { + sprintf(buf, "%sSYS LED is set to green\n", buf); + } + else + { + sprintf(buf, "%sSYS LED is set OFF\n", buf); + } + } + return sprintf(buf, "%s", buf); +} + +/********************************************************************************/ +/* Function Name : sys_led_Set */ +/* Description : This is the function to set switch sys LED status */ +/* 0x33 0xa2 */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : String. */ +/********************************************************************************/ +static ssize_t sys_led_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 status = -EPERM; + u8 value = -EPERM; + u8 result = -EPERM; + u16 i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *data = i2c_get_clientdata(ESC_600_128q_client); + + mutex_lock(&data->update_lock); + debug_print((KERN_DEBUG "DEBUG : sys_led_set lock\n")); + status = i2c_smbus_read_byte_data(ESC_600_128q_client, 0xa2); //to get register 0x33 0xa2 + debug_print((KERN_DEBUG "DEBUG : sys_led_set status = %x\n",status)); + if (attr->index == SYS_LED) + { + i = simple_strtol(buf, NULL, 10); + switch(i) + { + case SYS_LED_OFF: + value = 0x0; + debug_print((KERN_DEBUG "DEBUG : sys_led_set value = %x\n",value)); + result = i2c_smbus_write_byte_data(ESC_600_128q_client, 0xa2, value); //to set register 0x33 0xa2 + debug_print((KERN_DEBUG "DEBUG : sys_led_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: sys_led_set SYS_LED_OFF FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "SYS LED is set OFF\n")); + } + break; + case SYS_LED_A_N: + value = 0x1; + debug_print((KERN_DEBUG "DEBUG : sys_led_set value = %x\n",value)); + result = i2c_smbus_write_byte_data(ESC_600_128q_client, 0xa2, value); //to set register 0x33 0xa2 + debug_print((KERN_DEBUG "DEBUG : sys_led_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: sys_led_set SYS_LED_A_N FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "SYS LED is set Amber\n")); + } + break; + case SYS_LED_A_B: + value = 0x5; + debug_print((KERN_DEBUG "DEBUG : sys_led_set value = %x\n",value)); + result = i2c_smbus_write_byte_data(ESC_600_128q_client, 0xa2, value); //to set register 0x33 0xa2 + debug_print((KERN_DEBUG "DEBUG : sys_led_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: sys_led_set SYS_LED_A_B FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "SYS LED is set Amber and Blink\n")); + } + break; + case SYS_LED_G_N: + value = 0x2; + debug_print((KERN_DEBUG "DEBUG : sys_led_set value = %x\n",value)); + result = i2c_smbus_write_byte_data(ESC_600_128q_client, 0xa2, value); //to set register 0x33 0xa2 + debug_print((KERN_DEBUG "DEBUG : sys_led_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: sys_led_set SYS_LED_G_N FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "SYS LED is set Green\n")); + } + break; + case SYS_LED_G_B: + value = 0x6; + debug_print((KERN_DEBUG "DEBUG : sys_led_set value = %x\n",value)); + result = i2c_smbus_write_byte_data(ESC_600_128q_client, 0xa2, value); //to set register 0x33 0xa2 + debug_print((KERN_DEBUG "DEBUG : sys_led_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: sys_led_set SYS_LED_G_B FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "SYS LED is set Green and Blink\n")); + } + break; + default: + printk(KERN_ALERT "SYS LED set wrong Value\n"); + } + } + mutex_unlock(&data->update_lock); + debug_print((KERN_DEBUG "DEBUG : sys_led_set unlock\n")); + return count; +} + +/********************************************************************************/ +/* Function Name : switch_led_all_get */ +/* Description : This is the function to get all switch LED status */ +/* 0x33 0xa3 ~ 0xa8 */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : String. */ +/********************************************************************************/ +static ssize_t switch_led_all_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 a_shift = 0x1; + u8 g_shift = 0x2; + u8 b_shift = 0x1; +#ifdef LED_L3_CTRL_WANTED + u8 led_3_status = 0; + u8 led_3_blink = 0; +#endif /*LED_L3_CTRL_WANTED*/ + u8 led_4_status = 0; + u8 led_4_blink = 0; + u8 led_5_status = 0; + u8 led_5_blink = 0; + u8 led_status_reg = 0xa3; + u8 led_blink_reg = 0xa4; + int i; + int j; + int led_status[5][4] = {{0},{0}}; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); +#ifdef LED_L3_CTRL_WANTED + led_3_status = i2c_smbus_read_byte_data(ESC_600_128q_client, 0xa3); //to get register 0x33 0xa3 + led_3_blink = i2c_smbus_read_byte_data(ESC_600_128q_client, 0xa4); +#endif /*LED_L3_CTRL_WANTED*/ + led_4_status = i2c_smbus_read_byte_data(ESC_600_128q_client, 0xa3); + led_4_blink = i2c_smbus_read_byte_data(ESC_600_128q_client, 0xa4); + led_5_status = i2c_smbus_read_byte_data(ESC_600_128q_client, 0xa5); + led_5_blink = i2c_smbus_read_byte_data(ESC_600_128q_client, 0xa6); +#ifdef LED_L3_CTRL_WANTED + debug_print((KERN_DEBUG "DEBUG : switch_led_all_get led_3_status = %x\n", led_3_status)); + debug_print((KERN_DEBUG "DEBUG : switch_led_all_get led_3_blink = %x\n", led_3_blink)); +#endif /*LED_L3_CTRL_WANTED*/ + debug_print((KERN_DEBUG "DEBUG : switch_led_all_get led_4_status = %x\n", led_4_status)); + debug_print((KERN_DEBUG "DEBUG : switch_led_all_get led_4_blink = %x\n", led_4_blink)); + debug_print((KERN_DEBUG "DEBUG : switch_led_all_get led_5_status = %x\n", led_5_status)); + debug_print((KERN_DEBUG "DEBUG : switch_led_all_get led_5_blink = %x\n", led_5_blink)); + sprintf(buf, ""); + if (attr->index == SWITCH_LED) + { +#ifdef LED_L3_CTRL_WANTED + for(i = 3; i<= 5; i++) +#else + for(i = 4; i<= 5; i++) +#endif /*LED_L3_CTRL_WANTED*/ + { + a_shift = 0x1; + g_shift = 0x2; + b_shift = 0x1; + for(j = 1; j<= 4; j++) + { + if (i2c_smbus_read_byte_data(ESC_600_128q_client, led_status_reg) & a_shift) + { + if(i2c_smbus_read_byte_data(ESC_600_128q_client, led_blink_reg) & b_shift) + { + led_status[i][j] = SWITCH_LED_A_B; + sprintf(buf, "%sSwitch LED %d-%d is set to amber and blink\n", buf, i, j); + } + else + { + led_status[i][j] = SWITCH_LED_A_N; + sprintf(buf, "%sSwitch LED %d-%d is set to amber\n", buf, i, j); + } + } + else if (i2c_smbus_read_byte_data(ESC_600_128q_client, led_status_reg) & g_shift) + { + if(i2c_smbus_read_byte_data(ESC_600_128q_client, led_blink_reg) & b_shift) + { + led_status[i][j] = SWITCH_LED_G_B; + sprintf(buf, "%sSwitch LED %d-%d is set to green and blink\n", buf, i, j); + } + else + { + led_status[i][j] = SWITCH_LED_G_N; + sprintf(buf, "%sSwitch LED %d-%d is set to green\n", buf, i, j); + } + } + else + { + led_status[i][j] = SWITCH_LED_OFF; + sprintf(buf, "%sSwitch LED %d-%d is set OFF\n", buf, i, j); + } + a_shift = a_shift<< 2; + g_shift = g_shift<< 2; + b_shift = b_shift<< 1; + } + led_status_reg = led_status_reg + 0x2; + led_blink_reg = led_blink_reg + 0x2; + } + + } + return sprintf(buf, "%s", buf); +} + +/********************************************************************************/ +/* Function Name : switch_led_all_set */ +/* Description : This is the function to set all switch LED status */ +/* 0x33 0xa3 ~ 0xa8 */ +/* Input(s) : 0 ~ 4. */ +/* Output(s) : None. */ +/* Returns : None. */ +/********************************************************************************/ +static ssize_t switch_led_all_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 led_value = -EPERM; + u8 blink_value = -EPERM; +#ifdef LED_L3_CTRL_WANTED + u8 led_3_status = 0; + u8 led_3_blink = 0; +#endif /*LED_L3_CTRL_WANTED*/ + u8 led_4_status = 0; + u8 led_4_blink = 0; + u8 led_5_status = 0; + u8 led_5_blink = 0; + u8 result = 0; + u16 i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *data = i2c_get_clientdata(ESC_600_128q_client); + + mutex_lock(&data->update_lock); + debug_print((KERN_DEBUG "DEBUG : switch_led_all_set lock\n")); +#ifdef LED_L3_CTRL_WANTED + led_3_status = i2c_smbus_read_byte_data(ESC_600_128q_client, 0xa3); //to get register 0x33 0xa3 + led_3_blink = i2c_smbus_read_byte_data(ESC_600_128q_client, 0xa4); +#endif /*LED_L3_CTRL_WANTED*/ + led_4_status = i2c_smbus_read_byte_data(ESC_600_128q_client, 0xa3); + led_4_blink = i2c_smbus_read_byte_data(ESC_600_128q_client, 0xa4); + led_5_status = i2c_smbus_read_byte_data(ESC_600_128q_client, 0xa5); + led_5_blink = i2c_smbus_read_byte_data(ESC_600_128q_client, 0xa6); +#ifdef LED_L3_CTRL_WANTED + debug_print((KERN_DEBUG "DEBUG : switch_led_all_set led_3_status = %x\n", led_3_status)); + debug_print((KERN_DEBUG "DEBUG : switch_led_all_set led_3_blink = %x\n", led_3_blink)); +#endif /*LED_L3_CTRL_WANTED*/ + debug_print((KERN_DEBUG "DEBUG : switch_led_all_set led_4_status = %x\n", led_4_status)); + debug_print((KERN_DEBUG "DEBUG : switch_led_all_set led_4_blink = %x\n", led_4_blink)); + debug_print((KERN_DEBUG "DEBUG : switch_led_all_set led_5_status = %x\n", led_5_status)); + debug_print((KERN_DEBUG "DEBUG : switch_led_all_set led_5_blink = %x\n", led_5_blink)); + if (attr->index == SWITCH_LED) + { + i = simple_strtol(buf, NULL, 10); + switch(i) + { + case SWITCH_LED_OFF: + led_value = 0x0; + blink_value = 0x0; + break; + case SWITCH_LED_A_N: + led_value = 0x55; + blink_value = 0x0; + break; + case SWITCH_LED_A_B: + led_value = 0x55; + blink_value = 0xf; + break; + case SWITCH_LED_G_N: + led_value = 0xaa; + blink_value = 0x0; + break; + case SWITCH_LED_G_B: + led_value = 0xaa; + blink_value = 0xf; + break; + default: + printk(KERN_ALERT "switch_led_all_set set wrong Value\n"); + } + debug_print((KERN_DEBUG "DEBUG : switch_led_all_set led_value = %x\n",led_value)); + debug_print((KERN_DEBUG "DEBUG : switch_led_all_set blink_value = %x\n",blink_value)); +#ifdef LED_L3_CTRL_WANTED + result = i2c_smbus_write_byte_data(ESC_600_128q_client, 0xa3, led_value); +#endif /*LED_L3_CTRL_WANTED*/ + result |= i2c_smbus_write_byte_data(ESC_600_128q_client, 0xa3, led_value); + result |= i2c_smbus_write_byte_data(ESC_600_128q_client, 0xa5, led_value); +#ifdef LED_L3_CTRL_WANTED + result |= i2c_smbus_write_byte_data(ESC_600_128q_client, 0xa4, blink_value); +#endif /*LED_L3_CTRL_WANTED*/ + result |= i2c_smbus_write_byte_data(ESC_600_128q_client, 0xa4, blink_value); + result |= i2c_smbus_write_byte_data(ESC_600_128q_client, 0xa6, blink_value); + if (result < 0) + { + printk(KERN_ALERT "ERROR: switch_led_all_set OFF FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "Switch LED ALL set %d \n", i)); + } + } + mutex_unlock(&data->update_lock); + debug_print((KERN_DEBUG "DEBUG : switch_led_all_set unlock\n")); + return count; +} +#ifdef LED_L3_CTRL_WANTED +/********************************************************************************/ +/* Function Name : switch_led_3_get */ +/* Description : This is the function to get switch LED 3 status */ +/* 0x33 0xa3 0xa4 */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : String. */ +/********************************************************************************/ +static ssize_t switch_led_3_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 res = 0x1; + int i; + int led_a_status = 0; + int led_g_status = 0; + int led_b_status = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + status = i2c_smbus_read_byte_data(ESC_600_128q_client, 0xa3); //to get register 0x33 0xa3 + debug_print((KERN_DEBUG "DEBUG : switch_led_3_get status = %x\n",status)); + sprintf(buf, ""); + for (i = 1; i <= 8; i++) + { + if ( i == attr->index) + { + if (status & res) + { + led_a_status = TURN_ON; + } + else + { + led_a_status = TURN_OFF; + } + } + res = res << 1; + if( i == (attr->index + 1) ) + { + if (status & res) + { + led_g_status = TURN_ON; + } + else + { + led_g_status = TURN_OFF; + } + } + res = res << 1; + } + res = 0x1; + status = i2c_smbus_read_byte_data(ESC_600_128q_client, 0xa4); + debug_print((KERN_DEBUG "DEBUG : switch_led_3_get status = %x\n",status)); + for (i = 1; i <= 4; i++) + { + if ( i == attr->index) + { + if (status & res) + { + led_b_status = TURN_ON; + } + else + { + led_b_status = TURN_OFF; + } + } + res = res << 1; + } + + if(led_a_status == TURN_ON && led_b_status == TURN_ON) + { + sprintf(buf, "%sSwitch LED 3-%d is set to amber and blink\n", buf, attr->index); + } + else if(led_a_status == TURN_ON && led_b_status == TURN_OFF) + { + sprintf(buf, "%sSwitch LED 3-%d is set to amber\n", buf, attr->index); + } + else if(led_g_status == TURN_ON && led_b_status == TURN_ON) + { + sprintf(buf, "%sSwitch LED 3-%d is set to green and blink\n", buf, attr->index); + } + else if(led_g_status == TURN_ON && led_b_status == TURN_OFF) + { + sprintf(buf, "%sSwitch LED 3-%d is set to green\n", buf, attr->index); + } + else + { + sprintf(buf, "%sSwitch LED 3-%d is set OFF\n", buf, attr->index); + } + return sprintf(buf, "%s", buf); +} + +/********************************************************************************/ +/* Function Name : switch_led_3_set */ +/* Description : This is the function to set switch LED 3 status */ +/* 0x33 0xa3 0xa4 */ +/* Input(s) : 0 ~ 4. */ +/* Output(s) : None. */ +/* Returns : None. */ +/********************************************************************************/ +static ssize_t switch_led_3_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 led_value = -EPERM; + u8 blk_value = -EPERM; + u8 result = -EPERM; + u16 i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *data = i2c_get_clientdata(ESC_600_128q_client); + + mutex_lock(&data->update_lock); + debug_print((KERN_DEBUG "DEBUG : switch_led_3_set lock\n")); + led_value = i2c_smbus_read_byte_data(ESC_600_128q_client, 0xa3); //to get register 0x33 0xa3 + debug_print((KERN_DEBUG "DEBUG : switch_led_3_set led_value = %x\n",led_value)); + blk_value = i2c_smbus_read_byte_data(ESC_600_128q_client, 0xa4); + debug_print((KERN_DEBUG "DEBUG : switch_led_3_set blk_value = %x\n",blk_value)); + if (attr->index != 0) + { + i = simple_strtol(buf, NULL, 10); + debug_print((KERN_DEBUG "DEBUG : switch_led_3_set value = %d\n",i)); + switch(i) + { + case SWITCH_LED_OFF: + led_value &= ~(1 << ((attr->index)-1)); + led_value &= ~(1 << (attr->index)); + blk_value &= ~(1 << ((attr->index)-1)); + break; + case SWITCH_LED_A_N: + led_value |= (1 << ((attr->index)-1)); + led_value &= ~(1 << (attr->index)); + blk_value &= ~(1 << ((attr->index)-1)); + break; + case SWITCH_LED_A_B: + led_value |= (1 << ((attr->index)-1)); + led_value &= ~(1 << (attr->index)); + blk_value |= (1 << ((attr->index)-1)); + break; + case SWITCH_LED_G_N: + led_value |= (1 << (attr->index)); + led_value &= ~(1 << ((attr->index)-1)); + blk_value &= ~(1 << ((attr->index)-1)); + break; + case SWITCH_LED_G_B: + led_value |= (1 << (attr->index)); + led_value &= ~(1 << ((attr->index)-1)); + blk_value |= (1 << ((attr->index)-1)); + break; + default: + printk(KERN_ALERT "Switch LED set wrong Value\n"); + } + debug_print((KERN_DEBUG "DEBUG : switch_led_3_set led_value = %x\n",led_value)); + debug_print((KERN_DEBUG "DEBUG : switch_led_3_set blk_value = %x\n",blk_value)); + result = i2c_smbus_write_byte_data(ESC_600_128q_client, 0xa3, led_value); + result |= i2c_smbus_write_byte_data(ESC_600_128q_client, 0xa4, blk_value); + debug_print((KERN_DEBUG "DEBUG : switch_led_3_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: switch_led_3_set SYS_LED_OFF FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "Switch LED is set Success\n")); + } + } + mutex_unlock(&data->update_lock); + debug_print((KERN_DEBUG "DEBUG : switch_led_3_set unlock\n")); + return count; +} +#endif /*LED_L3_CTRL_WANTED*/ + +/********************************************************************************/ +/* Function Name : switch_led_4_get */ +/* Description : This is the function to get switch LED 4 status */ +/* 0x33 0xa5 0xa6 */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : String. */ +/********************************************************************************/ +static ssize_t switch_led_4_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 res = 0x1; + int i; + int led_a_status = 0; + int led_g_status = 0; + int led_b_status = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + status = i2c_smbus_read_byte_data(ESC_600_128q_client, 0xa3); //to get register 0x33 0xa5 + debug_print((KERN_DEBUG "DEBUG : switch_led_4_get status = %x\n",status)); + sprintf(buf, ""); + for (i = 1; i <= 4; i++) + { + if ( i == attr->index) + { + if (status & res) + { + led_a_status = TURN_ON; + } + else + { + led_a_status = TURN_OFF; + } + } + res = res << 1; + if( i == (attr->index + 1) ) + { + if (status & res) + { + led_g_status = TURN_ON; + } + else + { + led_g_status = TURN_OFF; + } + } + res = res << 1; + } + res = 0x1; + + status = i2c_smbus_read_byte_data(ESC_600_128q_client, 0xa4); + debug_print((KERN_DEBUG "DEBUG : switch_led_4_get status = %x\n",status)); + for (i = 1; i <= 4; i++) + { + if ( i == attr->index) + { + if (status & res) + { + led_b_status = TURN_ON; + } + else + { + led_b_status = TURN_OFF; + } + } + res = res << 1; + } + + if(led_a_status == TURN_ON && led_b_status == TURN_ON) + { + sprintf(buf, "%sSwitch LED 4-%d is set to amber and blink\n", buf, attr->index); + } + else if(led_a_status == TURN_ON && led_b_status == TURN_OFF) + { + sprintf(buf, "%sSwitch LED 4-%d is set to amber\n", buf, attr->index); + } + else if(led_g_status == TURN_ON && led_b_status == TURN_ON) + { + sprintf(buf, "%sSwitch LED 4-%d is set to green and blink\n", buf, attr->index); + } + else if(led_g_status == TURN_ON && led_b_status == TURN_OFF) + { + sprintf(buf, "%sSwitch LED 4-%d is set to green\n", buf, attr->index); + } + else + { + sprintf(buf, "%sSwitch LED 4-%d is set OFF\n", buf, attr->index); + } + return sprintf(buf, "%s", buf); +} + +/********************************************************************************/ +/* Function Name : switch_led_4_set */ +/* Description : This is the function to set switch LED 4 status */ +/* 0x33 0xa5 0xa6 */ +/* Input(s) : 0 ~ 4. */ +/* Output(s) : None. */ +/* Returns : None. */ +/********************************************************************************/ +static ssize_t switch_led_4_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 led_value = -EPERM; + u8 blk_value = -EPERM; + u8 result = -EPERM; + u8 offset = 0; + u16 i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *data = i2c_get_clientdata(ESC_600_128q_client); + + mutex_lock(&data->update_lock); + debug_print((KERN_DEBUG "DEBUG : switch_led_4_set lock\n")); + led_value = i2c_smbus_read_byte_data(ESC_600_128q_client, 0xa3); //to get register 0x33 0xa5 + debug_print((KERN_DEBUG "DEBUG : switch_led_4_set led_value = %x\n",led_value)); + blk_value = i2c_smbus_read_byte_data(ESC_600_128q_client, 0xa4); + debug_print((KERN_DEBUG "DEBUG : switch_led_4_set blk_value = %x\n",blk_value)); + if (attr->index != 0) + { + i = simple_strtol(buf, NULL, 10); + debug_print((KERN_DEBUG "DEBUG : switch_led_4_set value = %d\n",i)); + debug_print((KERN_DEBUG "DEBUG : switch_led_4_set led 4-%d\n",attr->index)); + if(attr->index == 1) + { + offset = 0; + } + else + { + offset = 2*((attr->index)-1); + } + switch(i) + { + case SWITCH_LED_OFF: //i=0 + led_value &= ~(0x03 << offset); + blk_value &= ~(1 << ((attr->index)-1)); + break; + case SWITCH_LED_A_N: //i=1 + led_value &= ~(0x03 << offset); + led_value |= (0x01 << offset); + blk_value &= ~(1 << ((attr->index)-1)); + break; + case SWITCH_LED_A_B: //i=2 + led_value &= ~(0x03 << offset); + led_value |= (0x01 << offset); + blk_value |= (1 << ((attr->index)-1)); + break; + case SWITCH_LED_G_N: //i=3 + led_value &= ~(0x03 << offset); + led_value |= (0x02 << offset); + blk_value &= ~(1 << ((attr->index)-1)); + break; + case SWITCH_LED_G_B: //i=4 + led_value &= ~(0x03 << offset); + led_value |= (0x02 << offset); + blk_value |= (1 << ((attr->index)-1)); + break; + default: + printk(KERN_ALERT "Switch LED set wrong Value\n"); + } + debug_print((KERN_DEBUG "DEBUG : switch_led_4_set led_value = %x\n",led_value)); + debug_print((KERN_DEBUG "DEBUG : switch_led_4_set blk_value = %x\n",blk_value)); + result = i2c_smbus_write_byte_data(ESC_600_128q_client, 0xa3, led_value); + result |= i2c_smbus_write_byte_data(ESC_600_128q_client, 0xa4, blk_value); + debug_print((KERN_DEBUG "DEBUG : switch_led_4_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: switch_led_4_set SYS_LED_OFF FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "Switch LED is set Success\n")); + } + } + mutex_unlock(&data->update_lock); + debug_print((KERN_DEBUG "DEBUG : switch_led_4_set unlock\n")); + return count; +} + +/********************************************************************************/ +/* Function Name : switch_led_5_get */ +/* Description : This is the function to get switch LED 5 status */ +/* 0x33 0xa7 0xa8 */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : String. */ +/********************************************************************************/ +static ssize_t switch_led_5_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 res = 0x1; + int i; + int led_a_status = 0; + int led_g_status = 0; + int led_b_status = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + status = i2c_smbus_read_byte_data(ESC_600_128q_client, 0xa5); //to get register 0x33 0xa5 + debug_print((KERN_DEBUG "DEBUG : switch_led_5_get status = %x\n",status)); + sprintf(buf, ""); + for (i = 1; i <= 8; i++) + { + if ( i == attr->index) + { + if (status & res) + { + led_a_status = TURN_ON; + } + else + { + led_a_status = TURN_OFF; + } + } + res = res << 1; + if( i == (attr->index + 1) ) + { + if (status & res) + { + led_g_status = TURN_ON; + } + else + { + led_g_status = TURN_OFF; + } + } + res = res << 1; + } + res = 0x1; + + status = i2c_smbus_read_byte_data(ESC_600_128q_client, 0xa6); + debug_print((KERN_DEBUG "DEBUG : switch_led_5_get status = %x\n",status)); + for (i = 1; i <= 4; i++) + { + if ( i == attr->index) + { + if (status & res) + { + led_b_status = TURN_ON; + } + else + { + led_b_status = TURN_OFF; + } + } + res = res << 1; + } + + if(led_a_status == TURN_ON && led_b_status == TURN_ON) + { + sprintf(buf, "%sSwitch LED 5-%d is set to amber and blink\n", buf, attr->index); + } + else if(led_a_status == TURN_ON && led_b_status == TURN_OFF) + { + sprintf(buf, "%sSwitch LED 5-%d is set to amber\n", buf, attr->index); + } + else if(led_g_status == TURN_ON && led_b_status == TURN_ON) + { + sprintf(buf, "%sSwitch LED 5-%d is set to green and blink\n", buf, attr->index); + } + else if(led_g_status == TURN_ON && led_b_status == TURN_OFF) + { + sprintf(buf, "%sSwitch LED 5-%d is set to green\n", buf, attr->index); + } + else + { + sprintf(buf, "%sSwitch LED 5-%d is set OFF\n", buf, attr->index); + } + return sprintf(buf, "%s", buf); +} + +/********************************************************************************/ +/* Function Name : switch_led_5_set */ +/* Description : This is the function to set switch LED 5 status */ +/* 0x33 0xa7 0xa8 */ +/* Input(s) : 0 ~ 4. */ +/* Output(s) : None. */ +/* Returns : None. */ +/********************************************************************************/ +static ssize_t switch_led_5_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 led_value = -EPERM; + u8 blk_value = -EPERM; + u8 result = -EPERM; + u8 offset = 0; + u16 i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *data = i2c_get_clientdata(ESC_600_128q_client); + + mutex_lock(&data->update_lock); + debug_print((KERN_DEBUG "DEBUG : switch_led_5_set lock\n")); + led_value = i2c_smbus_read_byte_data(ESC_600_128q_client, 0xa5); //to get register 0x33 0xa5 + debug_print((KERN_DEBUG "DEBUG : switch_led_5_set led_value = %x\n",led_value)); + blk_value = i2c_smbus_read_byte_data(ESC_600_128q_client, 0xa6); + debug_print((KERN_DEBUG "DEBUG : switch_led_5_set blk_value = %x\n",blk_value)); + if (attr->index != 0) + { + i = simple_strtol(buf, NULL, 10); + debug_print((KERN_DEBUG "DEBUG : switch_led_5_set value = %d\n",i)); + debug_print((KERN_DEBUG "DEBUG : switch_led_5_set led 5-%d\n",attr->index)); + if(attr->index == 1) + { + offset = 0; + } + else + { + offset = 2*((attr->index)-1); + } + switch(i) + { + case SWITCH_LED_OFF: //i=0 + led_value &= ~(0x03 << offset); + blk_value &= ~(1 << ((attr->index)-1)); + break; + case SWITCH_LED_A_N: //i=1 + led_value &= ~(0x03 << offset); + led_value |= (0x01 << offset); + blk_value &= ~(1 << ((attr->index)-1)); + break; + case SWITCH_LED_A_B: //i=2 + led_value &= ~(0x03 << offset); + led_value |= (0x01 << offset); + blk_value |= (1 << ((attr->index)-1)); + break; + case SWITCH_LED_G_N: //i=3 + led_value &= ~(0x03 << offset); + led_value |= (0x02 << offset); + blk_value &= ~(1 << ((attr->index)-1)); + break; + case SWITCH_LED_G_B: //i=4 + led_value &= ~(0x03 << offset); + led_value |= (0x02 << offset); + blk_value |= (1 << ((attr->index)-1)); + break; + default: + printk(KERN_ALERT "Switch LED set wrong Value\n"); + } + debug_print((KERN_DEBUG "DEBUG : switch_led_5_set led_value = %x\n",led_value)); + debug_print((KERN_DEBUG "DEBUG : switch_led_5_set blk_value = %x\n",blk_value)); + result = i2c_smbus_write_byte_data(ESC_600_128q_client, 0xa5, led_value); + result |= i2c_smbus_write_byte_data(ESC_600_128q_client, 0xa6, blk_value); + debug_print((KERN_DEBUG "DEBUG : switch_led_5_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: switch_led_5_set SYS_LED_OFF FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "Switch LED is set Success\n")); + } + } + mutex_unlock(&data->update_lock); + debug_print((KERN_DEBUG "DEBUG : switch_led_5_set unlock\n")); + return count; +} + +/********************************************************************************/ +/* Function Name : sfp_int_get */ +/* Description : This is the function to get sfp interrupt status */ +/* 0x33 0xd0 */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : String. */ +/********************************************************************************/ +static ssize_t sfp_int_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + if (attr->index == SFP_INT) + { + status = i2c_smbus_read_byte_data(ESC_600_128q_client, 0xd0); //to set register 0x33 0xd0 + debug_print((KERN_DEBUG "DEBUG : sfp_int_get status = %x\n",status)); + sprintf(buf, ""); + if (status & 0x2) + { + sprintf(buf, "%sInterrupt is triggered by SFP Loss\n", buf); + } + else if (status & 0x4) + { + sprintf(buf, "%sInterrupt is triggered by SFP ABS\n", buf); + } + else + { + sprintf(buf, "%sNo interrupt is triggered\n", buf); + } + } + return sprintf(buf, "%s", buf); +} + +/********************************************************************************/ +/* Function Name : psu_int_get */ +/* Description : This is the function to get psu interrupt status */ +/* 0x33 0xd0 */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : String. */ +/********************************************************************************/ +static ssize_t psu_int_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + if (attr->index == PSU_INT) + { + status = i2c_smbus_read_byte_data(ESC_600_128q_client, 0xd0); //to set register 0x33 0xd0 + debug_print((KERN_DEBUG "DEBUG : psu_int_get status = %x\n",status)); + sprintf(buf, ""); + if (status & 0x1) + { + sprintf(buf, "%sInterrupt is triggered by PSU\n", buf); + } + else + { + sprintf(buf, "%sNo interrupt is triggered\n", buf); + } + } + return sprintf(buf, "%s", buf); +} +/********************************************************************************/ +/* Function Name : int_mask_get */ +/* Description : This is the function to get interrupt status */ +/* 0x33 0xd1 */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : String. */ +/********************************************************************************/ +static ssize_t int_mask_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + status = i2c_smbus_read_byte_data(ESC_600_128q_client, 0xd1); //to get register 0x33 0xd1 + debug_print((KERN_DEBUG "DEBUG : int_mask_get status = %x\n",status)); + sprintf(buf, ""); + if (attr->index == 1) + { + + if (status & 0x1) + { + sprintf(buf, "%sPSU interrupt mask is enabled\n", buf); + } + else + { + sprintf(buf, "%sPSU interrupt mask is disabled\n", buf); + } + } + if (attr->index == 2) + { + + if (status & 0x2) + { + sprintf(buf, "%sSFP Loss interrupt mask is enabled\n", buf); + } + else + { + sprintf(buf, "%sSFP Loss interrupt mask is disabled\n", buf); + } + } + if (attr->index == 3) + { + + if (status & 0x4) + { + sprintf(buf, "%sSFP ABS interrupt mask is enabled\n", buf); + } + else + { + sprintf(buf, "%sSFP ABS interrupt mask is disabled\n", buf); + } + } + return sprintf(buf, "%s", buf); +} + +/********************************************************************************/ +/* Function Name : int_mask_set */ +/* Description : This is the function to set interrupt status */ +/* 0x33 0xa3 0xa4 */ +/* Input(s) : 1 or 0. */ +/* Output(s) : None. */ +/* Returns : None. */ +/********************************************************************************/ +static ssize_t int_mask_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 status = -EPERM; + u8 result = 0; + int i = 0; + int j = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *data = i2c_get_clientdata(ESC_600_128q_client); + + i = attr->index; + j = simple_strtol(buf, NULL, 10); + debug_print((KERN_DEBUG "DEBUG : int_mask_set i: %d\n", i)); + debug_print((KERN_DEBUG "DEBUG : int_mask_set j: %d\n", j)); + mutex_lock(&data->update_lock); + debug_print((KERN_DEBUG "DEBUG : int_mask_set lock\n")); + + status = i2c_smbus_read_byte_data(ESC_600_128q_client, 0xd1); //to get register 0x33 0xd1 + debug_print((KERN_DEBUG "DEBUG : int_mask_set status = %x\n",status)); + if( j == TURN_ON) + { + status |= (1 << (i-1)); + debug_print((KERN_DEBUG "DEBUG : int_mask_set value = %x\n",status)); + result = i2c_smbus_write_byte_data(ESC_600_128q_client, 0xd1, status); //to set register 0x33 0xd1 + debug_print((KERN_DEBUG "DEBUG : int_mask_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: int_mask_set set ON FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "int_mask_set ON\n")); + } + } + else if( j == TURN_OFF) + { + status &= ~(1 << (i-1)); + debug_print((KERN_DEBUG "DEBUG : int_mask_set value = %x\n",status)); + result = i2c_smbus_write_byte_data(ESC_600_128q_client, 0xd1, status); //to set register 0x33 0xd1 + debug_print((KERN_DEBUG "DEBUG : int_mask_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: int_mask_set set OFF FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "int_mask_set OFF\n")); + } + } + else + { + printk(KERN_ALERT " int_mask_set set wrong value\n"); + } + mutex_unlock(&data->update_lock); + debug_print((KERN_DEBUG "DEBUG : int_mask_set unlock\n")); + return count; +} +#ifdef ESC_600_BMC_WANTED +static ssize_t bmc_module_detect(struct device *dev, struct device_attribute *da, char *buf) +{ + u32 status = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + sprintf(buf, ""); + if(attr->index == BMC_DETECT) + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0xa3); + debug_print((KERN_DEBUG "DEBUG : BMC byte status = 0x%x\n", status)); + } + if(status == 0x1) + { + sprintf(buf, "%sBMC module is present\n", buf); + } + else + { + sprintf(buf, "%sBMC module is not present\n", buf); + } + return sprintf(buf, "%s", buf); +} +static ssize_t themal_temp_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 bmc_present = -EPERM; + u8 status = -EPERM; + u8 mask = 0x1; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + sprintf(buf, ""); + if (attr->index == SENSOR_TEMP) + { + bmc_present = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0xa3); //to get 0x31 0xa3 + if (bmc_present & mask) + { + //to get 0x14 0x08 NCT7511 Temp + status = i2c_smbus_read_byte_data(Cameo_BMC_client, 0x08); + if(status == 0xff) + { + sprintf(buf, "%sSensor (NCT7511) READ FAILED\n", buf); + } + else + { + sprintf(buf, "%sSensor (NCT7511) is %d degrees (C)\n", buf, status); + } + //to get 0x14 0x09 Left-Bottom:SB + status = i2c_smbus_read_byte_data(Cameo_BMC_client, 0x09); + if(status == 0xff) + { + sprintf(buf, "%sSensor (Left-Bottom:SB) READ FAILED\n", buf); + } + else + { + sprintf(buf, "%sSensor (Left-Bottom:SB) is %d degrees (C)\n", buf, status); + } + //to get 0x14 0x10 Center-Top:SB + status = i2c_smbus_read_byte_data(Cameo_BMC_client, 0x10); + if(status == 0xff) + { + sprintf(buf, "%sSensor (Center-Top:SB) READ FAILED\n", buf); + } + else + { + sprintf(buf, "%sSensor (Center-Top:SB) is %d degrees (C)\n", buf, status); + } + //to get 0x14 0x11 Center:SB + status = i2c_smbus_read_byte_data(Cameo_BMC_client, 0x11); + if(status == 0xff) + { + sprintf(buf, "%sSensor (Center:SB) READ FAILED\n", buf); + } + else + { + sprintf(buf, "%sSensor (Center:SB) is %d degrees (C)\n", buf, status); + } + //to get 0x14 0x13 Left-Top:CB + status = i2c_smbus_read_byte_data(Cameo_BMC_client, 0x13); + if(status == 0xff) + { + sprintf(buf, "%sSensor (Left-Top:CB) READ FAILED\n", buf); + } + else + { + sprintf(buf, "%sSensor (Left-Top:CB) is %d degrees (C)\n", buf, status); + } + //to get 0x14 0x14 Center:CB + status = i2c_smbus_read_byte_data(Cameo_BMC_client, 0x14); + if(status == 0xff) + { + sprintf(buf, "%sSensor (Center:CB) READ FAILED\n", buf); + } + else + { + sprintf(buf, "%sSensor (Center:CB) is %d degrees (C)\n", buf, status); + } + //to get 0x14 0x15 Right-Bottom:CB + status = i2c_smbus_read_byte_data(Cameo_BMC_client, 0x15); + if(status == 0xff) + { + sprintf(buf, "%sSensor (Right-Bottom:CB) READ FAILED\n", buf); + } + else + { + sprintf(buf, "%sSensor (Right-Bottom:CB) is %d degrees (C)\n", buf, status); + } + //to get 0x14 0x16 Left-Bottom:CB + status = i2c_smbus_read_byte_data(Cameo_BMC_client, 0x16); + if(status == 0xff) + { + sprintf(buf, "%sSensor (Left-Bottom:CB) READ FAILED\n", buf); + } + else + { + sprintf(buf, "%sSensor (Left-Bottom:CB) is %d degrees (C)\n", buf, status); + } + //to get 0x14 0x17 I/O Board + status = i2c_smbus_read_byte_data(Cameo_BMC_client, 0x17); + if(status == 0xff) + { + sprintf(buf, "%sSensor (I/O Board) READ FAILED\n", buf); + } + else + { + sprintf(buf, "%sSensor (I/O Board) is %d degrees (C)\n", buf, status); + } + } + else + { + sprintf(buf, "%sBMC Module is not present\n", buf); + } + } + return sprintf(buf, "%s", buf); +} +static ssize_t module_temp_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 bmc_present = -EPERM; + u8 up_reg [9] = {0x00, 0x20, 0x22, 0x24, 0x26, 0x28, 0x2a, 0x2c, 0x2e}; + u8 down_reg [9] = {0x00, 0x21, 0x23, 0x25, 0x27, 0x29, 0x2b, 0x2d, 0x2f}; + u8 status = -EPERM; + u8 mask = 0x1; + u8 i = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + sprintf(buf, ""); + + if(attr->index == MODULE_TEMP) + { + bmc_present = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0xa3); //to get 0x31 0xa3 + if (bmc_present & mask) + { + for(i = 1; i <= 8; i ++) + { + //to get Line Card up Temp + status = i2c_smbus_read_byte_data(Cameo_BMC_client, up_reg[i]); + if(status == 0xff) + { + sprintf(buf, "%sLine Card %d up READ FAILED\n", buf, i); + } + else + { + sprintf(buf, "%sLine Card %d up is %d degrees (C)\n", buf, i, status); + } + //to get Line Card down Temp + status = i2c_smbus_read_byte_data(Cameo_BMC_client, down_reg[i]); + if(status == 0xff) + { + sprintf(buf, "%sLine Card %d down READ FAILED\n", buf, i); + } + else + { + sprintf(buf, "%sLine Card %d down is %d degrees (C)\n", buf, i, status); + } + } + } + else + { + sprintf(buf, "%sBMC Module is not present\n", buf); + } + } + return sprintf(buf, "%s", buf); +} +static ssize_t mac_temp_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 bmc_present = -EPERM; + u16 status = -EPERM; + u8 mask = 0x1; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + sprintf(buf, ""); + if (attr->index == MAC_TEMP) + { + bmc_present = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0xa3); //to get 0x31 0xa3 + if (bmc_present & mask) + { + //to get MAC Temp 0x14 0x12 + status = i2c_smbus_read_word_data(Cameo_BMC_client, 0x12); + if(status == 0xffff) + { + sprintf(buf, "%sSensor (MAC MCP3425) READ FAILED\n", buf); + } + else + { + sprintf(buf, "%sSensor (MAC MCP3425) is 0x%x\n", buf, status); + } + } + else + { + sprintf(buf, "%sBMC Module is not present\n", buf); + } + } + return sprintf(buf, "%s", buf); +} + +static int two_complement_to_int(u16 data, u8 valid_bit, int mask) +{ + u16 valid_data = data & mask; + bool is_negative = valid_data >> (valid_bit - 1); + + return is_negative ? (-(((~valid_data) & mask) + 1)) : valid_data; +} + +static ssize_t psu_module_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 bmc_present = -EPERM; + u8 module_num = 0; + u8 psu_table [5][11] = + { + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + {0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xd8}, + {0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xd9}, + {0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xda}, + {0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xdb}, + }; + u32 psu_status [11] = {0}; + u8 mask = 0x1; + u8 i = 0; + u16 u16_val = 0; + int exponent = 0, mantissa = 0; + int multiplier = 1000; // lm-sensor uint: mV, mA, mC + + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + sprintf(buf, ""); + + bmc_present = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0xa3); //to get 0x31 0xa3 + if (bmc_present & mask) + { + switch(attr->index) + { + case PSU_MODULE_1: + module_num = 1; + break; + case PSU_MODULE_2: + module_num = 2; + break; + case PSU_MODULE_3: + module_num = 3; + break; + case PSU_MODULE_4: + module_num = 4; + break; + } + + for(i = 0; i < 10; i ++) + { + u16_val = i2c_smbus_read_word_data(Cameo_BMC_client, psu_table[module_num][i]); + /* word data with linear format */ + if (i != 2 && i != 8) { + multiplier = 1000; + if (i == 6 || i == 7) /* pin, pout */ + multiplier = 1000000; // lm-sensor unit: uW + if ( i == 5 ) /* fan_speed */ + multiplier = 1; + + exponent = two_complement_to_int(u16_val >> 11, 5, 0x1f); + mantissa = two_complement_to_int(u16_val & 0x7ff, 11, 0x7ff); + psu_status[i] = (exponent >= 0) ? ((mantissa << exponent)*multiplier) : \ + (mantissa*multiplier / (1 << -exponent)); + } + } + /* vout mode */ + multiplier = 1000; + u16_val = i2c_smbus_read_byte_data(Cameo_BMC_client, psu_table[module_num][10]); + psu_status[10] = u16_val; + exponent = two_complement_to_int(u16_val & 0x1f, 5, 0x1f); + /* vout */ + u16_val = i2c_smbus_read_word_data(Cameo_BMC_client, psu_table[module_num][2]); + psu_status[2] = (exponent >= 0) ? ((u16_val << exponent)*multiplier) : \ + (u16_val*multiplier / (1 << -exponent)); + + sprintf(buf, "%sPSU %d VIN is %d\n", buf, module_num, psu_status[0]); + sprintf(buf, "%sPSU %d IIN is %d\n", buf, module_num, psu_status[1]); + sprintf(buf, "%sPSU %d VOUT is %d\n", buf, module_num, psu_status[2]); + sprintf(buf, "%sPSU %d IOUT is %d\n", buf, module_num, psu_status[3]); + sprintf(buf, "%sPSU %d TEMP_1 is %d\n", buf, module_num, psu_status[4]); + sprintf(buf, "%sPSU %d FAN_SPEED is %d\n", buf, module_num, psu_status[5]); + sprintf(buf, "%sPSU %d POUT is %d\n", buf, module_num, psu_status[6]); + sprintf(buf, "%sPSU %d PIN is %d\n", buf, module_num, psu_status[7]); + sprintf(buf, "%sPSU %d MFR_MODEL is %d\n", buf, module_num, psu_status[8]); + sprintf(buf, "%sPSU %d MFR_IOUT_MAX is %d\n", buf, module_num, psu_status[9]); + sprintf(buf, "%sPSU %d VMODE is %d\n", buf, module_num, psu_status[10]); + } + else + { + sprintf(buf, "%sBMC Module is not present\n", buf); + } + return sprintf(buf, "%s", buf); +} +static ssize_t dc_chip_switch_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 bmc_present = -EPERM; + u8 dc_table [8] = {0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f}; + u16 dc_status [8] = {0}; + u8 mask = 0x1; + u8 i = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + sprintf(buf, ""); + if (attr->index == DC_CHIP_SWITCH) + { + bmc_present = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0xa3); //to get 0x31 0xa3 + if (bmc_present & mask) + { + for(i = 0; i < 8; i ++) + { + dc_status[i] = i2c_smbus_read_word_data(Cameo_BMC_client, dc_table[i]); + } + sprintf(buf, "%sTPS40425 0x6e 0x88 is 0x%x\n", buf, dc_status[0]); + sprintf(buf, "%sTPS40425 0x6e 0x8c is 0x%x\n", buf, dc_status[1]); + sprintf(buf, "%sTPS40425 0x6e 0x96 is 0x%x\n", buf, dc_status[2]); + sprintf(buf, "%sTPS40425 0x70 0x88 is 0x%x\n", buf, dc_status[3]); + sprintf(buf, "%sTPS40425 0x70 0x8c is 0x%x\n", buf, dc_status[4]); + sprintf(buf, "%sTPS40425 0x70 0x96 is 0x%x\n", buf, dc_status[5]); + /*0x04 TBD*/ + sprintf(buf, "%sISP1014A 0x04 0x00 is 0x%x\n", buf, dc_status[6]); + sprintf(buf, "%sISP1014A 0x04 0x00 is 0x%x\n", buf, dc_status[7]); + } + else + { + sprintf(buf, "%sBMC Module is not present\n", buf); + } + } + return sprintf(buf, "%s", buf); +} +static ssize_t dc_chip_slot_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 bmc_present = -EPERM; + u8 module_num = 0; + u8 dc_table [9][10] = + { + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + {0x30, 0x31, 0x33, 0x34, 0x36, 0x37, 0x38, 0x39, 0x3b, 0x3c}, + {0x40, 0x41, 0x43, 0x44, 0x46, 0x47, 0x48, 0x49, 0x4b, 0x4c}, + {0x50, 0x51, 0x53, 0x54, 0x56, 0x57, 0x58, 0x59, 0x5b, 0x5c}, + {0x60, 0x61, 0x63, 0x64, 0x66, 0x67, 0x68, 0x69, 0x6b, 0x6c}, + {0x70, 0x71, 0x73, 0x74, 0x76, 0x77, 0x78, 0x79, 0x7b, 0x7c}, + {0x80, 0x81, 0x83, 0x84, 0x86, 0x87, 0x88, 0x89, 0x8b, 0x8c}, + {0x90, 0x91, 0x93, 0x94, 0x96, 0x97, 0x98, 0x99, 0x9b, 0x9c}, + {0xa0, 0xa1, 0xa3, 0xa4, 0xa6, 0xa7, 0xa8, 0xa9, 0xab, 0xac}, + }; + u16 dc_status [10] = {0}; + u8 mask = 0x1; + u8 i = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + sprintf(buf, ""); + bmc_present = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0xa3); //to get 0x31 0xa3 + if (bmc_present & mask) + { + switch(attr->index) + { + case DC_CHIP_SLOT_1: + module_num = 1; + break; + case DC_CHIP_SLOT_2: + module_num = 2; + break; + case DC_CHIP_SLOT_3: + module_num = 3; + break; + case DC_CHIP_SLOT_4: + module_num = 4; + break; + case DC_CHIP_SLOT_5: + module_num = 5; + break; + case DC_CHIP_SLOT_6: + module_num = 6; + break; + case DC_CHIP_SLOT_7: + module_num = 7; + break; + case DC_CHIP_SLOT_8: + module_num = 8; + break; + } + for(i = 0; i < 10; i ++) + { + dc_status[i] = i2c_smbus_read_word_data(Cameo_BMC_client, dc_table[module_num][i]); + } + sprintf(buf, "%sLine Card %d Chip 1 P0_VOUT is 0x%x\n", buf, module_num, dc_status[0]); + sprintf(buf, "%sLine Card %d Chip 1 P0_IOUT is 0x%x\n", buf, module_num, dc_status[1]); + sprintf(buf, "%sLine Card %d Chip 1 P1_VOUT is 0x%x\n", buf, module_num, dc_status[2]); + sprintf(buf, "%sLine Card %d Chip 1 P1_IOUT is 0x%x\n", buf, module_num, dc_status[3]); + sprintf(buf, "%sLine Card %d Chip 2 P0_VOUT is 0x%x\n", buf, module_num, dc_status[4]); + sprintf(buf, "%sLine Card %d Chip 2 P0_IOUT is 0x%x\n", buf, module_num, dc_status[5]); + sprintf(buf, "%sLine Card %d Chip 3 P0_VOUT is 0x%x\n", buf, module_num, dc_status[6]); + sprintf(buf, "%sLine Card %d Chip 3 P0_IOUT is 0x%x\n", buf, module_num, dc_status[7]); + sprintf(buf, "%sLine Card %d Chip 3 P1_VOUT is 0x%x\n", buf, module_num, dc_status[8]); + sprintf(buf, "%sLine Card %d Chip 3 P1_IOUT is 0x%x\n", buf, module_num, dc_status[9]); + } + else + { + sprintf(buf, "%sBMC Module is not present\n", buf); + } + return sprintf(buf, "%s", buf); +} +#endif /*ESC_600_BMC_WANTED*/ +/********************************************************************************/ +/* Function Name : jtag_select_get */ +/* Description : This is the function to get JTAG Reg 0x31 0xa1 0xa2 */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : String. */ +/********************************************************************************/ +static ssize_t jtag_select_get(struct device *dev, struct device_attribute *da, char *buf) +{ + sprintf(buf, ""); + /*TBD*/ + return sprintf(buf, "%s", buf); +} + +/********************************************************************************/ +/* Function Name : jtag_select_set */ +/* Description : This is the function to set JTAG Reg 0x31 0xa1 0xa2 */ +/* Input(s) : Jtag number. */ +/* Output(s) : None. */ +/* Returns : None. */ +/********************************************************************************/ +static ssize_t jtag_select_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + /*TBD*/ + return count; +} + +static ssize_t cpld_version_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + sprintf(buf, ""); + if(attr->index == CPLD_VER) + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_2_client, 0x20); + sprintf(buf, "%s0x30 CPLD version is 0x%x\n", buf, status); + status = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0x20); + sprintf(buf, "%s0x31 CPLD version is 0x%x\n", buf, status); + status = i2c_smbus_read_byte_data(ESC_600_128q_client, 0x20); + sprintf(buf, "%s0x33 CPLD version is 0x%x\n", buf, status); + } + return sprintf(buf, "%s", buf); +} + +#ifdef EEPROM_WP_WANTED +static ssize_t eeprom_wp_status_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 res = 0x10; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + if (attr->index == EEPROM_WP_CTRL) + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0xa0); //to get register 0x30 0xa0 + debug_print((KERN_DEBUG "DEBUG : eeprom_wp status = %x\n",status)); + sprintf(buf, ""); + if (status & res) + { + sprintf(buf, "%sEEPROM is Protected\n", buf); + } + else + { + sprintf(buf, "%sEEPROM is Not Protected\n", buf); + } + } + return sprintf(buf, "%s", buf); +} +static ssize_t eeprom_wp_status_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 status = -EPERM; + u8 value = -EPERM; + u8 result = -EPERM; + u16 i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *CPLD_3_data = i2c_get_clientdata(Cameo_CPLD_3_client); + + mutex_lock(&CPLD_3_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : eeprom_wp_status_set lock\n")); + status = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0xa0); //to get register 0x31 0xa0 + debug_print((KERN_DEBUG "DEBUG : eeprom_wp_status_set status = %x\n",status)); + if (attr->index == EEPROM_WP_CTRL) + { + i = simple_strtol(buf, NULL, 10); //get input ON or OFF + if (i == TURN_ON) + { + value = status | 0x10; + debug_print((KERN_DEBUG "DEBUG : eeprom_wp_status_set value = %x\n",value)); + result = i2c_smbus_write_byte_data(Cameo_CPLD_3_client, 0xa0, value); //to set register 0x31 0xa0 + debug_print((KERN_DEBUG "DEBUG : eeprom_wp_status_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: usb_ctrl_set ON FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "EEPROM is Protected\n")); + } + } + else if (i == TURN_OFF) + { + value = status & 0xef; + debug_print((KERN_DEBUG "DEBUG : eeprom_wp_status_set value = %x\n",value)); + result = i2c_smbus_write_byte_data(Cameo_CPLD_3_client, 0xa0, value); //to set register 0x31 0xa0 + debug_print((KERN_DEBUG "DEBUG : eeprom_wp_status_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: eeprom_wp_status_set OFF FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "EEPROM is Not Protected\n")); + } + } + else + { + printk(KERN_ALERT "EEPROM set wrong Value\n"); + } + } + mutex_unlock(&CPLD_3_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : usb_power_set unlock\n")); + return count; +} +#endif /*EEPROM_WP_WANTED*/ +/* end of function */ +/********************************************************************************/ +/* Function Name : Cameo_i2c_probe */ +/* Description : To probe i2c device */ +/* */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : None. */ +/********************************************************************************/ +static int Cameo_i2c_probe(struct i2c_client *client, const struct i2c_device_id *dev_id) +{ + struct Cameo_i2c_data *data; + struct Cameo_i2c_data *CPLD_2_data; + struct Cameo_i2c_data *CPLD_3_data; + struct Cameo_i2c_data *CPLD_4_data; + struct Cameo_i2c_data *Cameo_Extpand_1_data; + struct Cameo_i2c_data *Cameo_Extpand_2_data; + struct Cameo_i2c_data *Cameo_BMC_data; + + int status; + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA)) + { + status = -EIO; + goto exit; + } + data = kzalloc(sizeof(struct Cameo_i2c_data), GFP_KERNEL); + if (!data) + { + printk(KERN_ALERT "data kzalloc fail\n"); + status = -ENOMEM; + goto exit; + } + CPLD_2_data = kzalloc(sizeof(struct Cameo_i2c_data), GFP_KERNEL); + if (!CPLD_2_data) + { + printk(KERN_ALERT "CPLD_2_data kzalloc fail\n"); + status = -ENOMEM; + goto exit; + } + CPLD_3_data = kzalloc(sizeof(struct Cameo_i2c_data), GFP_KERNEL); + if (!CPLD_3_data) + { + printk(KERN_ALERT "CPLD_3_data kzalloc fail\n"); + status = -ENOMEM; + goto exit; + } + CPLD_4_data = kzalloc(sizeof(struct Cameo_i2c_data), GFP_KERNEL); + if (!CPLD_4_data) + { + printk(KERN_ALERT "CPLD_4_data kzalloc fail\n"); + status = -ENOMEM; + goto exit; + } + Cameo_Extpand_1_data = kzalloc(sizeof(struct Cameo_i2c_data), GFP_KERNEL); + if (!Cameo_Extpand_1_data) + { + printk(KERN_ALERT "Cameo_Extpand_1_data kzalloc fail\n"); + status = -ENOMEM; + goto exit; + } + Cameo_Extpand_2_data = kzalloc(sizeof(struct Cameo_i2c_data), GFP_KERNEL); + if (!Cameo_Extpand_2_data) + { + printk(KERN_ALERT "Cameo_Extpand_2_data kzalloc fail\n"); + status = -ENOMEM; + goto exit; + } + Cameo_BMC_data = kzalloc(sizeof(struct Cameo_i2c_data), GFP_KERNEL); + if (!Cameo_BMC_data) + { + printk(KERN_ALERT "Cameo_BMC_data kzalloc fail\n"); + status = -ENOMEM; + goto exit; + } + i2c_set_clientdata(client , data); + i2c_set_clientdata(Cameo_CPLD_2_client , CPLD_2_data); + i2c_set_clientdata(Cameo_CPLD_3_client , CPLD_3_data); + i2c_set_clientdata(Cameo_CPLD_4_client , CPLD_4_data); + i2c_set_clientdata(Cameo_Extpand_1_client , Cameo_Extpand_1_data); + i2c_set_clientdata(Cameo_Extpand_2_client , Cameo_Extpand_2_data); + i2c_set_clientdata(Cameo_BMC_client , Cameo_BMC_data); + mutex_init(&CPLD_2_data ->update_lock); + mutex_init(&CPLD_3_data ->update_lock); + mutex_init(&CPLD_4_data ->update_lock); + mutex_init(&Cameo_Extpand_1_data ->update_lock); + mutex_init(&Cameo_Extpand_2_data ->update_lock); + mutex_init(&Cameo_BMC_data ->update_lock); + data->valid = 0; + mutex_init(&data->update_lock); + dev_info(&client->dev, "chip found\n"); + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &ESC600_SYS_group); + if (status) + { + goto exit_free; + } + status = sysfs_create_group(&client->dev.kobj, &ESC600_PSU_group); + if (status) + { + goto exit_free; + } +#ifdef ESC_600_JTAG_WANTED + status = sysfs_create_group(&client->dev.kobj, &ESC600_JTAG_group); + if (status) + { + goto exit_free; + } +#endif + status = sysfs_create_group(&client->dev.kobj, &ESC600_SFP_group); + if (status) + { + goto exit_free; + } +#ifdef ESC_600_MASK_WANTED + status = sysfs_create_group(&client->dev.kobj, &ESC600_MASK_group); + if (status) + { + goto exit_free; + } +#endif + status = sysfs_create_group(&client->dev.kobj, &ESC600_FAN_group); + if (status) + { + goto exit_free; + } + status = sysfs_create_group(&client->dev.kobj, &ESC600_USB_group); + if (status) + { + goto exit_free; + } + status = sysfs_create_group(&client->dev.kobj, &ESC600_LED_group); + if (status) + { + goto exit_free; + } + status = sysfs_create_group(&client->dev.kobj, &ESC600_Reset_group); + if (status) + { + goto exit_free; + } + status = sysfs_create_group(&client->dev.kobj, &ESC600_Sensor_group); + if (status) + { + goto exit_free; + } +#ifdef ESC_600_INT_WANTED + status = sysfs_create_group(&client->dev.kobj, &ESC600_INT_group); + if (status) + { + goto exit_free; + } +#endif + status = sysfs_create_group(&client->dev.kobj, &ESC600_Module_group); + if (status) + { + goto exit_free; + } + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) + { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + dev_info(&client->dev, "%s: '%s'\n", dev_name(data->hwmon_dev), client->name); + return 0; +exit_remove: + sysfs_remove_group(&client->dev.kobj, &ESC600_SYS_group); + sysfs_remove_group(&client->dev.kobj, &ESC600_PSU_group); +#ifdef ESC_600_JTAG_WANTED + sysfs_remove_group(&client->dev.kobj, &ESC600_JTAG_group); +#endif + sysfs_remove_group(&client->dev.kobj, &ESC600_SFP_group); +#ifdef ESC_600_MASK_WANTED + sysfs_remove_group(&client->dev.kobj, &ESC600_MASK_group); +#endif + sysfs_remove_group(&client->dev.kobj, &ESC600_FAN_group); + sysfs_remove_group(&client->dev.kobj, &ESC600_USB_group); + sysfs_remove_group(&client->dev.kobj, &ESC600_LED_group); + sysfs_remove_group(&client->dev.kobj, &ESC600_Reset_group); + sysfs_remove_group(&client->dev.kobj, &ESC600_Sensor_group); +#ifdef ESC_600_INT_WANTED + sysfs_remove_group(&client->dev.kobj, &ESC600_INT_group); +#endif + sysfs_remove_group(&client->dev.kobj, &ESC600_Module_group); +exit_free: + kfree(data); +exit: + return status; +} + +static int Cameo_i2c_remove(struct i2c_client *client) +{ + struct Cameo_i2c_data *data = i2c_get_clientdata(client); + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &ESC600_SYS_group); + sysfs_remove_group(&client->dev.kobj, &ESC600_PSU_group); +#ifdef ESC_600_JTAG_WANTED + sysfs_remove_group(&client->dev.kobj, &ESC600_JTAG_group); +#endif + sysfs_remove_group(&client->dev.kobj, &ESC600_SFP_group); +#ifdef ESC_600_MASK_WANTED + sysfs_remove_group(&client->dev.kobj, &ESC600_MASK_group); +#endif + sysfs_remove_group(&client->dev.kobj, &ESC600_FAN_group); + sysfs_remove_group(&client->dev.kobj, &ESC600_USB_group); + sysfs_remove_group(&client->dev.kobj, &ESC600_LED_group); + sysfs_remove_group(&client->dev.kobj, &ESC600_Reset_group); + sysfs_remove_group(&client->dev.kobj, &ESC600_Sensor_group); +#ifdef ESC_600_INT_WANTED + sysfs_remove_group(&client->dev.kobj, &ESC600_INT_group); +#endif + sysfs_remove_group(&client->dev.kobj, &ESC600_Module_group); + kfree(data); + return 0; +} + +static const struct i2c_device_id Cameo_i2c_id[] = +{ + { "ESC_600_128q", 0 }, + {}, +}; +MODULE_DEVICE_TABLE(i2c, Cameo_i2c_id); + +static struct i2c_driver Cameo_i2c_driver = +{ + .class = I2C_CLASS_HWMON, + .driver = + { + .name = "ESC_600_128q", + }, + .probe = Cameo_i2c_probe, + .remove = Cameo_i2c_remove, + .id_table = Cameo_i2c_id, + .address_list = normal_i2c, +}; + +static struct i2c_board_info ESC_600_128q_info[] __initdata = +{ + { + I2C_BOARD_INFO("ESC_600_128q", 0x33), + .platform_data = NULL, + }, +}; + +static struct i2c_board_info Cameo_CPLD_2_info[] __initdata = +{ + { + I2C_BOARD_INFO("Cameo_CPLD_2", 0x30), + .platform_data = NULL, + }, +}; + +static struct i2c_board_info Cameo_CPLD_3_info[] __initdata = +{ + { + I2C_BOARD_INFO("Cameo_CPLD_3", 0x31), + .platform_data = NULL, + }, +}; + +static struct i2c_board_info Cameo_CPLD_4_info[] __initdata = +{ + { + I2C_BOARD_INFO("Cameo_CPLD_3", 0x35), + .platform_data = NULL, + }, +}; + +static struct i2c_board_info Cameo_Extpand_1_info[] __initdata = +{ + { + I2C_BOARD_INFO("Cameo_Extpand_1", 0x20), + .platform_data = NULL, + }, +}; + +static struct i2c_board_info Cameo_Extpand_2_info[] __initdata = +{ + { + I2C_BOARD_INFO("Cameo_Extpand_2", 0x21), + .platform_data = NULL, + }, +}; + +static struct i2c_board_info Cameo_BMC_info[] __initdata = +{ + { + I2C_BOARD_INFO("Cameo_BMC", 0x14), + .platform_data = NULL, + }, +}; + +/********************************************************************************/ +/* Function Name : Cameo_i2c_init */ +/* Description : To init i2c driver */ +/* */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : None. */ +/********************************************************************************/ +static int __init Cameo_i2c_init(void) +{ + int ret; + struct i2c_adapter *i2c_adap = i2c_get_adapter(0); + if (i2c_adap == NULL) + { + printk("ERROR: i2c_get_adapter FAILED!\n"); + return -1; + } + ESC_600_128q_client = i2c_new_device(i2c_adap, &ESC_600_128q_info[0]); + Cameo_CPLD_2_client = i2c_new_device(i2c_adap, &Cameo_CPLD_2_info[0]); + Cameo_CPLD_3_client = i2c_new_device(i2c_adap, &Cameo_CPLD_3_info[0]); + Cameo_CPLD_4_client = i2c_new_device(i2c_adap, &Cameo_CPLD_4_info[0]); + Cameo_Extpand_1_client = i2c_new_device(i2c_adap, &Cameo_Extpand_1_info[0]); + Cameo_Extpand_2_client = i2c_new_device(i2c_adap, &Cameo_Extpand_2_info[0]); + Cameo_BMC_client = i2c_new_device(i2c_adap, &Cameo_BMC_info[0]); + if (ESC_600_128q_info == NULL || Cameo_CPLD_2_info == NULL || + Cameo_CPLD_3_info == NULL || Cameo_Extpand_1_info == NULL || + Cameo_Extpand_2_info == NULL || Cameo_BMC_info == NULL || + Cameo_CPLD_4_info == NULL) + { + printk("ERROR: i2c_new_device FAILED!\n"); + return -1; + } + i2c_put_adapter(i2c_adap); + ret = i2c_add_driver(&Cameo_i2c_driver); + printk(KERN_ALERT "ESC600-128Q i2c Driver ret: %d\n", ret); + printk(KERN_ALERT "ESC600-128Q i2c Driver Version: %s\n", DRIVER_VERSION); + printk(KERN_ALERT "ESC600-128Q i2c Driver INSTALL SUCCESS\n"); + return ret; +} + +/********************************************************************************/ +/* Function Name : Cameo_i2c_exit */ +/* Description : To remove i2c driver */ +/* */ +/* Input(s) : None. */ +/* Output(s) : None. */ +/* Returns : None. */ +/********************************************************************************/ +static void __exit Cameo_i2c_exit(void) +{ + i2c_unregister_device(ESC_600_128q_client); + i2c_unregister_device(Cameo_CPLD_2_client); + i2c_unregister_device(Cameo_CPLD_3_client); + i2c_unregister_device(Cameo_CPLD_4_client); + i2c_unregister_device(Cameo_Extpand_1_client); + i2c_unregister_device(Cameo_Extpand_2_client); + i2c_unregister_device(Cameo_BMC_client); + i2c_del_driver(&Cameo_i2c_driver); + printk(KERN_ALERT "ESC600-128Q i2c driver uninstall success\n"); +} + +MODULE_AUTHOR("Cameo Inc."); +MODULE_DESCRIPTION("Cameo ESC600-128Q i2c driver"); +MODULE_LICENSE("GPL"); + +module_init(Cameo_i2c_init); +module_exit(Cameo_i2c_exit); \ No newline at end of file diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/modules/x86-64-cameo-esc600-128q.h b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/modules/x86-64-cameo-esc600-128q.h new file mode 100644 index 0000000000..ec48200431 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/modules/x86-64-cameo-esc600-128q.h @@ -0,0 +1,721 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRIVER_VERSION "2.5" + +#define TURN_OFF 0 +#define TURN_ON 1 +#define LED_ON 0x1 +#define LED_OFF 0xfe +#define ALERT_TH0 1 +#define ALERT_TH1 2 +#define ALERT_TH2 3 +#define ALERT_TH3 4 +#define ALERT_TH4 5 +#define ALERT_TH5 6 +#define ALERT_TH0_MASK 1 +#define ALERT_TH1_MASK 2 +#define ALERT_TH2_MASK 3 +#define ALERT_TH3_MASK 4 +#define ALERT_TH4_MASK 5 +#define ALERT_TH5_MASK 6 +#define SW_ALERT_TH0 1 +#define SW_ALERT_TH1 2 +#define SW_ALERT_TH2 3 +#define SW_ALERT_TH3 4 +#define SW_ALERT_TH0_MASK 1 +#define SW_ALERT_TH1_MASK 2 +#define SW_ALERT_TH2_MASK 3 +#define SW_ALERT_TH3_MASK 4 +#define SENSOR_INT_0 1 +#define SENSOR_INT_1 2 +#define SENSOR_INT_0_MASK 1 +#define SENSOR_INT_1_MASK 2 +#define FAN_CH1 1 +#define FAN_CH2 2 +#define FAN_CH3 3 +#define USB_ON 0x1 +#define USB_OFF 0xfe +#define MODULE_INS_INT 1 +#define MODULE_INT 2 +#define MODULE_POWER_INT 3 +#define THER_SENSOR_INT 4 +#define IO_BOARD_INT 5 +#define FAN_ERROR_INT 6 +#define MODULE_INS_INT_MASK 1 +#define MODULE_INT_MASK 2 +#define MODULE_POW_INT_MASK 3 +#define THER_SEN_INT_MASK 4 +#define IO_BOARD_INT_MASK 5 +#define FAN_ERROR_INT_MASK 6 +#define SFP_PORT_1 1 +#define SFP_PORT_2 2 +#define SFP_PORT_MGM 3 +#define SFP_PORT_1_ON 1 +#define SFP_PORT_1_OFF 2 +#define SFP_PORT_2_ON 3 +#define SFP_PORT_2_OFF 4 +#define SFP_PORT_MGM_ON 5 +#define SFP_PORT_MGM_OFF 6 +#define SYS_LED_A 1 +#define SYS_LED_G 2 +#define SYS_LED_BLINK 3 +#define SYS_LED_OFF 0 +#define SYS_LED_A_N 1 +#define SYS_LED_A_B 2 +#define SYS_LED_G_N 3 +#define SYS_LED_G_B 4 +#define SWITCH_LED_OFF 0 +#define SWITCH_LED_A_N 1 +#define SWITCH_LED_A_B 2 +#define SWITCH_LED_G_N 3 +#define SWITCH_LED_G_B 4 +#define SWITCH_LED_BLINK 1 + +struct i2c_adap { + int nr; + char *name; + const char *funcs; + const char *algo; +}; + +struct i2c_adap *gather_i2c_busses(void); +void free_adapters(struct i2c_adap *adapters); + +/* compiler conditional */ +#define LED_CTRL_WANTED +#define USB_CTRL_WANTED +#define ESC_600_BMC_WANTED +#define ESC_600_INT_WANTED +#define ESC_600_ALARM_WANTED +#define ESC_600_STAT_WANTED +#define ESC_600_JTAG_WANTED +#define WDT_CTRL_WANTED +#define EEPROM_WP_WANTED +//#define EEPROM_WANTED +//#define LED_L3_CTRL_WANTED +//#define LINEAR_CONVERT_FUNCTION + +#define DEBUG_MSG +#ifdef DEBUG_MSG + #define debug_print(s) printk s +#else + #define debug_print(s) +#endif +/* end of compiler conditional */ + +/* i2c_client Declaration */ +static struct i2c_client *ESC_600_128q_client; //0x33 I/O Board CPLD ,XO2-640 +static struct i2c_client *Cameo_Extpand_1_client; //0x20 I/O Extpander ,PCA9534PW +static struct i2c_client *Cameo_Extpand_2_client; //0x21 I/O Extpander ,PCA9534PW +static struct i2c_client *Cameo_CPLD_2_client; //0x30 CPLD ,XO2-2000HC-4FTG256C +static struct i2c_client *Cameo_CPLD_3_client; //0x31 CPLD ,XO2-7000HC-4TG144C +static struct i2c_client *Cameo_CPLD_4_client; //0x35 CPLD ,XO2-2000HC-4FTG256C +#ifdef ESC_600_BMC_WANTED +static struct i2c_client *Cameo_BMC_client; //0x14 BMC ,Aspeed +#endif /*ESC_600_BMC_WANTED*/ +/* end of i2c_client Declaration */ + +/* Function Declaration */ +/*0x33 I/O Board CPLD*/ +static ssize_t sfp_select_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t sfp_select_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t sfp_tx_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t sfp_tx_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t sfp_insert_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t sfp_rx_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t psu_status_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t switch_button_get(struct device *dev, struct device_attribute *da, char *buf); +#ifdef LED_CTRL_WANTED +static ssize_t sys_led_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t sys_led_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t switch_led_all_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t switch_led_all_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +#ifdef LED_L3_CTRL_WANTED +static ssize_t switch_led_3_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t switch_led_3_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +#endif /*LED_L3_CTRL_WANTED*/ +static ssize_t switch_led_4_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t switch_led_4_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t switch_led_5_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t switch_led_5_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +#endif /*LED_CTRL_WANTED*/ +#ifdef ESC_600_INT_WANTED +static ssize_t sfp_int_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t psu_int_get(struct device *dev, struct device_attribute *da, char *buf); +#endif /*ESC_600_INT_WANTED*/ +/*0x31 CPLD-1 700HC*/ +#ifdef LED_CTRL_WANTED +static ssize_t led_ctrl_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t led_ctrl_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +#endif /*LED_CTRL_WANTED*/ +#ifdef ESC_600_JTAG_WANTED +static ssize_t jtag_select_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t jtag_select_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +#endif /*ESC_600_JTAG_WANTED*/ +#ifdef ESC_600_STAT_WANTED +static ssize_t sensor_status_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t sersor_status_mask_all_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t sersor_status_mask_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t sersor_status_mask_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +#endif /*ESC_600_STAT_WANTED*/ +#ifdef ESC_600_ALARM_WANTED +static ssize_t switch_alarm_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t switch_alarm_mask_all_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t switch_alarm_mask_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t switch_alarm_mask_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +#endif /*ESC_600_ALARM_WANTED*/ +#ifdef ESC_600_INT_WANTED +static ssize_t sensor_int_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t sersor_int_mask_all_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t sersor_int_mask_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t sersor_int_mask_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t int_mask_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t int_mask_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +#endif /*ESC_600_INT_WANTED*/ +/*0x30 CPLD-1 640UHC*/ +static ssize_t fan_status_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t fan_insert_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t fan_power_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t fan_direct_get(struct device *dev, struct device_attribute *da, char *buf); +#ifdef USB_CTRL_WANTED +static ssize_t usb_power_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t usb_power_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +#endif /*USB_CTRL_WANTED*/ +static ssize_t shutdown_sys_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t shutdown_sys_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t reset_sys_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t module_reset_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t module_power_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t module_12v_status_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t module_enable_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t module_enable_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t module_insert_get(struct device *dev, struct device_attribute *da, char *buf); +#ifdef ESC_600_INT_WANTED +static ssize_t switch_int_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t switch_int_mask_all_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t switch_int_mask_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t switch_int_mask_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +#endif /*ESC_600_INT_WANTED*/ +static ssize_t cpld_version_get(struct device *dev, struct device_attribute *da, char *buf); +#ifdef WDT_CTRL_WANTED +static ssize_t wdt_status_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t wdt_status_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +#endif /*WDT_CTRL_WANTED*/ +#ifdef EEPROM_WP_WANTED +static ssize_t eeprom_wp_status_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t eeprom_wp_status_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +#endif /*EEPROM_WP_WANTED*/ +/*0x14 BMC*/ +#ifdef ESC_600_BMC_WANTED +static ssize_t bmc_module_detect(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t themal_temp_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t module_temp_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t mac_temp_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t psu_module_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t dc_chip_switch_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t dc_chip_slot_get(struct device *dev, struct device_attribute *da, char *buf); +#endif /*ESC_600_BMC_WANTED*/ +/* end of Function Declaration */ + +/* struct i2c_data */ +struct Cameo_i2c_data +{ + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 status; /* Status register read from CPLD */ +}; +/*end of struct i2c_data */ + +/* struct i2c_sysfs_attributes */ +enum Cameo_i2c_sysfs_attributes +{ + /*0x31 CPLD-1 700HC*/ +#ifdef LED_CTRL_WANTED + LED_CTRL, +#endif /*LED_CTRL_WANTED*/ +#ifdef ESC_600_JTAG_WANTED + JTAG_SELECT, +#endif /*ESC_600_JTAG_WANTED*/ +#ifdef ESC_600_STAT_WANTED + SENSOR_STATUS, + SENSOR_STATUS_MASK, +#endif /*ESC_600_STAT_WANTED*/ +#ifdef ESC_600_ALARM_WANTED + SWITCH_ALARM, + SWITCH_ALARM_MASK, +#endif /*ESC_600_ALARM_WANTED*/ +#ifdef ESC_600_INT_WANTED + SENSOR_INT, + SENSOR_INT_MASK, +#endif /*ESC_600_INT_WANTED*/ + /*0x30 CPLD-1 640UHC*/ + FAN_STATUS, + FAN_INSERT, + FAN_POWER, + FAN_DIRECT, + FAN_SPEED_RPM, +#ifdef USB_CTRL_WANTED + USB_POWER, +#endif /*USB_CTRL_WANTED*/ + SYS_SHUTDOWN, + SYS_RESET, + MODULE_RESET, + MODULE_INSERT, + MODULE_POWER, + MODULE_ENABLE, + MODULE_12V_STAT, + CPLD_VER, +#ifdef ESC_600_INT_WANTED + SWITCH_INT, + SWITCH_INT_MASK, +#endif /*ESC_600_INT_WANTED*/ +#ifdef WDT_CTRL_WANTED + WDT_CTRL, +#endif +#ifdef EEPROM_WP_WANTED + EEPROM_WP_CTRL, +#endif + /*0x33 I/O Board CPLD*/ + SFP_SELECT, + SFP_INSERT, + SFP_TX_DISABLE, + SFP_RX_LOSS, + PSU_PRESENT, + PSU_STATUS, + SWITCH_BUTTON, +#ifdef ESC_600_BMC_WANTED + SENSOR_TEMP, + MODULE_TEMP, + MAC_TEMP, + DC_CHIP_SWITCH, + DC_CHIP_SLOT_1, + DC_CHIP_SLOT_2, + DC_CHIP_SLOT_3, + DC_CHIP_SLOT_4, + DC_CHIP_SLOT_5, + DC_CHIP_SLOT_6, + DC_CHIP_SLOT_7, + DC_CHIP_SLOT_8, + PSU_MODULE_1, + PSU_MODULE_2, + PSU_MODULE_3, + PSU_MODULE_4, + BMC_DETECT, +#endif /*ESC_600_BMC_WANTED*/ +#ifdef LED_CTRL_WANTED + SYS_LED, + SWITCH_LED, +#endif /*LED_CTRL_WANTED*/ +#ifdef ESC_600_INT_WANTED + SFP_INT, + SFP_INT_MASK, + PSU_INT, +#endif /*ESC_600_INT_WANTED*/ +}; +/* end of struct i2c_sysfs_attributes */ + +/* sysfs attributes for SENSOR_DEVICE_ATTR */ +/*ESC600_SYS_attributes*/ +static SENSOR_DEVICE_ATTR(cpld_version , S_IRUGO , cpld_version_get , NULL , CPLD_VER); +#ifdef WDT_CTRL_WANTED +static SENSOR_DEVICE_ATTR(wdt_ctrl , S_IRUGO | S_IWUSR , wdt_status_get , wdt_status_set , WDT_CTRL); +#endif /*WDT_CTRL_WANTED*/ +#ifdef EEPROM_WP_WANTED +static SENSOR_DEVICE_ATTR(eeprom_wp_ctrl , S_IRUGO | S_IWUSR , eeprom_wp_status_get , eeprom_wp_status_set , EEPROM_WP_CTRL); +#endif /*EEPROM_WP_WANTED*/ +/*ESC600_PSU_attributes*/ +static SENSOR_DEVICE_ATTR(psu_present , S_IRUGO , psu_status_get , NULL , PSU_PRESENT); +static SENSOR_DEVICE_ATTR(psu_status , S_IRUGO , psu_status_get , NULL , PSU_STATUS); +#ifdef ESC_600_BMC_WANTED +static SENSOR_DEVICE_ATTR(psu_module_1 , S_IRUGO , psu_module_get , NULL , PSU_MODULE_1); +static SENSOR_DEVICE_ATTR(psu_module_2 , S_IRUGO , psu_module_get , NULL , PSU_MODULE_2); +static SENSOR_DEVICE_ATTR(psu_module_3 , S_IRUGO , psu_module_get , NULL , PSU_MODULE_3); +static SENSOR_DEVICE_ATTR(psu_module_4 , S_IRUGO , psu_module_get , NULL , PSU_MODULE_4); +static SENSOR_DEVICE_ATTR(dc_chip_switch , S_IRUGO , dc_chip_switch_get , NULL , DC_CHIP_SWITCH); +static SENSOR_DEVICE_ATTR(dc_chip_slot_1 , S_IRUGO , dc_chip_slot_get , NULL , DC_CHIP_SLOT_1); +static SENSOR_DEVICE_ATTR(dc_chip_slot_2 , S_IRUGO , dc_chip_slot_get , NULL , DC_CHIP_SLOT_2); +static SENSOR_DEVICE_ATTR(dc_chip_slot_3 , S_IRUGO , dc_chip_slot_get , NULL , DC_CHIP_SLOT_3); +static SENSOR_DEVICE_ATTR(dc_chip_slot_4 , S_IRUGO , dc_chip_slot_get , NULL , DC_CHIP_SLOT_4); +static SENSOR_DEVICE_ATTR(dc_chip_slot_5 , S_IRUGO , dc_chip_slot_get , NULL , DC_CHIP_SLOT_5); +static SENSOR_DEVICE_ATTR(dc_chip_slot_6 , S_IRUGO , dc_chip_slot_get , NULL , DC_CHIP_SLOT_6); +static SENSOR_DEVICE_ATTR(dc_chip_slot_7 , S_IRUGO , dc_chip_slot_get , NULL , DC_CHIP_SLOT_7); +static SENSOR_DEVICE_ATTR(dc_chip_slot_8 , S_IRUGO , dc_chip_slot_get , NULL , DC_CHIP_SLOT_8); +#endif /*ESC_600_BMC_WANTED*/ +/*ESC600_JTAG_attributes*/ +#ifdef ESC_600_JTAG_WANTED +static SENSOR_DEVICE_ATTR(jtag_select , S_IRUGO | S_IWUSR , jtag_select_get , jtag_select_set , JTAG_SELECT); +#endif /*ESC_600_JTAG_WANTED*/ +/*ESC600_SFP_attributes*/ +static SENSOR_DEVICE_ATTR(sfp_select , S_IRUGO | S_IWUSR , sfp_select_get , sfp_select_set , SFP_SELECT); +static SENSOR_DEVICE_ATTR(sfp_insert , S_IRUGO , sfp_insert_get , NULL , SFP_INSERT); +static SENSOR_DEVICE_ATTR(sfp_tx_disable , S_IRUGO | S_IWUSR , sfp_tx_get , sfp_tx_set , SFP_TX_DISABLE); +static SENSOR_DEVICE_ATTR(sfp_rx_loss , S_IRUGO , sfp_rx_get , NULL , SFP_RX_LOSS); +/*ESC600_Mask_attributes*/ +#ifdef ESC_600_STAT_WANTED +static SENSOR_DEVICE_ATTR(sersor_status_mask_all , S_IRUGO , sersor_status_mask_all_get , NULL , SENSOR_STATUS_MASK); +static SENSOR_DEVICE_ATTR(sersor_status_mask_1 , S_IRUGO | S_IWUSR , sersor_status_mask_get , sersor_status_mask_set , 1); +static SENSOR_DEVICE_ATTR(sersor_status_mask_2 , S_IRUGO | S_IWUSR , sersor_status_mask_get , sersor_status_mask_set , 2); +static SENSOR_DEVICE_ATTR(sersor_status_mask_3 , S_IRUGO | S_IWUSR , sersor_status_mask_get , sersor_status_mask_set , 3); +static SENSOR_DEVICE_ATTR(sersor_status_mask_4 , S_IRUGO | S_IWUSR , sersor_status_mask_get , sersor_status_mask_set , 4); +static SENSOR_DEVICE_ATTR(sersor_status_mask_5 , S_IRUGO | S_IWUSR , sersor_status_mask_get , sersor_status_mask_set , 5); +static SENSOR_DEVICE_ATTR(sersor_status_mask_6 , S_IRUGO | S_IWUSR , sersor_status_mask_get , sersor_status_mask_set , 6); +#endif /*ESC_600_STAT_WANTED*/ +#ifdef ESC_600_ALARM_WANTED +static SENSOR_DEVICE_ATTR(switch_alarm_mask_all , S_IRUGO , switch_alarm_mask_all_get , NULL , SWITCH_ALARM_MASK); +static SENSOR_DEVICE_ATTR(switch_alarm_mask_1 , S_IRUGO | S_IWUSR , switch_alarm_mask_get , switch_alarm_mask_set , 1); +static SENSOR_DEVICE_ATTR(switch_alarm_mask_2 , S_IRUGO | S_IWUSR , switch_alarm_mask_get , switch_alarm_mask_set , 2); +static SENSOR_DEVICE_ATTR(switch_alarm_mask_3 , S_IRUGO | S_IWUSR , switch_alarm_mask_get , switch_alarm_mask_set , 3); +static SENSOR_DEVICE_ATTR(switch_alarm_mask_4 , S_IRUGO | S_IWUSR , switch_alarm_mask_get , switch_alarm_mask_set , 4); +#endif /*ESC_600_ALARM_WANTED*/ +#ifdef ESC_600_INT_WANTED +static SENSOR_DEVICE_ATTR(sersor_int_mask_all , S_IRUGO , sersor_int_mask_all_get , NULL , SENSOR_INT_MASK); +static SENSOR_DEVICE_ATTR(sersor_int_mask_1 , S_IRUGO | S_IWUSR , sersor_int_mask_get , sersor_int_mask_set , 1); +static SENSOR_DEVICE_ATTR(sersor_int_mask_2 , S_IRUGO | S_IWUSR , sersor_int_mask_get , sersor_int_mask_set , 2); +static SENSOR_DEVICE_ATTR(switch_int_mask_all , S_IRUGO , switch_int_mask_all_get , NULL , SWITCH_INT_MASK); +static SENSOR_DEVICE_ATTR(phy_module_ins_mask , S_IRUGO | S_IWUSR , switch_int_mask_get , switch_int_mask_set , 1); +static SENSOR_DEVICE_ATTR(phy_module_int_mask , S_IRUGO | S_IWUSR , switch_int_mask_get , switch_int_mask_set , 2); +static SENSOR_DEVICE_ATTR(phy_module_power_mask , S_IRUGO | S_IWUSR , switch_int_mask_get , switch_int_mask_set , 3); +static SENSOR_DEVICE_ATTR(cpld2_int_mask , S_IRUGO | S_IWUSR , switch_int_mask_get , switch_int_mask_set , 4); +static SENSOR_DEVICE_ATTR(io_board_int_mask , S_IRUGO | S_IWUSR , switch_int_mask_get , switch_int_mask_set , 5); +static SENSOR_DEVICE_ATTR(fan_error_mask , S_IRUGO | S_IWUSR , switch_int_mask_get , switch_int_mask_set , 6); +static SENSOR_DEVICE_ATTR(psu_int_mask , S_IRUGO | S_IWUSR , int_mask_get , int_mask_set , 1); +static SENSOR_DEVICE_ATTR(sfp_loss_int_mask , S_IRUGO | S_IWUSR , int_mask_get , int_mask_set , 2); +static SENSOR_DEVICE_ATTR(sfp_abs_int_mask , S_IRUGO | S_IWUSR , int_mask_get , int_mask_set , 3); +#endif /*ESC_600_INT_WANTED*/ +/*ESC600_Fan_attributes*/ +static SENSOR_DEVICE_ATTR(fan_status , S_IRUGO , fan_status_get , NULL , FAN_STATUS); +static SENSOR_DEVICE_ATTR(fan_insert , S_IRUGO , fan_insert_get , NULL , FAN_INSERT); +static SENSOR_DEVICE_ATTR(fan_power , S_IRUGO , fan_power_get , NULL , FAN_POWER); +static SENSOR_DEVICE_ATTR(fan_direct , S_IRUGO , fan_direct_get , NULL , FAN_DIRECT); +static SENSOR_DEVICE_ATTR(fan_speed_rpm , S_IRUGO , fan_status_get , NULL , FAN_SPEED_RPM); +/*ESC600_USB_attributes*/ +#ifdef USB_CTRL_WANTED +static SENSOR_DEVICE_ATTR(usb_power , S_IRUGO | S_IWUSR , usb_power_get , usb_power_set , USB_POWER); +#endif /*USB_CTRL_WANTED*/ +/*ESC600_LED_attributes*/ +#ifdef LED_CTRL_WANTED +static SENSOR_DEVICE_ATTR(led_ctrl , S_IRUGO | S_IWUSR , led_ctrl_get , led_ctrl_set , LED_CTRL); +static SENSOR_DEVICE_ATTR(sys_led , S_IRUGO | S_IWUSR , sys_led_get , sys_led_set , SYS_LED); +static SENSOR_DEVICE_ATTR(switch_led_all , S_IRUGO | S_IWUSR , switch_led_all_get , switch_led_all_set , SWITCH_LED); +#ifdef LED_L3_CTRL_WANTED +static SENSOR_DEVICE_ATTR(switch_led_3_1 , S_IRUGO | S_IWUSR , switch_led_3_get , switch_led_3_set , 1); +static SENSOR_DEVICE_ATTR(switch_led_3_2 , S_IRUGO | S_IWUSR , switch_led_3_get , switch_led_3_set , 2); +static SENSOR_DEVICE_ATTR(switch_led_3_3 , S_IRUGO | S_IWUSR , switch_led_3_get , switch_led_3_set , 3); +static SENSOR_DEVICE_ATTR(switch_led_3_4 , S_IRUGO | S_IWUSR , switch_led_3_get , switch_led_3_set , 4); +#endif /*LED_L3_CTRL_WANTED*/ +static SENSOR_DEVICE_ATTR(switch_led_4_1 , S_IRUGO | S_IWUSR , switch_led_4_get , switch_led_4_set , 1); +static SENSOR_DEVICE_ATTR(switch_led_4_2 , S_IRUGO | S_IWUSR , switch_led_4_get , switch_led_4_set , 2); +static SENSOR_DEVICE_ATTR(switch_led_4_3 , S_IRUGO | S_IWUSR , switch_led_4_get , switch_led_4_set , 3); +static SENSOR_DEVICE_ATTR(switch_led_4_4 , S_IRUGO | S_IWUSR , switch_led_4_get , switch_led_4_set , 4); +static SENSOR_DEVICE_ATTR(switch_led_5_1 , S_IRUGO | S_IWUSR , switch_led_5_get , switch_led_5_set , 1); +static SENSOR_DEVICE_ATTR(switch_led_5_2 , S_IRUGO | S_IWUSR , switch_led_5_get , switch_led_5_set , 2); +static SENSOR_DEVICE_ATTR(switch_led_5_3 , S_IRUGO | S_IWUSR , switch_led_5_get , switch_led_5_set , 3); +static SENSOR_DEVICE_ATTR(switch_led_5_4 , S_IRUGO | S_IWUSR , switch_led_5_get , switch_led_5_set , 4); +#endif /*LED_CTRL_WANTED*/ +/*ESC600_Reset_attributes*/ +static SENSOR_DEVICE_ATTR(shutdown_sys , S_IRUGO | S_IWUSR , shutdown_sys_get , shutdown_sys_set , SYS_SHUTDOWN); +static SENSOR_DEVICE_ATTR(reset_sys , S_IRUGO | S_IWUSR , NULL , reset_sys_set , SYS_RESET); +/*ESC600_Sensor_attributes*/ +#ifdef ESC_600_STAT_WANTED +static SENSOR_DEVICE_ATTR(sensor_status , S_IRUGO , sensor_status_get , NULL , SENSOR_STATUS); +#endif /*ESC_600_STAT_WANTED*/ +#ifdef ESC_600_ALARM_WANTED +static SENSOR_DEVICE_ATTR(switch_alarm , S_IRUGO , switch_alarm_get , NULL , SWITCH_ALARM); +#endif /*ESC_600_ALARM_WANTED*/ +static SENSOR_DEVICE_ATTR(switch_button , S_IRUGO , switch_button_get , NULL , SWITCH_BUTTON); +#ifdef ESC_600_BMC_WANTED +static SENSOR_DEVICE_ATTR(sensor_temp , S_IRUGO , themal_temp_get , NULL , SENSOR_TEMP); +static SENSOR_DEVICE_ATTR(module_temp , S_IRUGO , module_temp_get , NULL , MODULE_TEMP); +static SENSOR_DEVICE_ATTR(mac_temp , S_IRUGO , mac_temp_get , NULL , MAC_TEMP); +static SENSOR_DEVICE_ATTR(bmc_present , S_IRUGO , bmc_module_detect , NULL , BMC_DETECT); +#endif /*ESC_600_BMC_WANTED*/ +/*ESC600_INT_attributes*/ +#ifdef ESC_600_INT_WANTED +static SENSOR_DEVICE_ATTR(sensor_int , S_IRUGO , sensor_int_get , NULL , SENSOR_INT); +static SENSOR_DEVICE_ATTR(switch_int , S_IRUGO , switch_int_get , NULL , SWITCH_INT); +static SENSOR_DEVICE_ATTR(sfp_int , S_IRUGO , sfp_int_get , NULL , SFP_INT); +static SENSOR_DEVICE_ATTR(psu_int , S_IRUGO , psu_int_get , NULL , PSU_INT); +#endif /*ESC_600_INT_WANTED*/ +/*ESC600_Module_attributes*/ +static SENSOR_DEVICE_ATTR(module_reset , S_IRUGO | S_IWUSR , NULL , module_reset_set , MODULE_RESET); +static SENSOR_DEVICE_ATTR(module_insert , S_IRUGO , module_insert_get , NULL , MODULE_INSERT); +static SENSOR_DEVICE_ATTR(module_power , S_IRUGO , module_power_get , NULL , MODULE_POWER); +static SENSOR_DEVICE_ATTR(module_enable , S_IRUGO | S_IWUSR , module_enable_get , module_enable_set , MODULE_ENABLE); +static SENSOR_DEVICE_ATTR(module_12v_status , S_IRUGO , module_12v_status_get , NULL , MODULE_12V_STAT); +/* end of sysfs attributes for SENSOR_DEVICE_ATTR */ + +/* sysfs attributes for hwmon */ +static struct attribute *ESC600_SYS_attributes[] = +{ +#ifdef ESC_600_BMC_WANTED + &sensor_dev_attr_bmc_present.dev_attr.attr, +#endif /*ESC_600_BMC_WANTED*/ + &sensor_dev_attr_cpld_version.dev_attr.attr, +#ifdef WDT_CTRL_WANTED + &sensor_dev_attr_wdt_ctrl.dev_attr.attr, +#endif +#ifdef EEPROM_WP_WANTED + &sensor_dev_attr_eeprom_wp_ctrl.dev_attr.attr, +#endif + NULL +}; +static struct attribute *ESC600_PSU_attributes[] = +{ + &sensor_dev_attr_psu_present.dev_attr.attr, + &sensor_dev_attr_psu_status.dev_attr.attr, +#ifdef ESC_600_BMC_WANTED + &sensor_dev_attr_psu_module_1.dev_attr.attr, + &sensor_dev_attr_psu_module_2.dev_attr.attr, + &sensor_dev_attr_psu_module_3.dev_attr.attr, + &sensor_dev_attr_psu_module_4.dev_attr.attr, + &sensor_dev_attr_dc_chip_switch.dev_attr.attr, + &sensor_dev_attr_dc_chip_slot_1.dev_attr.attr, + &sensor_dev_attr_dc_chip_slot_2.dev_attr.attr, + &sensor_dev_attr_dc_chip_slot_3.dev_attr.attr, + &sensor_dev_attr_dc_chip_slot_4.dev_attr.attr, + &sensor_dev_attr_dc_chip_slot_5.dev_attr.attr, + &sensor_dev_attr_dc_chip_slot_6.dev_attr.attr, + &sensor_dev_attr_dc_chip_slot_7.dev_attr.attr, + &sensor_dev_attr_dc_chip_slot_8.dev_attr.attr, +#endif /*ESC_600_BMC_WANTED*/ + NULL +}; + +#ifdef ESC_600_JTAG_WANTED +static struct attribute *ESC600_JTAG_attributes[] = +{ + &sensor_dev_attr_jtag_select.dev_attr.attr, + NULL +}; +#endif + +static struct attribute *ESC600_SFP_attributes[] = +{ + &sensor_dev_attr_sfp_select.dev_attr.attr, + &sensor_dev_attr_sfp_insert.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable.dev_attr.attr, + &sensor_dev_attr_sfp_rx_loss.dev_attr.attr, + NULL +}; + +static struct attribute *ESC600_Mask_attributes[] = +{ +#ifdef ESC_600_STAT_WANTED + &sensor_dev_attr_sersor_status_mask_all.dev_attr.attr, + &sensor_dev_attr_sersor_status_mask_1.dev_attr.attr, + &sensor_dev_attr_sersor_status_mask_2.dev_attr.attr, + &sensor_dev_attr_sersor_status_mask_3.dev_attr.attr, + &sensor_dev_attr_sersor_status_mask_4.dev_attr.attr, + &sensor_dev_attr_sersor_status_mask_5.dev_attr.attr, + &sensor_dev_attr_sersor_status_mask_6.dev_attr.attr, +#endif /*ESC_600_STAT_WANTED*/ +#ifdef ESC_600_ALARM_WANTED + &sensor_dev_attr_switch_alarm_mask_all.dev_attr.attr, + &sensor_dev_attr_switch_alarm_mask_1.dev_attr.attr, + &sensor_dev_attr_switch_alarm_mask_2.dev_attr.attr, + &sensor_dev_attr_switch_alarm_mask_3.dev_attr.attr, + &sensor_dev_attr_switch_alarm_mask_4.dev_attr.attr, +#endif /*ESC_600_ALARM_WANTED*/ +#ifdef ESC_600_INT_WANTED + &sensor_dev_attr_sersor_int_mask_all.dev_attr.attr, + &sensor_dev_attr_sersor_int_mask_1.dev_attr.attr, + &sensor_dev_attr_sersor_int_mask_2.dev_attr.attr, + &sensor_dev_attr_switch_int_mask_all.dev_attr.attr, + &sensor_dev_attr_phy_module_ins_mask.dev_attr.attr, + &sensor_dev_attr_phy_module_int_mask.dev_attr.attr, + &sensor_dev_attr_phy_module_power_mask.dev_attr.attr, + &sensor_dev_attr_cpld2_int_mask.dev_attr.attr, + &sensor_dev_attr_io_board_int_mask.dev_attr.attr, + &sensor_dev_attr_fan_error_mask.dev_attr.attr, + &sensor_dev_attr_psu_int_mask.dev_attr.attr, + &sensor_dev_attr_sfp_loss_int_mask.dev_attr.attr, + &sensor_dev_attr_sfp_abs_int_mask.dev_attr.attr, +#endif /*ESC_600_INT_WANTED*/ + NULL +}; + +static struct attribute *ESC600_Fan_attributes[] = +{ + &sensor_dev_attr_fan_status.dev_attr.attr, + &sensor_dev_attr_fan_insert.dev_attr.attr, + &sensor_dev_attr_fan_power.dev_attr.attr, + &sensor_dev_attr_fan_direct.dev_attr.attr, + &sensor_dev_attr_fan_speed_rpm.dev_attr.attr, + NULL +}; + +#ifdef USB_CTRL_WANTED +static struct attribute *ESC600_USB_attributes[] = +{ + &sensor_dev_attr_usb_power.dev_attr.attr, + NULL +}; +#endif /*USB_CTRL_WANTED*/ + +#ifdef LED_CTRL_WANTED +static struct attribute *ESC600_LED_attributes[] = +{ + + &sensor_dev_attr_led_ctrl.dev_attr.attr, + &sensor_dev_attr_sys_led.dev_attr.attr, + &sensor_dev_attr_switch_led_all.dev_attr.attr, +#ifdef LED_L3_CTRL_WANTED + &sensor_dev_attr_switch_led_3_1.dev_attr.attr, + &sensor_dev_attr_switch_led_3_2.dev_attr.attr, + &sensor_dev_attr_switch_led_3_3.dev_attr.attr, + &sensor_dev_attr_switch_led_3_4.dev_attr.attr, +#endif /*LED_L3_CTRL_WANTED*/ + &sensor_dev_attr_switch_led_4_1.dev_attr.attr, + &sensor_dev_attr_switch_led_4_2.dev_attr.attr, + &sensor_dev_attr_switch_led_4_3.dev_attr.attr, + &sensor_dev_attr_switch_led_4_4.dev_attr.attr, + &sensor_dev_attr_switch_led_5_1.dev_attr.attr, + &sensor_dev_attr_switch_led_5_2.dev_attr.attr, + &sensor_dev_attr_switch_led_5_3.dev_attr.attr, + &sensor_dev_attr_switch_led_5_4.dev_attr.attr, + NULL +}; +#endif + +static struct attribute *ESC600_Reset_attributes[] = +{ + &sensor_dev_attr_shutdown_sys.dev_attr.attr, + &sensor_dev_attr_reset_sys.dev_attr.attr, + NULL +}; + +static struct attribute *ESC600_Sensor_attributes[] = +{ +#ifdef ESC_600_STAT_WANTED + &sensor_dev_attr_sensor_status.dev_attr.attr, +#endif /*ESC_600_STAT_WANTED*/ +#ifdef ESC_600_ALARM_WANTED + &sensor_dev_attr_switch_alarm.dev_attr.attr, +#endif /*ESC_600_ALARM_WANTED*/ + &sensor_dev_attr_switch_button.dev_attr.attr, +#ifdef ESC_600_BMC_WANTED + &sensor_dev_attr_sensor_temp.dev_attr.attr, + &sensor_dev_attr_module_temp.dev_attr.attr, + &sensor_dev_attr_mac_temp.dev_attr.attr, +#endif /*ESC_600_BMC_WANTED*/ + NULL +}; + +#ifdef ESC_600_INT_WANTED +static struct attribute *ESC600_INT_attributes[] = +{ + &sensor_dev_attr_sensor_int.dev_attr.attr, + &sensor_dev_attr_switch_int.dev_attr.attr, + &sensor_dev_attr_sfp_int.dev_attr.attr, + &sensor_dev_attr_psu_int.dev_attr.attr, + NULL +}; +#endif + +static struct attribute *ESC600_Module_attributes[] = +{ + &sensor_dev_attr_module_reset.dev_attr.attr, + &sensor_dev_attr_module_insert.dev_attr.attr, + &sensor_dev_attr_module_power.dev_attr.attr, + &sensor_dev_attr_module_enable.dev_attr.attr, + &sensor_dev_attr_module_12v_status.dev_attr.attr, + NULL +}; +/* end of sysfs attributes for hwmon */ + +/* struct attribute_group */ +static const struct attribute_group ESC600_SYS_group = +{ + .name = "ESC600_SYS", + .attrs = ESC600_SYS_attributes, +}; + +static const struct attribute_group ESC600_PSU_group = +{ + .name = "ESC600_PSU", + .attrs = ESC600_PSU_attributes, +}; + +#ifdef ESC_600_JTAG_WANTED +static const struct attribute_group ESC600_JTAG_group = +{ + .name = "ESC600_JTAG", + .attrs = ESC600_JTAG_attributes, +}; +#endif + +static const struct attribute_group ESC600_SFP_group = +{ + .name = "ESC600_SFP", + .attrs = ESC600_SFP_attributes, +}; + +static const struct attribute_group ESC600_MASK_group = +{ + .name = "ESC600_MASK", + .attrs = ESC600_Mask_attributes, +}; + +static const struct attribute_group ESC600_FAN_group = +{ + .name = "ESC600_FAN", + .attrs = ESC600_Fan_attributes, +}; + +#ifdef USB_CTRL_WANTED +static const struct attribute_group ESC600_USB_group = +{ + .name = "ESC600_USB", + .attrs = ESC600_USB_attributes, +}; +#endif /*USB_CTRL_WANTED*/ + +#ifdef LED_CTRL_WANTED +static const struct attribute_group ESC600_LED_group = +{ + .name = "ESC600_LED", + .attrs = ESC600_LED_attributes, +}; +#endif /*LED_CTRL_WANTED*/ + +static const struct attribute_group ESC600_Reset_group = +{ + .name = "ESC600_Reset", + .attrs = ESC600_Reset_attributes, +}; + +static const struct attribute_group ESC600_Sensor_group = +{ + .name = "ESC600_Sensor", + .attrs = ESC600_Sensor_attributes, +}; + +#ifdef ESC_600_INT_WANTED +static const struct attribute_group ESC600_INT_group = +{ + .name = "ESC600_INT", + .attrs = ESC600_INT_attributes, +}; +#endif + +static const struct attribute_group ESC600_Module_group = +{ + .name = "ESC600_Module", + .attrs = ESC600_Module_attributes, +}; +/* end of struct attribute_group */ \ No newline at end of file diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/modules/zrh2800k2.c b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/modules/zrh2800k2.c new file mode 100644 index 0000000000..3a8fbb408c --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/modules/zrh2800k2.c @@ -0,0 +1,686 @@ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DEBUG_MSG +#ifdef DEBUG_MSG + #define debug_print(s) printk s +#else + #define debug_print(s) +#endif + +//#define SYMBOL_FOR_LM_SENSOR + +enum power_modules{ zrh2800k2, zrh2ab0k2 }; + +struct zrh2800k2_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u64 last_energy_value_EIN; + u64 last_smaple_count_EIN; + u64 last_energy_value_EOUT; + u64 last_smaple_count_EOUT; +}; + +typedef enum _access_type_{ + READ_BYTE, + READ_WORD, + READ_BLOCK +}ACCESS_TYPE; + +typedef enum _value_format_{ + FORMAT_NORMAL, + FORMAT_DIRECT, + FORMAT_LINEAR +}VALUE_FORMAT; + +typedef enum _zrh2800k2_regs_ { + REG_CAPABILITY = 0x19, + REG_QUERY = 0X1A, + REG_VOUT_MODE = 0x20, + REG_COEFFICIENTS = 0X30, + REG_FAN_CONFIG_1_2 = 0x3A, + REG_STATUS_WORD = 0x79, + REG_STATUS_VOUT = 0x7A, + REG_STATUS_IOUT = 0x7B, + REG_STATUS_INPUT = 0x7C, + REG_STATUS_TEMPERATURE = 0x7D, + REG_STATUS_FANS_1_2 = 0x81, + REG_READ_EIN = 0x86, /* direct data format */ + REG_READ_EOUT = 0x87, /* direct data format */ + REG_READ_VIN = 0x88, + REG_READ_IIN = 0x89, + REG_READ_VOUT = 0x8B, /* linear data format */ + REG_READ_IOUT = 0x8C, /* linear data format */ + REG_READ_TEMPERATURE1 = 0x8D, /* linear data format */ + REG_READ_FAN_SPEED_1 = 0x90, /* linear data format */ + REG_READ_POUT = 0x96, /* linear data format */ + REG_READ_PIN = 0x97, /* linear data format */ + REG_READ_PMBUS_REVISION = 0x98, + REG_READ_MFR_ID = 0x99, /* ZIPPY 5 BYTES */ + REG_READ_MFR_MODEL = 0x9A, + REG_READ_MFR_VIN_MAX = 0xA4, /* linear data format */ + REG_READ_MFR_IOUT_MAX = 0xA6 /* lineat data format */ +}ZRH2800K2_REGS; + +enum zrh2800k2_sysfs_attributes { + PSU_CAPABILITY, /* 0 */ + PSU_QUERY, + PSU_VOUT_MODE, + PSU_COEFFICIENTS, + PSU_FAN_CONFIG_1_2, + PSU_STATUS_WORD, /* 5 */ + PSU_STATUS_VOUT, + PSU_STATUS_IOUT, + PSU_STATUS_INPUT, + PSU_STATUS_TEMPERATURE, + PSU_STATUS_FANS_1_2, /* 10 */ + PSU_EIN, + PSU_EOUT, + PSU_VIN, + PSU_IIN, + PSU_VOUT, /* 15 */ + PSU_IOUT, + PSU_TEMPERATURE_1, + PSU_FAN_SPEED_1, + PSU_POUT, + PSU_PIN, /* 20 */ + PSU_PMBUS_REVISION, + PSU_MFR_ID, + PSU_MFR_MODEL, + PSU_MFR_VIN_MAX, + PSU_MFR_IOUT_MAX +}; + +struct _OPERATION_SET_ { + ZRH2800K2_REGS reg; + ACCESS_TYPE type; + u8 data_size; // unit: byte, only used for block read +}; + +/* the index of operations are mapping to the zrh2800k2_sysfs_attributes */ +static struct _OPERATION_SET_ operation_set[] = { + { REG_CAPABILITY, READ_BYTE, 1 }, // 0 + { REG_QUERY, READ_BYTE, 1}, // 1 + { REG_VOUT_MODE, READ_BYTE, 1 }, // 2 + { REG_COEFFICIENTS, READ_BLOCK, 5 }, // 3 + { REG_FAN_CONFIG_1_2 , READ_BYTE, 1 }, // 4 + { REG_STATUS_WORD, READ_WORD, 2 }, // 5 + { REG_STATUS_VOUT, READ_BYTE, 1 }, // 6 + { REG_STATUS_IOUT, READ_BYTE, 1 }, // 7 + { REG_STATUS_INPUT, READ_BYTE, 1 }, // 8 + { REG_STATUS_TEMPERATURE, READ_BYTE, 1 }, //9 + { REG_STATUS_FANS_1_2, READ_BYTE, 1 }, // 10 + { REG_READ_EIN, READ_BLOCK, 6 }, // 11 + { REG_READ_EOUT, READ_BLOCK, 6 }, // 12 + { REG_READ_VIN, READ_WORD, 2 }, // 13 + { REG_READ_IIN, READ_WORD, 2 }, // 14 + { REG_READ_VOUT, READ_WORD, 2 }, // 15 + { REG_READ_IOUT, READ_WORD, 2 }, // 16 + { REG_READ_TEMPERATURE1, READ_WORD, 2 }, // 17 + { REG_READ_FAN_SPEED_1, READ_WORD, 2 }, // 18 + { REG_READ_POUT, READ_WORD, 2 }, // 19 + { REG_READ_PIN, READ_WORD, 2 }, // 20 + { REG_READ_PMBUS_REVISION, READ_BYTE, 1 }, //21 + { REG_READ_MFR_ID, READ_BLOCK, 5 }, // 22 + { REG_READ_MFR_MODEL, READ_BLOCK, 9 }, // 23 + { REG_READ_MFR_VIN_MAX, READ_WORD, 2 }, // 24 + { REG_READ_MFR_IOUT_MAX, READ_WORD, 2 } // 25 +}; + + +static int zrh2800k2_remove(struct i2c_client *client); +static int zrh2800k2_probe(struct i2c_client *client, const struct i2c_device_id *dev_id); +static ssize_t show_value(struct device *dev, struct device_attribute *da, char *buf); + +static ssize_t show_capability(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t psu_pm_query(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t psu_coefficient(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t set_fan_config(struct device *dev, struct device_attribute *da, const char *buf, size_t count); + + +/* Addresses scanned */ +static const unsigned short normal_i2c[] = { 0x58, 0x59, I2C_CLIENT_END }; + +/* sysfs attributes for hwmon */ +static SENSOR_DEVICE_ATTR(psu_query, S_IRUGO, psu_pm_query, NULL, PSU_QUERY); +static SENSOR_DEVICE_ATTR(psu_coeff, S_IRUGO, psu_coefficient,NULL, PSU_COEFFICIENTS); +static SENSOR_DEVICE_ATTR(psu_fan_config_1_2, S_IRUGO|S_IWUSR, show_value, set_fan_config, PSU_FAN_CONFIG_1_2); +static SENSOR_DEVICE_ATTR(psu_capability, S_IRUGO, show_capability, NULL, PSU_CAPABILITY); +static SENSOR_DEVICE_ATTR(psu_vout_mode, S_IRUGO, show_value, NULL, PSU_VOUT_MODE); +static SENSOR_DEVICE_ATTR(psu_status_word, S_IRUGO, show_value, NULL, PSU_STATUS_WORD); +static SENSOR_DEVICE_ATTR(psu_status_vout, S_IRUGO, show_value, NULL, PSU_STATUS_VOUT); +static SENSOR_DEVICE_ATTR(psu_status_iout, S_IRUGO, show_value, NULL, PSU_STATUS_IOUT); +static SENSOR_DEVICE_ATTR(psu_status_input, S_IRUGO, show_value, NULL, PSU_STATUS_INPUT); +static SENSOR_DEVICE_ATTR(psu_status_temp, S_IRUGO, show_value, NULL, PSU_STATUS_TEMPERATURE); +static SENSOR_DEVICE_ATTR(psu_status_fan_1_2, S_IRUGO, show_value, NULL, PSU_STATUS_FANS_1_2); +static SENSOR_DEVICE_ATTR(psu_ein, S_IRUGO, show_value, NULL, PSU_EIN); +static SENSOR_DEVICE_ATTR(psu_eout, S_IRUGO, show_value, NULL, PSU_EOUT); +static SENSOR_DEVICE_ATTR(psu_pmbus_rev,S_IRUGO, show_value, NULL, PSU_PMBUS_REVISION); +static SENSOR_DEVICE_ATTR(psu_mfr_id, S_IRUGO, show_value, NULL, PSU_MFR_ID); +static SENSOR_DEVICE_ATTR(psu_mfr_model,S_IRUGO, show_value, NULL, PSU_MFR_MODEL); + +static SENSOR_DEVICE_ATTR(psu_vin, S_IRUGO, show_value, NULL, PSU_VIN); +static SENSOR_DEVICE_ATTR(psu_vout, S_IRUGO, show_value, NULL, PSU_VOUT); +static SENSOR_DEVICE_ATTR(psu_iin, S_IRUGO, show_value, NULL, PSU_IIN); +static SENSOR_DEVICE_ATTR(psu_iout, S_IRUGO, show_value, NULL, PSU_IOUT); +static SENSOR_DEVICE_ATTR(psu_iout_max, S_IRUGO, show_value, NULL, PSU_MFR_IOUT_MAX); +static SENSOR_DEVICE_ATTR(psu_pin, S_IRUGO, show_value, NULL, PSU_PIN); +static SENSOR_DEVICE_ATTR(psu_pout, S_IRUGO, show_value, NULL, PSU_POUT); + +static SENSOR_DEVICE_ATTR(psu_temp_1, S_IRUGO, show_value, NULL, PSU_TEMPERATURE_1); +static SENSOR_DEVICE_ATTR(psu_fan_speed_1, S_IRUGO, show_value, NULL, PSU_FAN_SPEED_1); + +/* section for lm-sensor */ +#ifdef SYMBOL_FOR_LM_SENSOR +static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_value, NULL, PSU_VIN); +// static SENSOR_DEVICE_ATTR(in1_max, S_IRUGO, show_value, NULL, PSU_MFR_VIN_MAX); -> not support +static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_value, NULL, PSU_VOUT); +static SENSOR_DEVICE_ATTR(curr1_input, S_IRUGO, show_value, NULL, PSU_IIN); +static SENSOR_DEVICE_ATTR(curr2_input, S_IRUGO, show_value, NULL, PSU_IOUT); +static SENSOR_DEVICE_ATTR(curr2_max, S_IRUGO, show_value, NULL, PSU_MFR_IOUT_MAX); +static SENSOR_DEVICE_ATTR(power1_input, S_IRUGO, show_value, NULL, PSU_PIN); +static SENSOR_DEVICE_ATTR(power2_input, S_IRUGO, show_value, NULL, PSU_POUT); + +static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_value, NULL, PSU_TEMPERATURE_1); +static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_value, NULL, PSU_FAN_SPEED_1); +#endif + +static struct attribute *zrh2800k2_attributes[] = { + &sensor_dev_attr_psu_query.dev_attr.attr, + &sensor_dev_attr_psu_coeff.dev_attr.attr, + &sensor_dev_attr_psu_fan_config_1_2.dev_attr.attr, + &sensor_dev_attr_psu_capability.dev_attr.attr, + &sensor_dev_attr_psu_vout_mode.dev_attr.attr, + &sensor_dev_attr_psu_status_word.dev_attr.attr, + &sensor_dev_attr_psu_status_vout.dev_attr.attr, + &sensor_dev_attr_psu_status_iout.dev_attr.attr, + &sensor_dev_attr_psu_status_input.dev_attr.attr, + &sensor_dev_attr_psu_status_temp.dev_attr.attr, + &sensor_dev_attr_psu_status_fan_1_2.dev_attr.attr, + &sensor_dev_attr_psu_ein.dev_attr.attr, + &sensor_dev_attr_psu_eout.dev_attr.attr, + &sensor_dev_attr_psu_pmbus_rev.dev_attr.attr, + &sensor_dev_attr_psu_mfr_id.dev_attr.attr, + &sensor_dev_attr_psu_mfr_model.dev_attr.attr, + &sensor_dev_attr_psu_vin.dev_attr.attr, + &sensor_dev_attr_psu_vout.dev_attr.attr, + &sensor_dev_attr_psu_iin.dev_attr.attr, + &sensor_dev_attr_psu_iout.dev_attr.attr, + &sensor_dev_attr_psu_iout_max.dev_attr.attr, + &sensor_dev_attr_psu_pin.dev_attr.attr, + &sensor_dev_attr_psu_pout.dev_attr.attr, + &sensor_dev_attr_psu_temp_1.dev_attr.attr, + &sensor_dev_attr_psu_fan_speed_1.dev_attr.attr, +#ifdef SYMBOL_FOR_LM_SENSOR + &sensor_dev_attr_in1_input.dev_attr.attr, + &sensor_dev_attr_in2_input.dev_attr.attr, + &sensor_dev_attr_curr1_input.dev_attr.attr, + &sensor_dev_attr_curr2_input.dev_attr.attr, + &sensor_dev_attr_curr2_max.dev_attr.attr, + &sensor_dev_attr_power1_input.dev_attr.attr, + &sensor_dev_attr_power2_input.dev_attr.attr, + &sensor_dev_attr_temp1_input.dev_attr.attr, + &sensor_dev_attr_fan1_input.dev_attr.attr, +#endif + NULL +}; + +static const struct attribute_group zrh2800k2_group = { + .attrs = zrh2800k2_attributes, +}; + +static u32 easy_pow(u32 num, u32 power) +{ + if(power == 0) + return 1; + + power--; + + while(power) { + num = num*num; + power--; + } + return num; +} + +static int two_complement_to_int(u16 data, u8 valid_bit, int mask) +{ + u16 valid_data = data & mask; + bool is_negative = valid_data >> (valid_bit - 1); + + return is_negative ? (-(((~valid_data) & mask) + 1)) : valid_data; +} + + +static int zrh2800k2_read(struct device *dev, ACCESS_TYPE rtype , ZRH2800K2_REGS reg) +{ + + struct i2c_client *client = to_i2c_client(dev); + struct zrh2800k2_data *data = i2c_get_clientdata(client); + + int result; + + mutex_lock(&data->update_lock); + + if (rtype == READ_BYTE) { + result = i2c_smbus_read_byte_data(client, (u8)reg); + }else if(rtype == READ_WORD) { + result = i2c_smbus_read_word_data(client, (u8)reg); + }else{ + printk(KERN_ALERT "ERROR: unknown read type"); + } + + mutex_unlock(&data->update_lock); + + return result; + +} + + +static int zrh2800k2_read_block(struct device *dev, ZRH2800K2_REGS reg, u8* block_data, int block_data_len) +{ + + struct i2c_client *client = to_i2c_client(dev); + struct zrh2800k2_data *data = i2c_get_clientdata(client); + + int result; + + mutex_lock(&data->update_lock); + + result = i2c_smbus_read_i2c_block_data(client, (u8)reg, block_data_len, block_data); + + mutex_unlock(&data->update_lock); + + if (unlikely(result < 0)) { + goto read_block_exit; + } + + if (result != block_data_len) { + result = -EIO; + goto read_block_exit; + } + + result = 0; + +read_block_exit: + return result; + +} + +static int get_coefficient(struct device* dev, u16* m, u16* b, u8* R) +{ + u8 buf_block[6] = {0}; + int ret = zrh2800k2_read_block(dev, REG_COEFFICIENTS, buf_block, 6); + + + // [ byte_count,m-l,m-h,b-l,b-h,R ] + if (ret < 0) { + printk(KERN_ALERT "get coefficient fail(%d)\n", ret); + return -1; + } + + *R = buf_block[5]; + *m = buf_block[2]; + *m = ((*m)<<8 )+ buf_block[1]; + *b = buf_block[4]; + *b = ((*b)<<8 )+ buf_block[3]; + + debug_print((KERN_DEBUG " coefficient read : 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x \n", buf_block[0], buf_block[1], buf_block[2], + buf_block[3], buf_block[4], buf_block[5])); + debug_print((KERN_DEBUG " coefficient r m b: 0x%x, 0x%x, 0x%x \n", *R, *m, *b)); + + return 0; + +} + + +/* read a byte or word value and show*/ +static ssize_t show_value(struct device *dev, struct device_attribute *da, char *buf) +{ + + u16 u16_val = 0; + int exponent = 0, mantissa = 0; + int multiplier = 1000; // lm-sensor uint: mV, mA, mC + + u8 buf_block[11] = {0}; // used to save enough data from read block. + + char *ascii = NULL; + int ret = 0; + + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + debug_print((KERN_DEBUG "show value op[%d]: reg %d\n", attr->index, + operation_set[attr->index].reg )); + + switch (operation_set[attr->index].type) { + + case READ_BYTE: + case READ_WORD: + ret = zrh2800k2_read(dev, operation_set[attr->index].type , operation_set[attr->index].reg); + break; + + case READ_BLOCK: + ret = zrh2800k2_read_block(dev, operation_set[attr->index].reg, buf_block, operation_set[attr->index].data_size + 1); + break; + + default: + printk(KERN_ALERT "unknown access type\n"); + return 0; + + } + + if (ret < 0) { + printk(KERN_ALERT "ERROR: Read fail ret(%d)\n", ret); + return 0; + } + + /* arrange return buf */ + switch (attr->index) { + + /* case directly return */ + case PSU_STATUS_WORD: + case PSU_VOUT_MODE: + return sprintf(buf, "%d\n", ret); + + case PSU_STATUS_VOUT: + return sprintf(buf, + "VOUT Over Voltage Fault : %d \nVOUT Over Voltage Warning : %d \nVOUT Under Voltage Warning : %d \nVOUT Under Voltage Fault : %d \n", + (ret>>7)&0x1,(ret>>6)&0x1, + (ret>>5)&0x1,(ret>>4)&0x1); + + case PSU_STATUS_IOUT: + return sprintf(buf, + "IOUT Overcurrent Fault : %d \nIOUT Overcurrent Warnning : %d \nPOUT Overcurrent Fault : %d \nPOUT Overcurrent Warnning : %d \n", + (ret>>7)&0x1, (ret>>5)&0x1, + (ret>>1)&0x1, ret&0x1); + + case PSU_STATUS_INPUT: + return sprintf(buf, + "PIN Overpower Warning : %d \n", (ret&0x1)); + + case PSU_STATUS_TEMPERATURE: + return sprintf(buf, + "Overtemperature Fault : %d \nOvertemperature Warning : %d \nUbdertemperature Warning : %d \nUbdertemperature Fault : %d \n", + (ret>>7)&0x1,(ret>>6)&0x1, + (ret>>5)&0x1,(ret>>4)&0x1); + + case PSU_STATUS_FANS_1_2: + return sprintf(buf, + "Fan Fault : %d \nFan Warning : %d \n", + (ret>>7)&0x1, (ret>>5)&0x1); + + case PSU_FAN_CONFIG_1_2: + debug_print((KERN_DEBUG "PSU_FAN_CONFIG_1_2: 0x%X\n",ret)); + return sprintf(buf, + "Fan is installed in Position1: %s\n" \ + "Fan1 speed Unit: %s\n" \ + "Fan1 Tachometer Pulses Per Revolution 0x%x\n" \ + "Fan install in Position2: %s\n" \ + "Fan2 speed Unit: %s\n" \ + "Fan2 Tachometer Pulses Per Revolution 0x%x\n", + (ret>>7)?"YES":"NONE", + ((ret>>6)&0x1)?"RPM":"Duty Cycle", + (ret>>4)&0x3, + (ret>>3&0x01)?"YES":"NONE", + ((ret>>2)&0x1)?"RPM":"Duty Cycle", + ret&0x3); + + /* special case for READ_VOUT */ + case PSU_VOUT: + /* save mantissa */ + mantissa = ret; + + debug_print((KERN_DEBUG "PSU_VOUT: mantissa 0x%X\n",mantissa)); + + /* read the exponent from REG_READ_VMODE */ + ret = zrh2800k2_read(dev, READ_BYTE , REG_VOUT_MODE); + if (ret < 0) { + printk(KERN_ALERT "Error: Read fail ret(%d)\n", ret); + return 0; + } + exponent = two_complement_to_int(ret & 0x1f, 5, 0x1f); + + debug_print((KERN_DEBUG "PSU_VOUT: VOUT_MODE 0x%X\n",ret)); + debug_print((KERN_DEBUG "PSU_VOUT: exponent 0x%X\n",exponent)); + + return (exponent >= 0) ? sprintf(buf, "%d\n", (mantissa << exponent)*multiplier ) : \ + sprintf(buf, "%d\n", (mantissa*multiplier / (1 << -exponent))); + + /* word data with linear format */ + case PSU_POUT: + case PSU_PIN: + multiplier = 1000000; // lm-sensor unit: uW + case PSU_VIN: + case PSU_IIN: + case PSU_IOUT: + case PSU_TEMPERATURE_1: + case PSU_FAN_SPEED_1: + case PSU_MFR_VIN_MAX: + case PSU_MFR_IOUT_MAX: + + if (attr->index == PSU_FAN_SPEED_1) + multiplier = 1; + + u16_val = ret; + exponent = two_complement_to_int(u16_val >> 11, 5, 0x1f); + mantissa = two_complement_to_int(u16_val & 0x7ff, 11, 0x7ff); + + debug_print((KERN_DEBUG "REG(%d): ret 0x%X, u16_val: 0x%x\n", attr->index, ret, u16_val)); + debug_print((KERN_DEBUG "REG(%d): exponent 0x%X\n", attr->index, exponent)); + debug_print((KERN_DEBUG "REG(%d): mantissa 0x%X\n", attr->index, mantissa)); + + return (exponent >= 0) ? sprintf(buf, "%d\n", (mantissa << exponent)*multiplier ) : \ + sprintf(buf, "%d\n", (mantissa*multiplier / (1 << -exponent))); + + case PSU_EIN: + case PSU_EOUT: { + + u16 m,b; + u8 R; + + u64 ev = buf_block[2]; + u8 rc = buf_block[3]; + u64 sc = buf_block[6]; + u32 sc_mid = buf_block[5]; + u64 average_value = 0; + + struct i2c_client *client = to_i2c_client(dev); + struct zrh2800k2_data *data = i2c_get_clientdata(client); + + if (get_coefficient(dev, &m, &b, &R) < 0) { + return sprintf(buf, "ERROR, fail to get coefficient\n"); + } + + // [ bytecount, energy_count-l, energy_count-h, ROLLOVER_count , + // sample_count-l, sample_count-mid, sample_count-h ] + // maximum_direct_format_value = (m*32767+b)*(10)^R + // energy_value = Rollover_count * maximum_direct_format_value + energy_count + + debug_print((KERN_DEBUG "[ec-l,ec-h,rc,sc-l,sc-,sc-h]: [0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x]\n", buf_block[0], buf_block[1], buf_block[2], + buf_block[3], buf_block[4], buf_block[5], buf_block[6])); + + ev = rc * (m*32767+b)*easy_pow(10,R) + ((ev<<8) + buf_block[1]); + sc = (sc<<16) + (sc_mid<<8) + buf_block[4]; + + if(attr->index == PSU_EIN) { + average_value = ((ev - data->last_energy_value_EIN)*1000) / (sc - data->last_smaple_count_EIN); + data->last_energy_value_EIN = ev; + data->last_smaple_count_EIN = sc; + } else { + average_value = ((ev - data->last_energy_value_EOUT)*1000) / (sc - data->last_smaple_count_EOUT); + data->last_energy_value_EOUT = ev; + data->last_smaple_count_EOUT = sc; + } + return sprintf(buf, "%llu.%llu\n", average_value/1000, average_value%1000); + + } + + case PSU_MFR_ID: + case PSU_MFR_MODEL: + debug_print((KERN_DEBUG "[0x%x,0x%x,0x%x,0x%x,0x%x,0x%x]\n", buf_block[0], buf_block[1], buf_block[2], + buf_block[3], buf_block[4], buf_block[5])); + + ascii = &buf_block[1]; + return sprintf(buf, "%s\n", ascii); + + + case PSU_PMBUS_REVISION: + return sprintf(buf, "Part1 Revision: 1.%d, Part2 Revision: 1.%d\n", + (ret>>5), (ret&0x7) ); + + /* not implement yet */ + default: + return sprintf(buf, "not implement yet\n"); + + } + + /* should not goto here */ + return sprintf(buf, "unknown case\n"); + +} + + +static ssize_t show_capability(struct device *dev, struct device_attribute *da, char *buf) +{ + /* todo */ + return sprintf(buf, "not implement yet\n"); +} + +static ssize_t psu_pm_query(struct device *dev, struct device_attribute *da, char *buf) +{ + /* todo */ + return sprintf(buf, "not implement yet\n"); +} + +static ssize_t psu_coefficient(struct device *dev, struct device_attribute *da, char *buf) +{ + /* todo */ + return sprintf(buf, "not implement yet\n"); +} + +static ssize_t set_fan_config(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct zrh2800k2_data *data = i2c_get_clientdata(client); + + int result; + u8 input_val; + + mutex_lock(&data->update_lock); + + input_val = simple_strtol(buf, NULL, 10); + + result = i2c_smbus_write_byte_data(client, REG_FAN_CONFIG_1_2, input_val); + + mutex_unlock(&data->update_lock); + + if (result < 0) { + printk(KERN_ALERT "ERROR: SET_FAN_CONFIG %s fail\n", buf); + } else { + debug_print((KERN_DEBUG "SET_FAN_CONFIG %s success\n", buf)); + } + + + return count; + +} + + +static const struct i2c_device_id zrh2800k2_id[] = { + { "zrh2800k2", zrh2800k2 }, + { "zrh2ab0k2", zrh2ab0k2 }, + {} +}; + +static struct i2c_driver zrh2800k2_driver = { + .class = I2C_CLASS_HWMON, + .driver = + { + .name = "ZRH2xxxK2", + }, + .probe = zrh2800k2_probe, + .remove = zrh2800k2_remove, + .id_table = zrh2800k2_id, + .address_list = normal_i2c, +}; + +static int zrh2800k2_remove(struct i2c_client *client) +{ + struct zrh2800k2_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &zrh2800k2_group); + kfree(data); + return 0; + +} + +static int zrh2800k2_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + + struct zrh2800k2_data *data; + int status; + + if(!i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_BYTE_DATA | + I2C_FUNC_SMBUS_WORD_DATA)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct zrh2800k2_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &zrh2800k2_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: psu '%s'\n", dev_name(data->hwmon_dev), + client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &zrh2800k2_group); + +exit_free: + kfree(data); + +exit: + return status; + +} + + +module_i2c_driver(zrh2800k2_driver); +MODULE_AUTHOR("Cameo Inc."); +MODULE_DESCRIPTION("Power Supply zrh-2800k2 driver"); +MODULE_LICENSE("GPL"); + diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/scripts/sensors b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/scripts/sensors new file mode 100755 index 0000000000..a30ecd9901 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/scripts/sensors @@ -0,0 +1,8 @@ +#!/bin/bash +docker exec -i pmon sensors "$@" + +#To probe sensors not part of lm-sensors +if [ -r /usr/local/bin/cameo_esc600_sensors.py ]; then + python /usr/local/bin/cameo_esc600_sensors.py fan_status + python /usr/local/bin/cameo_esc600_sensors.py sensor_status +fi diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/scripts/slotcheck b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/scripts/slotcheck new file mode 100755 index 0000000000..ceda19ba3c --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/scripts/slotcheck @@ -0,0 +1,14 @@ +#!/bin/bash + +export SLOT_CHECK_WARNING="/tmp/slotcheckfail" + +if [ -f $SLOT_CHECK_WARNING ]; then + echo -e "\e[31m********************************* WARNING **********************************\e[0m" + echo -e "\e[31m* *\e[0m" + echo -e "\e[31m* The previous port_config.ini does not match with current physical *\e[0m" + echo -e "\e[31m* configuration. A new port_config.ini has been created and PORT_TABLE in *\e[0m" + echo -e "\e[31m* /etc/sonic/config_db.json has been changed to match. *\e[0m" + echo -e "\e[31m* Please modify your /etc/sonic/config_db.json and reload it if needed *\e[0m" + echo -e "\e[31m* *\e[0m" + echo -e "\e[31m****************************************************************************\e[0m" +fi diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/service/esc600-platform-init.service b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/service/esc600-platform-init.service new file mode 100644 index 0000000000..89a4e69900 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/service/esc600-platform-init.service @@ -0,0 +1,14 @@ +[Unit] +Description=Cameo Esc600-128q Platform initialization service +After=local-fs.target innovium_platform_driver.service +Before=pmon.service +Before=updategraph.service + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/cameo_esc600_startup start +ExecStop=/usr/local/bin/cameo_esc600_startup stop +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/service/phy_module_init.service b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/service/phy_module_init.service new file mode 100644 index 0000000000..48b71764eb --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/service/phy_module_init.service @@ -0,0 +1,11 @@ +[Unit] +Description=Cameo PHY module initialization service +After=esc600-platform-init.service + +[Service] +Type=simple +ExecStart=/usr/local/bin/esc600_128q_dynamic_hotswap.sh +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/setup.py b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/setup.py new file mode 100755 index 0000000000..8f07f05e69 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/setup.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python + +import os +from setuptools import setup +os.listdir + +setup( + name='esc600-128q', + version='1.0', + description='Module to initialize Cameo Esc601-128q platforms', + + packages=['esc600-128q'], + package_dir={'esc600-128q': 'esc600-128q/credo_baldeagle/python_wheel'}, + package_data={'esc600-128q': 'esc600-128q/credo_baldeagle/python_wheel/*.pyc'} + ) diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/templates/cameo_esc600_util.py.j2 b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/templates/cameo_esc600_util.py.j2 new file mode 100644 index 0000000000..d83d07f5ac --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/templates/cameo_esc600_util.py.j2 @@ -0,0 +1,411 @@ +#!/usr/bin/env python +# +# Copyright (C) 2019 Cameo Networks, Inc. + + +""" +Usage: %(scriptName)s [options] command object + +options: + -h | --help : this help message + -d | --debug : run with debug mode + -f | --force : ignore error during installation or clean +command: + install : install drivers and generate related sysfs nodes + clean : uninstall drivers and remove related sysfs nodes + show : show all systen status + sff : dump SFP eeprom + set : change board setting with fan|led|sfp +""" + +import os +import commands +import sys, getopt +import logging +import re +import time +import install_slot_driver + +PROJECT_NAME = 'esc600_128q' +version = '0.1.0' +verbose = False +DEBUG = False +args = [] +ALL_DEVICE = {} +DEVICE_NO = {'led': 5, 'fan': 5, 'thermal': 3, 'psu': 4, 'sfp': 128} +FORCE = 0 + +PLATFORM_DRIVER_VER = {{ env("PLATFORM_DRIVER_VER") }} + +if DEBUG == True: + print sys.argv[0] + print 'ARGV :', sys.argv[1:] + + +def main(): + global DEBUG + global args + global FORCE + + if len(sys.argv) < 2: + show_help() + + options, args = getopt.getopt(sys.argv[1:], 'hdf', ['help', + 'debug', + 'force', + ]) + if DEBUG == True: + print options + print args + print len(sys.argv) + + for opt, arg in options: + if opt in ('-h', '--help'): + show_help() + elif opt in ('-d', '--debug'): + DEBUG = True + logging.basicConfig(level=logging.INFO) + elif opt in ('-f', '--force'): + FORCE = 1 + else: + logging.info('no option') + for arg in args: + if arg == 'install': + do_install() + elif arg == 'clean': + do_uninstall() + elif arg == 'show': + device_traversal() + elif arg == 'version': + show_version() + elif arg == 'sff': + if len(args) != 2: + show_eeprom_help() + elif int(args[1]) == 0 or int(args[1]) > DEVICE_NO['sfp']: + show_eeprom_help() + else: + show_eeprom(args[1]) + return + elif arg == 'set': + if len(args) < 3: + show_set_help() + else: + set_device(args[1:]) + return + else: + show_help() + + return 0 + +def show_version(): + print("platform driver version: {}\n".format(PLATFORM_DRIVER_VER)) + +def show_help(): + print __doc__ % {'scriptName': sys.argv[0].split("/")[-1]} + sys.exit(0) + + +def show_set_help(): + cmd = sys.argv[0].split("/")[-1] + " " + args[0] + print cmd + " [led|sfp|fan]" + print " use \"" + cmd + " led 0-4 \" to set led color" + print " use \"" + cmd + " fan 0-100\" to set fan duty percetage" + print " use \"" + cmd + " sfp 1-54 {0|1}\" to set sfp# tx_disable" + sys.exit(0) + + +def show_eeprom_help(): + cmd = sys.argv[0].split("/")[-1] + " " + args[0] + print " use \"" + cmd + " 1-54 \" to dump sfp# eeprom" + sys.exit(0) + + +def my_log(txt): + if DEBUG == True: + print "[ROY]" + txt + return + + +def log_os_system(cmd, show): + logging.info('Run :' + cmd) + status, output = commands.getstatusoutput(cmd) + my_log(cmd + "with result:" + str(status)) + my_log(" output:" + output) + if status: + logging.info('Failed :' + cmd) + if show: + print('Failed :' + cmd) + return status, output + + +def driver_check(): + ret, lsmod = log_os_system("lsmod| grep cameo", 0) + logging.info('mods:' + lsmod) + if len(lsmod) == 0: + return False + return True + + +kos = [ + 'depmod -a', + 'modprobe i2c_dev', + 'modprobe x86-64-cameo-esc600-128q', + 'modprobe i2c_mux_pca954x force_deselect_on_exit=1', + 'modprobe lscpcie2', + 'modprobe nct7511', + 'modprobe mcp3425_smbus', + 'modprobe at24_smbus', + 'modprobe at24', + 'modprobe zrh2800k2' +] + + +def driver_install(): + global FORCE + for i in range(0, len(kos)): + status, output = log_os_system(kos[i], 1) + if status: + if FORCE == 0: + return status + return 0 + + +def driver_uninstall(): + global FORCE + for i in range(0, len(kos)): + rm = kos[-(i + 1)].replace("modprobe", "modprobe -rq") + rm = rm.replace("insmod", "rmmod") + rm = rm.replace("force_deselect_on_exit=1", " ") + status, output = log_os_system(rm, 1) + if status: + if FORCE == 0: + return status + return 0 + + +i2c_prefix = '/sys/bus/i2c/devices/' + +# used when bmc exist +mknod_bmc = [ + # enable port led stream + 'echo 1 > /sys/class/hwmon/hwmon2/device/ESC600_LED/led_ctrl', + # sys eeprom + 'echo 24c64smbus 0x56 > /sys/bus/i2c/devices/i2c-0/new_device', + # 0x73, connects QSFP (i2c-1 ~ i2c-8) + 'echo pca9548 0x73 > /sys/bus/i2c/devices/i2c-0/new_device' +] + +mknod_without_bmc = [ + # enable port led stream + 'echo 1 > /sys/class/hwmon/hwmon2/device/ESC600_LED/led_ctrl', + # sys eeprom + 'echo 24c64smbus 0x56 > /sys/bus/i2c/devices/i2c-0/new_device', + # 0x73, connects QSFP (i2c-1 ~ i2c-8) + 'echo pca9548 0x73 > /sys/bus/i2c/devices/i2c-0/new_device', + # 0x77 channel 0 - 7 (i2c-9 ~ i2c-16) + 'echo pca9548 0x77 > /sys/bus/i2c/devices/i2c-0/new_device', + # 0x75 channel 0 - 7 (i2c-17 ~ i2c-24) + 'echo pca9548 0x75 > /sys/bus/i2c/devices/i2c-0/new_device', + # 0x74 channel 0 - 7 (i2c-25 ~ i2c-32) + 'echo pca9548 0x74 > /sys/bus/i2c/devices/i2c-0/new_device', + + # 0x75 -> NCT7511Y sensor & fan control + 'echo nct7511 0x2e > /sys/bus/i2c/devices/i2c-17/new_device', + # 0x75 -> G781 sensors + 'echo g781 0x4c > /sys/bus/i2c/devices/i2c-18/new_device', + 'echo g781 0x4c > /sys/bus/i2c/devices/i2c-19/new_device', + 'echo g781 0x4c > /sys/bus/i2c/devices/i2c-20/new_device', + 'echo g781 0x4c > /sys/bus/i2c/devices/i2c-22/new_device', + 'echo g781 0x4c > /sys/bus/i2c/devices/i2c-23/new_device', + # 0x75 -> zrh2800k2 psu + 'echo zrh2800k2 0x58 > /sys/bus/i2c/devices/i2c-21/new_device', + 'echo zrh2800k2 0x59 > /sys/bus/i2c/devices/i2c-21/new_device', + 'echo zrh2800k2 0x5A > /sys/bus/i2c/devices/i2c-21/new_device', + 'echo zrh2800k2 0x5B > /sys/bus/i2c/devices/i2c-21/new_device', + # 0x74 -> G781 sensors + 'echo g781 0x4c > /sys/bus/i2c/devices/i2c-25/new_device', + 'echo g781 0x4c > /sys/bus/i2c/devices/i2c-26/new_device', + 'echo g781 0x4c > /sys/bus/i2c/devices/i2c-27/new_device', + # 0x74 -> mcp3425 sensor + 'echo mcp3425_smbus 0x68 > /sys/bus/i2c/devices/i2c-28/new_device', + # 0x74 -> tps53681 + 'echo tps53679 0x6E > /sys/bus/i2c/devices/i2c-30/new_device', + 'echo tps53679 0x70 > /sys/bus/i2c/devices/i2c-30/new_device', + # 0x74 -> powr1014 + 'echo powr1014 0x04 > /sys/bus/i2c/devices/i2c-31/new_device' +] + +def get_attr_value(attr_path): + retval = 'ERR' + if not os.path.isfile(attr_path): + return retval + + try: + with open(attr_path, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", attr_path, " file !") + + retval = retval.rstrip('\r\n') + fd.close() + return retval + +def bmc_is_exist(): + value = '' + bmc_filePath = '/sys/class/hwmon/hwmon2/device/ESC600_SYS/bmc_present' + if os.path.exists(bmc_filePath): + value = get_attr_value(bmc_filePath) + if value.find('not') < 0: + return True + else: + return False + else: + return False + +def device_install(): + global FORCE + bmc_exist = False + + if bmc_is_exist(): + mknod = mknod_bmc + bmc_exist = True + else: + mknod = mknod_without_bmc + + for i in range(0, len(mknod)): + # for pca954x need times to built new i2c buses + if mknod[i].find('pca954') != -1: + time.sleep(1) + + status, output = log_os_system(mknod[i], 1) + if status: + print output + if FORCE == 0: + return status + + # for pca954x need times to built new i2c buses + time.sleep(2) + install_slot_driver.remove_card_devices(bmc_exist) + install_slot_driver.install_card_devices(bmc_exist) + + return + + +def device_uninstall(): + global FORCE + bmc_exist = False + + if bmc_is_exist(): + nodelist = mknod_bmc + bmc_exist = True + else: + nodelist = mknod_without_bmc + + install_slot_driver.remove_card_devices(bmc_exist) + + for i in range(len(nodelist)): + target = nodelist[-(i + 1)] + temp = target.split() + del temp[1] + temp[-1] = temp[-1].replace('new_device', 'delete_device') + status, output = log_os_system(" ".join(temp), 1) + if status: + print output + if FORCE == 0: + return status + + return + + +def system_ready(): + if driver_check() == False: + return False + if not device_exist(): + return False + return True + + +def do_install(): + print "Checking system...." + if driver_check() == False: + print "No driver, installing...." + status = driver_install() + if status: + if FORCE == 0: + return status + else: + print PROJECT_NAME.upper() + " drivers detected...." + if not device_exist(): + print "No device, installing...." + status = device_install() + if status: + if FORCE == 0: + return status + else: + print PROJECT_NAME.upper() + " devices detected...." + return + + +def do_uninstall(): + print "Checking system...." + if not device_exist(): + print PROJECT_NAME.upper() + " has no device installed...." + else: + print "Removing device...." + status = device_uninstall() + if status: + if FORCE == 0: + return status + + if driver_check() == False: + print PROJECT_NAME.upper() + " has no driver installed...." + else: + print "Removing installed driver...." + status = driver_uninstall() + if status: + if FORCE == 0: + return status + + return + + +def devices_info(): + return + + +def show_eeprom(index): + return + + +def set_device(args): + return + + +# get digits inside a string. +# Ex: 31 for "sfp31" +def get_value(input): + digit = re.findall('\d+', input) + return int(digit[0]) + + +def device_traversal(): + attr_path = '/sys/class/hwmon/hwmon2/device/ESC600_Sensor/sensor_temp' + try: + reg_file = open(attr_path, 'r') + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + print("Thermal sensors(1-4) temperature:\n") + for line in reg_file.readlines(): + print line + reg_file.close() + return + + +def device_exist(): + ret1, log = log_os_system("ls " + i2c_prefix + "*0056", 0) + return not ret1 + + +if __name__ == "__main__": + main() diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/README b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/README new file mode 100755 index 0000000000..70b8653bc9 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/README @@ -0,0 +1,2 @@ +Copyright (C) 2019 Cameo Networks, Inc. + diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/cameo_esc600_sensors.py b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/cameo_esc600_sensors.py new file mode 100755 index 0000000000..319f350df9 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/cameo_esc600_sensors.py @@ -0,0 +1,286 @@ +#!/usr/bin/python + +from __future__ import print_function +import os +import sys +import logging + +FAN_NUM = 5 +MAX_PSU_NUM = 4 + +fans_path = '/sys/class/hwmon/hwmon2/device/ESC600_FAN/' +sensors_path = '/sys/class/hwmon/hwmon2/device/ESC600_Sensor/' +cameo_psu_path = '/sys/class/hwmon/hwmon2/device/ESC600_PSU/' + +psu_path = [ '/sys/bus/i2c/devices/21-0058/', + '/sys/bus/i2c/devices/21-0059/', + '/sys/bus/i2c/devices/21-005a/', + '/sys/bus/i2c/devices/21-005b/'] + +# Get sysfs attribute +def get_attr_value(attr_path): + retval = 'ERR' + if not os.path.isfile(attr_path): + return retval + + try: + with open(attr_path, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", attr_path, " file !") + + retval = retval.rstrip('\r\n') + fd.close() + return retval + +def bmc_is_exist(): + value = '' + bmc_filePath = '/sys/class/hwmon/hwmon2/device/ESC600_SYS/bmc_present' + if os.path.exists(bmc_filePath): + value = get_attr_value(bmc_filePath) + if value.find('not') < 0: + return True + else: + return False + else: + return False + +def calc_mac_temp(): + value = '' + try: + if bmc_is_exist(): + mac_temp_string = get_attr_value(sensors_path+'mac_temp').split(' ') + value = int(mac_temp_string[-1], 16) + mac_sensor= (((value&0xFF)<<8)|((value&0xFF00)>>8)) /1000.0 + else: + raw = get_attr_value('/sys/bus/i2c/devices/28-0068/iio:device0/in_voltage0_raw') + scale = get_attr_value('/sys/bus/i2c/devices/28-0068/iio:device0/in_voltage0_scale') + mac_sensor= int(raw,10)*float(scale) + except Exception as e: + print("Failed to get MAC sensor temp: {}".format(e.args[0])) + return 0 + + temp1 = -124.28 * mac_sensor * mac_sensor + temp2 = -422.03 * mac_sensor + temp_sensor = 384.62 + temp1 + temp2 + return round(temp_sensor,2) + +def print_attr_value_lines(sys_path): + retval = 'ERR' + if not os.path.isfile(sys_path): + return retval + try: + fo = open(sys_path, "r") + except Exception as error: + logging.error("Unable to open ", sys_path, " file !") + for line in fo.readlines(): + line = line.strip() + print (" %s" % line) + fo.close() + return retval + +def get_fan_alert(number): + return + +def get_fan_inner_rpm(number): + return + +def get_fan_outer_rpm(number): + return + +def sensors_status(): + print ('SENSOR STATUS:') + if bmc_is_exist(): + sys_path = sensors_path + 'sensor_status' + print_attr_value_lines(sys_path) + + return + +def sensors_temp(): + print ('SENSOR TEMPERATURE:') + print (' MAC sensor temp:%.2f degrees (C)'% calc_mac_temp()) + + if bmc_is_exist(): + sys_path = sensors_path + 'sensor_temp' + print_attr_value_lines(sys_path) + sys_path = sensors_path + 'module_temp' + print_attr_value_lines(sys_path) + + return + +def get_voltage(): + return + +def fan_status(): + sys_path = fans_path + 'fan_status' + print ('FAN STATUS:') + print_attr_value_lines(sys_path) + return + +def fan_present(): + sys_path = fans_path + 'fan_insert' + print ('FAN PRESENT:') + print_attr_value_lines(sys_path) + return + +def fan_power(): + sys_path = fans_path + 'fan_power' + print ('FAN POWER:') + print_attr_value_lines(sys_path) + return + +def fan_speed(): + sys_path = fans_path + 'fan_speed_rpm' + print ('FAN SPEED:') + print_attr_value_lines(sys_path) + return + + +def is_psu_present(psu_number): + sys_path = cameo_psu_path + 'psu_present' + search_str = "PSU {} is present".format(psu_number) + if os.path.exists(sys_path): + value = get_attr_value(sys_path) + if search_str in value: + return True + else: + return False + + return False + +def show_psu_status(path): + # [model, vin, vout, fan_speed, temperature, pin, pout, iin, iout, max_iout] + result_list = [0]*10 + if bmc_is_exist(): + try: + reg_file = open(path, 'r') + except IOError as e: + print( "Error: unable to open file: %s" % str(e)) + return False + + text_lines = reg_file.readlines() + reg_file.close() + + for line in text_lines: + spline = line.split(' ') + if "MFR_MODEL" in spline: + result_list[0] = spline[-1] + if "VIN" in spline: + result_list[1] = spline[-1] + if "VOUT" in spline: + result_list[2] = spline[-1] + if "FAN_SPEED" in spline: + result_list[3] = spline[-1] + if "TEMP_1" in spline: + result_list[4] = spline[-1] + if "PIN" in spline: + result_list[5] = spline[-1] + if "POUT" in spline: + result_list[6] = spline[-1] + if "IIN" in spline: + result_list[7] = spline[-1] + if "IOUT" in spline: + result_list[8] = spline[-1] + if "MFR_IOUT_MAX" in spline: + result_list[9] = spline[-1] + + else: + result_list[0] = get_attr_value(path+"psu_mfr_model") + result_list[1] = get_attr_value(path+"psu_vin") + result_list[2] = get_attr_value(path+"psu_vout") + result_list[3] = get_attr_value(path+"psu_fan_speed_1") + result_list[4] = get_attr_value(path+"psu_temp_1") + result_list[5] = get_attr_value(path+"psu_pin") + result_list[6] = get_attr_value(path+"psu_pout") + result_list[7] = get_attr_value(path+"psu_iin") + result_list[8] = get_attr_value(path+"psu_iout") + result_list[9] = get_attr_value(path+"psu_iout_max") + if result_list[0] != 'ERR': + print (' model: {}'.format(result_list[0])) + + if result_list[1] != 'ERR': + vin = int(result_list[1])/1000.0 + print (' Input Voltage: {:+3.2f} V'.format(vin)) + + if result_list[2] != 'ERR': + vout = int(result_list[2])/1000.0 + print (' Output Voltage: {:+3.2f} V'.format(vout)) + + if result_list[3] != 'ERR': + fan_speed = int(result_list[3]) + print (' Fan Speed: {:3d} RPM'.format(fan_speed)) + + if result_list[4] != 'ERR': + temperature = int(result_list[4])/1000.0 + print (' Temperature: {:+3.1f} C'.format(temperature)) + + if result_list[5] != 'ERR': + pin = int(result_list[5])/1000000.0 + print (' Input Power: {:3.2f} W'.format(pin)) + + if result_list[6] != 'ERR': + pout = int(result_list[6])/1000000.0 + print (' Output Power: {:3.2f} W'.format(pout)) + + if result_list[7] != 'ERR': + iin = int(result_list[7])/1000.0 + print (' Input Current: {:+3.2f} A'.format(iin)) + + if result_list[8] != 'ERR': + iout = int(result_list[8])/1000.0 + print (' Output Current: {:+3.2f} A'.format(iout),end='') + + if result_list[9] != 'ERR': + max_iout = int(result_list[9])/1000.0 + print (' (max = {:+3.2f} A)'.format(max_iout)) + + print('') + return + + +def show_psu_status_bmc(path): + print_attr_value_lines(path) + return + + +def psu_status(): + + for x in range(0,MAX_PSU_NUM): + if is_psu_present(x+1): + print("PSU{} present".format(x+1)) + if bmc_is_exist(): + show_psu_status(cameo_psu_path + 'psu_module_{}'.format(x+1)) + else: + show_psu_status(psu_path[x]) + + return + + +def main(): + """ + Usage: %(scriptName)s command object + + command: + fan_status : display fans status(present/power good) + """ + + if len(sys.argv)<2: + print (main.__doc__) + + for arg in sys.argv[1:]: + if arg == 'fan_status': + fan_status() + fan_present() + fan_power() + fan_speed() + elif arg == 'sensor_status': + sensors_temp() + sensors_status() + psu_status() + + + else: + print (main.__doc__) + +if __name__ == "__main__": + main() diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/cameo_esc600_startup b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/cameo_esc600_startup new file mode 100755 index 0000000000..abab3fc71b --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/cameo_esc600_startup @@ -0,0 +1,82 @@ +#!/bin/bash + +export HW_CFG_PATH=/usr/share/sonic/device/x86_64-cameo_esc600_128q-r0/esc600-128q + + +start() { + # Install esc600-128q python package + DEVICE="/usr/share/sonic/device" + PLATFORM=$(/usr/local/bin/sonic-cfggen -H -v DEVICE_METADATA.localhost.platform) + + if [ -e $DEVICE/$PLATFORM/sonic_platform-1.0-py2-none-any.whl ]; then + pip install $DEVICE/$PLATFORM/sonic_platform-1.0-py2-none-any.whl + fi + + # load platform driver, native drivers + /usr/local/bin/cameo_esc600_util.py install + + # compare physical configuration with port_cfg.ini + /usr/local/bin/esc600_128q_slot_check.py + check_result=$? + + # check if the old configs exists for firsttime boot + # rc.local-service create the temporary file that cause + # updategraph.service to configure sonic with old_config/* . + # In this case, we aim on old_config/config_db.json, + # we do not support the old configuration from minigraph + if [ -e /tmp/pending_config_migration ]; then + echo "firsttime boot with old_config" + /usr/local/bin/esc600_128q_autoconfig + cp /etc/esc600_autoconfig/config_128x100G_Cameo-esc600-128q.yaml $HW_CFG_PATH/config_128x100G_Cameo-esc600-128q.yaml + cp /etc/esc600_autoconfig/port_config.ini $HW_CFG_PATH/port_config.ini + + + if [ -e /etc/sonic/old_config/config_db.json ]; then + /usr/local/bin/esc600_128q_fullportcfg /etc/esc600_autoconfig/config_db.json /etc/sonic/old_config/config_db.json + portcfg_result=$? + if [ $portcfg_result -eq 0 ]; then + mv /etc/sonic/old_config/config_db.json /etc/sonic/old_config/config_db.json.bk + cp /etc/esc600_autoconfig/config_db.json /etc/sonic/old_config/config_db.json + fi + fi + # Within firsttime reboot + # rc.local-service create the temporary file that cause + # updategraph.service to configure sonic by hw_sku's default one + # we can just generate the two default files then updategraph.service will handle it. + elif [ -e /tmp/pending_config_initialization ]; then + echo "firsttime boot with default hw_sku" + /usr/local/bin/esc600_128q_autoconfig + cp /etc/esc600_autoconfig/config_128x100G_Cameo-esc600-128q.yaml $HW_CFG_PATH/config_128x100G_Cameo-esc600-128q.yaml + cp /etc/esc600_autoconfig/port_config.ini $HW_CFG_PATH/port_config.ini + else + echo "normal reboot" + # handle normal reboot, different configuration checked + # generate new confgurations to match the current phyical configuration + if [ $check_result -eq 2 ]; then + echo "difference of port configuration founded..." + echo "start autoconfig process..." + /usr/local/bin/esc600_128q_autoconfig + cp /etc/esc600_autoconfig/config_128x100G_Cameo-esc600-128q.yaml $HW_CFG_PATH/config_128x100G_Cameo-esc600-128q.yaml + cp /etc/esc600_autoconfig/port_config.ini $HW_CFG_PATH/port_config.ini + /usr/local/bin/esc600_128q_fullportcfg /etc/esc600_autoconfig/config_db.json /etc/sonic/config_db.json + portcfg_result=$? + if [ $portcfg_result -eq 0 ]; then + mv /etc/sonic/config_db.json /etc/sonic/config_db.json.bk + cp /etc/esc600_autoconfig/config_db.json /etc/sonic/config_db.json + fi + fi + fi + + # do phy module init - move to phy_module_init.service + #/usr/local/bin/esc600_128q_init_phymodule +} + +stop() { + /usr/local/bin/cameo_esc600_util.py clean +} + + +case $1 in + start|stop) "$1" ;; +esac + diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/coldreboot b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/coldreboot new file mode 100755 index 0000000000..9740433f8b --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/coldreboot @@ -0,0 +1,9 @@ +#!/bin/sh +NOKEXECFILE=/no-kexec-reboot + +/bin/rm -f $NOKEXECFILE +touch $NOKEXECFILE + +rmmod x86-64-cameo-esc600-128q +i2cset -y 0 0x30 0xa1 0 + diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/esc600_128q_autoconfig b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/esc600_128q_autoconfig new file mode 100755 index 0000000000..99f24296c7 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/esc600_128q_autoconfig @@ -0,0 +1,477 @@ +#!/usr/bin/python +# -*- coding: UTF-8 -*- +# Filename : esc600_128q_autoconfig.py + +import os +CAMEO_HWSKU_PATH='/usr/share/sonic/device/x86_64-cameo_esc600_128q-r0/esc600-128q' +AUTOCONFIG_FILE_PATH='/etc/esc600_autoconfig' +CAMEO_INNO_CFG=AUTOCONFIG_FILE_PATH+'/config_128x100G_Cameo-esc600-128q.yaml' +CAMEO_PORT_CFG=AUTOCONFIG_FILE_PATH+'/port_config.ini' + +if not os.path.exists(AUTOCONFIG_FILE_PATH): + os.mkdir(AUTOCONFIG_FILE_PATH) + print "Create %s." %AUTOCONFIG_FILE_PATH +else: + print "%s already exists." %AUTOCONFIG_FILE_PATH + +f = open(CAMEO_INNO_CFG,'w') +f2 = open(CAMEO_PORT_CFG,'w') + +def print_first(): + f.write('ifcs: \n') + f.write(' options: \n') + f.write(' log_level: \"info\" \n') + f.write('nodes: \n') + f.write('- node_id: \"0\" \n') + f.write(' options: \n') + f.write(' sku: \"configs/sku/innovium.77700_A\" \n') + f.write(' netdev: \n') + f.write(' - auto_create: "no" \n') + f.write(' multi_interface: "yes" \n') + f.write(' buffer_management_mode: "api_driven" \n') + f.write(' max_lossless_tc: "2" \n') + #f.write(' wred_cr_ip_proto_list: "17" \n') + f.write(' mac_clk: \"1340\" \n') + f.write(' sys_clk: \"1720\" \n') + f.write(' ifc_clk: \"1200\" \n') + f.write(' txring: \n') + f.write(' - txring_id: \"0\" \n') + f.write(' desc_count: \"1024\" \n') + f.write(' prio: \"1\" \n') + f.write(' netdev: \"true\" \n') + f.write(' - txring_id: \"1\" \n') + f.write(' desc_count: \"1024\" \n') + f.write(' prio: \"1\" \n') + f.write(' netdev: \"true\" \n') + f.write(' - txring_id: \"2\" \n') + f.write(' desc_count: \"1024\" \n') + f.write(' prio: \"1\" \n') + f.write(' netdev: \"true\" \n') + f.write(' - txring_id: \"3\" \n') + f.write(' desc_count: \"1024\" \n') + f.write(' prio: \"1\" \n') + f.write(' netdev: \"true\" \n') + f.write(' rxring: \n') + f.write(' - rxring_id: \"0\" \n') + f.write(' desc_count: \"1024\" \n') + f.write(' prio: \"1\" \n') + f.write(' netdev: \"true\" \n') + f.write(' queues: \"0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44\" \n') + f.write(' - rxring_id: \"1\" \n') + f.write(' desc_count: \"1024\" \n') + f.write(' prio: \"1\" \n') + f.write(' netdev: \"true\" \n') + f.write(' queues: \"1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45\" \n') + f.write(' - rxring_id: \"2\" \n') + f.write(' desc_count: \"1024\" \n') + f.write(' prio: \"1\" \n') + f.write(' netdev: \"true\" \n') + f.write(' queues: \"2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46\" \n') + f.write(' - rxring_id: \"3\" \n') + f.write(' desc_count: \"1024\" \n') + f.write(' prio: \"1\" \n') + f.write(' netdev: \"true\" \n') + f.write(' queues: \"3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47\" \n') + f.write(' devports: \n') + f.write(' - id: \"0\" \n') + f.write(' sysport: \"1000\" \n') + f.write(' type: \"cpu\" \n') + f2.write('# name lanes alias speed index mtu fec\n') + +def print_end(): + f.write(' isg: \n') + f.write(' - id: \"0\" \n') + f.write(' tx_polarity: \"01110011\" \n') + f.write(' rx_polarity: \"01100111\" \n') + f.write(' lane_swap: \"71635420\" \n') + f.write(' pre1: \"4, 4, 4, 4, 4, 4, 4, 4\"\n') + f.write(' pre2: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' pre3: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' attn: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' post: \"8, 8, 8, 8, 8, 8, 8, 8\"\n') + f.write(' - id: \"1\" \n') + f.write(' tx_polarity: \"00111011\" \n') + f.write(' rx_polarity: \"01100111\" \n') + f.write(' lane_swap: \"71635420\" \n') + f.write(' pre1: \"4, 4, 4, 4, 4, 4, 4, 4\"\n') + f.write(' pre2: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' pre3: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' attn: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' post: \"8, 8, 8, 8, 8, 8, 8, 8\"\n') + f.write(' - id: \"2\" \n') + f.write(' tx_polarity: \"01100011\" \n') + f.write(' rx_polarity: \"10100111\" \n') + f.write(' lane_swap: \"71634520\" \n') + f.write(' pre1: \"4, 4, 4, 4, 4, 4, 4, 4\"\n') + f.write(' pre2: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' pre3: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' attn: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' post: \"8, 8, 8, 8, 8, 8, 8, 8\"\n') + f.write(' - id: \"3\" \n') + f.write(' tx_polarity: \"01111011\" \n') + f.write(' rx_polarity: \"00111000\" \n') + f.write(' lane_swap: \"73614520\" \n') + f.write(' pre1: \"4, 4, 4, 4, 4, 4, 4, 4\"\n') + f.write(' pre2: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' pre3: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' attn: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' post: \"8, 8, 8, 8, 8, 8, 8, 8\"\n') + f.write(' - id: \"4\" \n') + f.write(' tx_polarity: \"01100011\" \n') + f.write(' rx_polarity: \"01100000\" \n') + f.write(' lane_swap: \"71634520\" \n') + f.write(' pre1: \"4, 4, 4, 4, 4, 4, 4, 4\"\n') + f.write(' pre2: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' pre3: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' attn: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' post: \"8, 8, 8, 8, 8, 8, 8, 8\"\n') + f.write(' - id: \"5\" \n') + f.write(' tx_polarity: \"00101011\" \n') + f.write(' rx_polarity: \"01000111\" \n') + f.write(' lane_swap: \"71635420\" \n') + f.write(' pre1: \"4, 4, 4, 4, 4, 4, 4, 4\"\n') + f.write(' pre2: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' pre3: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' attn: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' post: \"8, 8, 8, 8, 8, 8, 8, 8\"\n') + f.write(' - id: \"6\" \n') + f.write(' tx_polarity: \"01110011\" \n') + f.write(' rx_polarity: \"10000001\" \n') + f.write(' lane_swap: \"71634520\" \n') + f.write(' pre1: \"4, 4, 4, 4, 4, 4, 4, 4\"\n') + f.write(' pre2: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' pre3: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' attn: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' post: \"8, 8, 8, 8, 8, 8, 8, 8\"\n') + f.write(' - id: \"7\" \n') + f.write(' tx_polarity: \"01101111\" \n') + f.write(' rx_polarity: \"00011100\" \n') + f.write(' lane_swap: \"71324065\" \n') + f.write(' pre1: \"4, 4, 4, 4, 4, 4, 4, 4\"\n') + f.write(' pre2: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' pre3: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' attn: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' post: \"8, 8, 8, 8, 8, 8, 8, 8\"\n') + f.write(' - id: \"8\" \n') + f.write(' tx_polarity: \"00000001\" \n') + f.write(' rx_polarity: \"11000001\" \n') + f.write(' lane_swap: \"71635420\" \n') + f.write(' pre1: \"4, 4, 4, 4, 4, 4, 4, 4\"\n') + f.write(' pre2: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' pre3: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' attn: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' post: \"8, 8, 8, 8, 8, 8, 8, 8\"\n') + f.write(' - id: \"9\" \n') + f.write(' tx_polarity: \"01001001\" \n') + f.write(' rx_polarity: \"01000101\" \n') + f.write(' lane_swap: \"71635420\" \n') + f.write(' pre1: \"4, 4, 4, 4, 4, 4, 4, 4\"\n') + f.write(' pre2: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' pre3: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' attn: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' post: \"8, 8, 8, 8, 8, 8, 8, 8\"\n') + f.write(' - id: \"10\" \n') + f.write(' tx_polarity: \"01000001\" \n') + f.write(' rx_polarity: \"10000001\" \n') + f.write(' lane_swap: \"71634520\" \n') + f.write(' pre1: \"4, 4, 4, 4, 4, 4, 4, 4\"\n') + f.write(' pre2: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' pre3: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' attn: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' post: \"8, 8, 8, 8, 8, 8, 8, 8\"\n') + f.write(' - id: \"11\" \n') + f.write(' tx_polarity: \"00001101\" \n') + f.write(' rx_polarity: \"01001101\" \n') + f.write(' lane_swap: \"03215467\" \n') + f.write(' pre1: \"4, 4, 4, 4, 4, 4, 4, 4\"\n') + f.write(' pre2: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' pre3: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' attn: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' post: \"8, 8, 8, 8, 8, 8, 8, 8\"\n') + f.write(' - id: \"12\" \n') + f.write(' tx_polarity: \"00000001\" \n') + f.write(' rx_polarity: \"00100001\" \n') + f.write(' lane_swap: \"71635420\" \n') + f.write(' pre1: \"4, 4, 4, 4, 4, 4, 4, 4\"\n') + f.write(' pre2: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' pre3: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' attn: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' post: \"8, 8, 8, 8, 8, 8, 8, 8\"\n') + f.write(' - id: \"13\" \n') + f.write(' tx_polarity: \"00000101\" \n') + f.write(' rx_polarity: \"00101011\" \n') + f.write(' lane_swap: \"71634520\" \n') + f.write(' pre1: \"4, 4, 4, 4, 4, 4, 4, 4\"\n') + f.write(' pre2: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' pre3: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' attn: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' post: \"8, 8, 8, 8, 8, 8, 8, 8\"\n') + f.write(' - id: \"14\" \n') + f.write(' tx_polarity: \"00000001\" \n') + f.write(' rx_polarity: \"10101001\" \n') + f.write(' lane_swap: \"71634520\" \n') + f.write(' pre1: \"4, 4, 4, 4, 4, 4, 4, 4\"\n') + f.write(' pre2: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' pre3: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' attn: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' post: \"8, 8, 8, 8, 8, 8, 8, 8\"\n') + f.write(' - id: \"15\" \n') + f.write(' tx_polarity: \"00001101\" \n') + f.write(' rx_polarity: \"00001100\" \n') + f.write(' lane_swap: \"01235467\" \n') + f.write(' pre1: \"4, 4, 4, 4, 4, 4, 4, 4\"\n') + f.write(' pre2: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' pre3: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' attn: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' post: \"8, 8, 8, 8, 8, 8, 8, 8\"\n') + f.write(' - id: \"16\" \n') + f.write(' tx_polarity: \"00000001\" \n') + f.write(' rx_polarity: \"10100011\" \n') + f.write(' lane_swap: \"71635420\" \n') + f.write(' pre1: \"4, 4, 4, 4, 4, 4, 4, 4\"\n') + f.write(' pre2: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' pre3: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' attn: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' post: \"8, 8, 8, 8, 8, 8, 8, 8\"\n') + f.write(' - id: \"17\" \n') + f.write(' tx_polarity: \"01000101\" \n') + f.write(' rx_polarity: \"00101011\" \n') + f.write(' lane_swap: \"71634520\" \n') + f.write(' pre1: \"4, 4, 4, 4, 4, 4, 4, 4\"\n') + f.write(' pre2: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' pre3: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' attn: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' post: \"8, 8, 8, 8, 8, 8, 8, 8\"\n') + f.write(' - id: \"18\" \n') + f.write(' tx_polarity: \"01000000\" \n') + f.write(' rx_polarity: \"10100011\" \n') + f.write(' lane_swap: \"71634520\" \n') + f.write(' pre1: \"4, 4, 4, 4, 4, 4, 4, 4\"\n') + f.write(' pre2: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' pre3: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' attn: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' post: \"8, 8, 8, 8, 8, 8, 8, 8\"\n') + f.write(' - id: \"19\" \n') + f.write(' tx_polarity: \"00110111\" \n') + f.write(' rx_polarity: \"01010110\" \n') + f.write(' lane_swap: \"01235467\" \n') + f.write(' pre1: \"4, 4, 4, 4, 4, 4, 4, 4\"\n') + f.write(' pre2: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' pre3: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' attn: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' post: \"8, 8, 8, 8, 8, 8, 8, 8\"\n') + f.write(' - id: \"20\" \n') + f.write(' tx_polarity: \"01100101\" \n') + f.write(' rx_polarity: \"01001011\" \n') + f.write(' lane_swap: \"71635420\" \n') + f.write(' pre1: \"4, 4, 4, 4, 4, 4, 4, 4\"\n') + f.write(' pre2: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' pre3: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' attn: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' post: \"6, 6, 6, 6, 6, 6, 6, 6\"\n') + f.write(' - id: \"21\" \n') + f.write(' tx_polarity: \"10111011\" \n') + f.write(' rx_polarity: \"10101110\" \n') + f.write(' lane_swap: \"71635420\" \n') + f.write(' pre1: \"4, 4, 4, 4, 4, 4, 4, 4\"\n') + f.write(' pre2: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' pre3: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' attn: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' post: \"6, 6, 6, 6, 6, 6, 6, 6\"\n') + f.write(' - id: \"22\" \n') + f.write(' tx_polarity: \"01110011\" \n') + f.write(' rx_polarity: \"01101011\" \n') + f.write(' lane_swap: \"71634520\" \n') + f.write(' pre1: \"4, 4, 4, 4, 4, 4, 4, 4\"\n') + f.write(' pre2: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' pre3: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' attn: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' post: \"6, 6, 6, 6, 6, 6, 6, 6\"\n') + f.write(' - id: \"23\" \n') + f.write(' tx_polarity: \"01110011\" \n') + f.write(' rx_polarity: \"01011000\" \n') + f.write(' lane_swap: \"01235467\" \n') + f.write(' pre1: \"4, 4, 4, 4, 4, 4, 4, 4\"\n') + f.write(' pre2: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' pre3: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' attn: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' post: \"6, 6, 6, 6, 6, 6, 6, 6\"\n') + f.write(' - id: \"24\" \n') + f.write(' tx_polarity: \"01110011\" \n') + f.write(' rx_polarity: \"11100111\" \n') + f.write(' lane_swap: \"71635420\" \n') + f.write(' pre1: \"4, 4, 4, 4, 4, 4, 4, 4\"\n') + f.write(' pre2: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' pre3: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' attn: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' post: \"6, 6, 6, 6, 6, 6, 6, 6\"\n') + f.write(' - id: \"25\" \n') + f.write(' tx_polarity: \"00101011\" \n') + f.write(' rx_polarity: \"01100111\" \n') + f.write(' lane_swap: \"71635420\" \n') + f.write(' pre1: \"4, 4, 4, 4, 4, 4, 4, 4\"\n') + f.write(' pre2: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' pre3: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' attn: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' post: \"6, 6, 6, 6, 6, 6, 6, 6\"\n') + f.write(' - id: \"26\" \n') + f.write(' tx_polarity: \"01110011\" \n') + f.write(' rx_polarity: \"10100111\" \n') + f.write(' lane_swap: \"71634520\" \n') + f.write(' pre1: \"4, 4, 4, 4, 4, 4, 4, 4\"\n') + f.write(' pre2: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' pre3: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' attn: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' post: \"6, 6, 6, 6, 6, 6, 6, 6\"\n') + f.write(' - id: \"27\" \n') + f.write(' tx_polarity: \"01000111\" \n') + f.write(' rx_polarity: \"00011101\" \n') + f.write(' lane_swap: \"01235467\" \n') + f.write(' pre1: \"4, 4, 4, 4, 4, 4, 4, 4\"\n') + f.write(' pre2: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' pre3: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' attn: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' post: \"6, 6, 6, 6, 6, 6, 6, 6\"\n') + f.write(' - id: \"28\" \n') + f.write(' tx_polarity: \"01100011\" \n') + f.write(' rx_polarity: \"11111101\" \n') + f.write(' lane_swap: \"71634520\" \n') + f.write(' pre1: \"4, 4, 4, 4, 4, 4, 4, 4\"\n') + f.write(' pre2: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' pre3: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' attn: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' post: \"8, 8, 8, 8, 8, 8, 8, 8\"\n') + f.write(' - id: \"29\" \n') + f.write(' tx_polarity: \"00111011\" \n') + f.write(' rx_polarity: \"01101110\" \n') + f.write(' lane_swap: \"71635420\" \n') + f.write(' pre1: \"4, 4, 4, 4, 4, 4, 4, 4\"\n') + f.write(' pre2: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' pre3: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' attn: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' post: \"8, 8, 8, 8, 8, 8, 8, 8\"\n') + f.write(' - id: \"30\" \n') + f.write(' tx_polarity: \"01110011\" \n') + f.write(' rx_polarity: \"00100010\" \n') + f.write(' lane_swap: \"71634520\" \n') + f.write(' pre1: \"4, 4, 4, 4, 4, 4, 4, 4\"\n') + f.write(' pre2: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' pre3: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' attn: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' post: \"8, 8, 8, 8, 8, 8, 8, 8\"\n') + f.write(' - id: \"31\" \n') + f.write(' tx_polarity: \"01010011\" \n') + f.write(' rx_polarity: \"00110111\" \n') + f.write(' lane_swap: \"71235460\" \n') + f.write(' pre1: \"4, 4, 4, 4, 4, 4, 4, 4\"\n') + f.write(' pre2: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' pre3: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' attn: \"0, 0, 0, 0, 0, 0, 0, 0\"\n') + f.write(' post: \"8, 8, 8, 8, 8, 8, 8, 8\"\n') + f.write(' - id: \"32\" \n') + f.write(' tx_polarity: \"00000000\" \n') + f.write(' rx_polarity: \"00000000\" \n') + f.write(' lane_swap: \"01234567\" \n') + + +def cameo_config_gen(): + MAX_ISG_NUM=32 + isg = [7,6,5,4,3,2,1,0,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8] + ISG_PER_SLOT=4 + print_first() + port=0 + count=0 + slot_port=0 + filepath='' + line_card = ['N/A','N/A','N/A','N/A','N/A','N/A','N/A','N/A'] + val=0 + + for i in range(0,8): + filepath = "/sys/bus/i2c/devices/%d-0032/model" %(i+1) + if os.path.exists(filepath): + with open(filepath) as fh: + for line in fh: + get_str = line.strip() + #val1 = get_str.find("Inphi"); + #val2 = get_str.find("Credo"); + #if (val1==-1 and val2==-1): + # continue + + val = get_str.find("100G"); + if val != -1: + line_card[i]='100G' + continue + val = get_str.find("400G"); + if val != -1: + line_card[i]='400G' + continue + + #else: + # print "open %s fail" %filepath + + for i in range(MAX_ISG_NUM): + if (i%4==0): + card = (i/ISG_PER_SLOT)+1 + slot_port=1; + + if line_card[card-1] is '400G': + lane=8 + elif line_card[card-1] is '100G': + lane=2 + else: + lane=0 + speed = lane*50; + + if (lane==0): + continue; + + start_lane=0 + #for (start_lane=0;start_lane<8;start_lane+=lane) + while start_lane < 8: + + #the global serdes # is “serdes_group” * 8 + start lane + 1 = 4*8 + 0 + 1 = 33. + id = isg[i]*8 + start_lane + 1; + f.write(" - fec: \"KPFEC\" \n") + f.write(" id: \"%d\" \n" % id) + f.write(" lanes: \"%d:%d\" \n" % (start_lane,lane)) + f.write(" serdes_group: \"%d\" \n" % isg[i]) + f.write(" speed: \"%dG\" \n" % speed) + f.write(" sysport: \"%d\" \n" % id) + f.write(" type: \"eth\" \n") + #f2.write("Ethernet%-12d" % port) + str = "%d-%d" %(card,slot_port) + f2.write("Ethernet%-12s" % str); + port += lane; + + k=id + lanestr='' + while k < id+lane: + lanestr="%s%d" %(lanestr,k) + if k-id > 2: + break; + if k+1 < id+lane: + lanestr="%s," %lanestr + k+=1 + + f2.write("%-34s" %lanestr) + f2.write("Eth%-9s" %str) + #f2.write("Eth%-9d" %(count+1)) + f2.write("%-12d" %(speed*1000)) + f2.write("%-8d" %count) + f2.write("%-8s" %"9126") + f2.write("%-8s\n" %"rs") + + count+=1 + slot_port+=1 + start_lane+=lane + print_end() + f.close() + f2.close() + + print "This script will generate %s and %s." %(CAMEO_INNO_CFG,CAMEO_PORT_CFG) + print "Please copy them to %s to take effect." %CAMEO_HWSKU_PATH +#/usr/share/sonic/device/x86_64-cameo_esc600_128q-r0/esc600-128q/port_config.ini +#/usr/share/sonic/device/x86_64-cameo_esc600_128q-r0/esc600-128q/config_128x100G_Cameo-esc600-128q.yaml + +if __name__ == '__main__': + cameo_config_gen() diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/esc600_128q_dynamic_hotswap.py b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/esc600_128q_dynamic_hotswap.py new file mode 100755 index 0000000000..b306a84cb0 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/esc600_128q_dynamic_hotswap.py @@ -0,0 +1,269 @@ +#!/usr/bin/python +# -*- coding: UTF-8 -*- +import os +import sys +import logging +from multiprocessing import Process, Lock +import time +import subprocess +#import BaldEagleSdk_v2_14_18 as BE214 +#import BaldEagleSdk_v2_12_00_20190715_cameo_gearbox as BE212 +from importlib import import_module +BE214 = import_module('esc600-128q.BaldEagleSdk_v2_14_18') +BE212 = import_module('esc600-128q.BaldEagleSdk_v2_12_00_20190715_cameo_gearbox') + +gMaxThreadNum=4 +lock1 = Lock() +lock2 = Lock() + +LOGLEVEL = os.environ.get('LOGLEVEL', 'INFO').upper() +LOGGING_FORMAT = '%(asctime)s %(levelname)s: %(message)s' +DATE_FORMAT = '%Y%m%d %H:%M:%S' +logging.basicConfig(level=LOGLEVEL, format=LOGGING_FORMAT, datefmt=DATE_FORMAT) +version = '1.0' + +def run_command(command): + p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE) + out, err = p.communicate() + return out.rstrip('\n') + +def set_attr_value(attr_path,input_val): + cmd='' + if not os.path.isfile(attr_path): + return + cmd = "echo %d > %s" %(input_val,attr_path) + logging.debug(cmd) + run_command(cmd) + +def card_type_detect(card): + + sup_card_typed = ['Inphi 100G','Credo 100G','Inphi 400G','Credo 400G'] + + filepath = "/sys/bus/i2c/devices/%d-0032/model" %(card) + logging.debug(filepath) + if os.path.exists(filepath): + with open(filepath) as fh: + for line in fh: + get_str = line.strip() + for i in range(0,4): + val = get_str.find(sup_card_typed[i]); + if val != -1: + return sup_card_typed[i] + + + else: + return 'NA' + return 'NA' + +def card_reset(card): + lock1.acquire() + filepath = "/sys/bus/i2c/devices/%d-0032/phy_reset" % card + + try: + if os.path.exists(filepath): + set_attr_value(filepath,0) + time.sleep(1) + set_attr_value(filepath,1) + time.sleep(1) + else: + return False; + finally: + lock1.release() + return True; + +def card_power_isgood(card): + filepath = "/sys/class/hwmon/hwmon2/device/ESC600_Module/module_power" + logging.debug(filepath) + status = False + if os.path.exists(filepath): + with open(filepath) as fh: + for line in fh: + get_str = line.strip() + modulestr = "Module %d is power good" %(card) + val = get_str.find(modulestr); + if val != -1: + logging.debug(modulestr) + status = True + return True,status + status = False + return True,status + + return False,status + +def card_12v_status(card): + filepath = "/sys/class/hwmon/hwmon2/device/ESC600_Module/module_12v_status" + logging.debug(filepath) + status = False + if os.path.exists(filepath): + with open(filepath) as fh: + for line in fh: + get_str = line.strip() + modulestr = "Module %d 12V is enable" %(card) + val = get_str.find(modulestr); + if val != -1: + logging.debug(modulestr) + status = True + return True,status + status = False + return True,status + + return False,status + +def light_led(act,card): + led_loc = ['switch_led_4_1', 'switch_led_4_2', 'switch_led_4_3', 'switch_led_4_4', 'switch_led_5_1','switch_led_5_2','switch_led_5_3','switch_led_5_4'] + value = 0 + lock2.acquire() + filepath = '/sys/class/hwmon/hwmon2/device/ESC600_LED/%s'%led_loc[card-1] + logging.debug(filepath) + try: + if os.path.exists(filepath): + if act=='OFF': + logging.info("Setting LED to %s card [%d]" %(act,card)) + value = 0 + elif act=='GREEN_SOLID': + logging.info("Setting LED to %s card [%d]" %(act,card)) + value = 3 + elif act=='GREEN_BLINK': + logging.info("Setting LED to %s card [%d]" %(act,card)) + value = 4 + elif act=='AMBER_SOLID': + logging.info("Setting LED to %s card [%d]" %(act,card)) + value = 1 + elif act=='AMBER_BLINK': + logging.info("Setting LED to %s card [%d]" %(act,card)) + value = 2 + + set_attr_value(filepath,value) + finally: + lock2.release() + +def card_inserted(card): + filepath = "/sys/class/hwmon/hwmon2/device/ESC600_Module/module_insert" + logging.debug(filepath) + status = False + if os.path.exists(filepath): + with open(filepath) as fh: + for line in fh: + get_str = line.strip() + modulestr = "Module %d is present" %(card) + val = get_str.find(modulestr); + if val != -1: + logging.debug(modulestr) + status = True + return True,status + status = True + return True,status + + return False,status + +def job(mdio): + if mdio < 0 or mdio > 3: + logging.error("MDIO [%d] out of range" % mdio) + return False + CardStatus = ['NA','NA'] + + while(1): + for i in range(2): + card = mdio*2+i+1 + status_12v = False + status_powergood = False + status_insert = False + get_12v = False + get_powergood = False + get_insert = False + get_12v,status_12v = card_12v_status(card) + get_powergood,status_powergood = card_power_isgood(card) + get_insert,status_insert = card_inserted(card) + + if get_12v == False: + logging.error("Card [%d] Fail to get 12v status " % card) + CardStatus[i] = 'Driver Get Failed' + continue + if get_powergood == False: + logging.error("Card [%d] Fail to get power good status " % card) + CardStatus[i] = 'Driver Get Failed' + continue + if get_insert == False: + logging.error("Card [%d] Fail to get insert status " % card) + CardStatus[i] = 'Driver Get Failed' + continue + + if status_12v == True: + if status_powergood == True and status_insert == True: + if CardStatus[i]=='Initialize Complete' or CardStatus[i]=='Initialize Failed': + logging.info("Card [%d] status keep [%s] " % (card,CardStatus[i])) + time.sleep(1) + continue + else: + if CardStatus[i] != 'Initializing': + light_led('AMBER_BLINK',card) + logging.info( "Card [%d] status changed [%s] -> [Initializing] " % (card,CardStatus[i])) + CardStatus[i]='Initializing' + else: #Power on but no card inserted, set LED off + if CardStatus[i] != 'Power on Only': + logging.info( "Card [%d] status changed [%s] -> [Power on Only] " % (card,CardStatus[i])) + CardStatus[i]='Power on Only' + light_led('OFF',card) + + else: #Power off, remove/install card availible + if CardStatus[i] != 'Power Off': + light_led('GREEN_BLINK',card) + logging.info( "Card [%d] status changed [%s] -> [Power Off] " % (card,CardStatus[i])) + CardStatus[i]='Power Off' + + for i in range(2): + card = mdio*2+i+1 + if CardStatus[i]=='Initializing' : + init_status = False + card_type = card_type_detect(card) + if card_type == 'Credo 100G': + card_reset(card) + init_status = BE212.Cameo_credo100G(card) + time.sleep(1) + elif card_type == 'Credo 400G': + card_reset(card) + init_status = BE214.Cameo_credo400G(card) + time.sleep(1) + logging.info( "Card [%d] [%s] %s" %(card,CardStatus[i],card_type) ) + if init_status==True: + logging.info( "Card [%d] status changed [%s] -> [Initialize Complete] " % (card,CardStatus[i])) + CardStatus[i]='Initialize Complete' + light_led('GREEN_SOLID',card) + else: + logging.info( "Card [%d] status changed [%s] -> [Initialize Failed] " % (card,CardStatus[i])) + CardStatus[i]='Initialize Failed' + light_led('AMBER_SOLID',card) + time.sleep(2) + #break; +def module_loaded(module_name): + """Checks if module is loaded""" + lsmod_proc = subprocess.Popen(['lsmod'], stdout=subprocess.PIPE) + grep_proc = subprocess.Popen(['grep', module_name], stdin=lsmod_proc.stdout) + grep_proc.communicate() # Block until finished + return grep_proc.returncode == 0 + +def main(): + logging.info( "Cameo dynamic hotswap main task (%s) start. " % version ) + + """Checks if lscpcie2 module is loaded""" + module_name = 'lscpcie2' + loaded = module_loaded(module_name) + logging.error ('Module {} {} loaded'.format(module_name, "is" if loaded else "isn't")) + if not loaded: + logging.error( "Cameo dynamic hotswap main task (%s) exit. " % version ) + sys.exit() + + """Ready to create processes""" + numList = [] + for i in range(gMaxThreadNum): + p = Process(target=job, args=(i,)) + numList.append(p) + logging.info( "Prcess (%d) start ." % i ) + p.start() + for i in range(gMaxThreadNum): + numList[i].join() + logging.info( "Cameo dynamic hotswap main task (%s) exit(process %d) " % (version,i )) + + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/esc600_128q_dynamic_hotswap.sh b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/esc600_128q_dynamic_hotswap.sh new file mode 100755 index 0000000000..24446ebfd0 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/esc600_128q_dynamic_hotswap.sh @@ -0,0 +1,8 @@ +#!/bin/bash +export CAMEOLIB=/lib/credo_sdk/libcameo_mdio.so +export CREDO_100G_PATH=/lib/credo_sdk +export CREDO_400G_PATH=/lib/credo_sdk +export LOGLEVEL=INFO + +python /usr/local/bin/esc600_128q_dynamic_hotswap.py + diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/esc600_128q_fullportcfg b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/esc600_128q_fullportcfg new file mode 100755 index 0000000000..908cc34025 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/esc600_128q_fullportcfg @@ -0,0 +1,275 @@ +#!/usr/bin/python +# +# Copyright (c) 2020 Cameo Network, Inc. + +import sys +import json +import subprocess +import re +import logging + +logging.basicConfig(level=logging.WARNING) + +def _get_port_config(): + GET_PORT_CONF_CMD = "sonic-cfggen --print-data -p -k esc600-128q" + p = subprocess.Popen(GET_PORT_CONF_CMD, shell=True, stdout=subprocess.PIPE) + out, err = p.communicate() + return out.rstrip('\n') + +""" +insert_newports(dict_target, dict_data): +@: parameter dict_target - the target dictionary +@: parameter dict_data - the dictionary of ports will be added +Add the new elements of port table +""" +def insert_newports(dict_target, dict_data): + dict_target['PORT']=dict_data['PORT'] + return dict_target + +""" +delete_ports_from_othertables(dict_target, list_port): +@: parameter dict_target - the target dictionary +@: parameter list_port - the list of ports will be abandoned +remove the port names from all possible table in dict_target +""" +def delete_ports_from_othertables(dict_target, list_port): + + if len(list_port) == 0: + return dict_target + +#PORT_CHANNEL - Should we also delete the port channel without members? + try: + if dict_target.has_key('PORTCHANNEL'): + for portchannel in dict_target['PORTCHANNEL'].keys(): + for port in dict_target['PORTCHANNEL'][portchannel]['members']: + if port in list_port: + dict_target['PORTCHANNEL'][portchannel]['members'].remove(port) + logging.debug("PORTCHANNEL.{}.members.{} -> deleted".format(portchannel,port)) + if len(dict_target['PORTCHANNEL'][portchannel]['members']) == 0: + logging.warning("Empty member of PORTCHANNEL.{}".format(portchannel)) + except Exception: + logging.error("Parse PORTCHANNEL error", exc_info=True) + +#PORT_CHANNEL_MEMBER + try: + if dict_target.has_key('PORTCHANNEL_MEMBER'): + for member in dict_target['PORTCHANNEL_MEMBER'].keys(): + portname=(member.split('|'))[1] + for port in list_port: + if port == portname: + dict_target['PORTCHANNEL_MEMBER'].pop(member) + logging.debug("PORTCHANNEL_MEMEBER.{} -> deleted".format(member)) + except Exception: + logging.error("Parse PORTCHANNEL_MEMBER error", exc_info=True) + +#PORT_QOS_MAP + try: + if dict_target.has_key('PORT_QOS_MAP'): + for kstring in dict_target['PORT_QOS_MAP'].keys(): + # delete port in key string + plist = list(kstring.split(",")) + new_kstring = set(plist)-set(list_port) + if len(new_kstring) != 0: + new_kstring=",".join(new_kstring) + dict_target['PORT_QOS_MAP'][new_kstring]=dict_target['PORT_QOS_MAP'].pop(kstring) + logging.debug("PORT_QOS_MAP.{} -> {}".format(kstring, new_kstring)) + else: + dict_target['PORT_QOS_MAP'].pop(kstring) + logging.debug("PORT_QOS_MAP.{} -> deleted".format(kstring)) + except Exception: + logging.error("Parse PORT_QOS_MAP error", exc_info=True) + +#QUEUE + try: + if dict_target.has_key('QUEUE'): + for kstring in dict_target['QUEUE'].keys(): + # delete port in key string + plist = list(re.split(",|\|",kstring)) + tail_prio = plist.pop() + new_kstring = set(plist)-set(list_port) + if len(new_kstring) != 0: + new_kstring=",".join(new_kstring)+"|"+tail_prio + dict_target['QUEUE'][new_kstring]=dict_target['QUEUE'].pop(kstring) + logging.debug("QUEUE.{} -> {}".format(kstring, new_kstring)) + else: + dict_target['QUEUE'].pop(kstring) + logging.debug("QUEUE.{} -> deleted".format(kstring)) + except Exception: + logging.error("Parse QUEUE error", exc_info=True) + +#VLAN, should we delete the VLAN without members? + try: + if dict_target.has_key('VLAN'): + for vlan in dict_target['VLAN'].keys(): + for port in dict_target['VLAN'][vlan]['members']: + if port in list_port: + dict_target['VLAN'][vlan]['members'].remove(port) + logging.debug("VLAN.{}.members.{} -> deleted".format(vlan,port)) + if len(dict_target['VLAN'][vlan]['members']) == 0: + logging.warning("Empty member of VLAN.{}".format(vlan)) + except Exception: + logging.error("Parse VLAN error", exc_info=True) + +#VLAN_MEMBER + try: + if dict_target.has_key('VLAN_MEMBER'): + for member in dict_target['VLAN_MEMBER'].keys(): + portname=(member.split('|'))[1] + for port in list_port: + if port == portname: + dict_target['VLAN_MEMBER'].pop(member) + logging.debug("VLAN_MEMBER.{} -> deleted".format(member)) + except Exception: + logging.error("Parse VLAN_MEMBER error", exc_info=True) + +#ACL_TABLE + try: + if dict_target.has_key('ACL_TABLE'): + for acl_rule in dict_target['ACL_TABLE'].keys(): + if dict_target['ACL_TABLE'][acl_rule].has_key('ports'): + dict_target['ACL_TABLE'][acl_rule]['ports']=\ + list(set(dict_target['ACL_TABLE'][acl_rule]['ports'])\ + - set(list_port)) + logging.debug("ACL_TABLE.{}.ports.{} -> deleted".format(acl_rule,port)) + if len(dict_target['ACL_TABLE'][acl_rule]['ports']) == 0: + logging.warning("Empty member of ACL_TABLE.{}.ports".format(acl_rule)) + except Exception: + logging.error("Parse ACL_TABLE error", exc_info=True) + +#BUFFER_PG + try: + if dict_target.has_key('BUFFER_PG'): + for kstring in dict_target['BUFFER_PG'].keys(): + # delete port in key string + plist = list(re.split(",|\|",kstring)) + tail_prio = plist.pop() + new_kstring = set(plist)-set(list_port) + if len(new_kstring) != 0: + new_kstring=",".join(new_kstring)+"|"+tail_prio + dict_target['BUFFER_PG'][new_kstring]=dict_target['BUFFER_PG'].pop(kstring) + logging.debug("BUFFER_PG.{} -> {}".format(kstring,new_kstring)) + else: + dict_target['BUFFER_PG'].pop(kstring) + logging.debug("BUFFER_PG.{} -> deleted".format(kstring)) + except Exception: + logging.error("Parse BUFFER_PG error", exc_info=True) + +#BUFFER_QUEUE + try: + if dict_target.has_key('BUFFER_QUEUE'): + for kstring in dict_target['BUFFER_QUEUE'].keys(): + # delete port in key string + plist = list(re.split(",|\|",kstring)) + tail_prio = plist.pop() + new_kstring = set(plist)-set(list_port) + if len(new_kstring) != 0: + new_kstring=",".join(new_kstring)+"|"+tail_prio + dict_target['BUFFER_QUEUE'][new_kstring]=dict_target['BUFFER_QUEUE'].pop(kstring) + logging.debug("BUFFER_QUEUE.{} -> {}".format(kstring,new_kstring)) + else: + dict_target['BUFFER_QUEUE'].pop(kstring) + logging.debug("BUFFER_QUEUE.{} -> deleted".format(kstring)) + except Exception: + logging.error("Parse BUFFER_QUEUE error", exc_info=True) + +#CABLE_LENGTH + try: + if dict_target.has_key('CABLE_LENGTH'): + for group in dict_target['CABLE_LENGTH']: + for port in dict_target['CABLE_LENGTH'][group].keys(): + if port in list_port: + dict_target['CABLE_LENGTH'][group].pop(port) + logging.debug("CABLE_LENGTH.{}.{} -> deleted".format(group,port)) + except Exception: + logging.error("Parse CABLE_LENGTH error", exc_info=True) + +#INTERFACE + try: + if dict_target.has_key('INTERFACE'): + for intf in dict_target['INTERFACE'].keys(): + portname=(intf.split('|'))[0] + for port in list_port: + if port == portname: + dict_target['INTERFACE'].pop(intf) + logging.debug("INTERFACE.{} -> deleted".format(intf)) + except Exception: + logging.error("Parse INTERFACE error", exc_info=True) + +#DEVICE_NEIGHBOR + try: + if dict_target.has_key('DEVICE_NEIGHBOR'): + for port in list_port: + if dict_target['DEVICE_NEIGHBOR'].has_key(port): + dict_target['DEVICE_NEIGHBOR'].pop(port) + logging.debug("DEVICE_NEIGHBOR.{} -> deleted".format(port)) + except Exception: + logging.error("Parse DEVICE_NEIGHBOR error", exc_info=True) + + return dict_target + +def main(): + + # get input parameters: + if len(sys.argv)<3: + sys.exit(1) + + target_file = sys.argv[1] + source_file = sys.argv[2] + + with open(source_file) as f: + cur_cfg = json.load(f) + + port_cfg = json.loads(_get_port_config()) + + port_cfg.pop('DEVICE_METADATA') + + newports = port_cfg['PORT'].keys() + curports = cur_cfg['PORT'].keys() + + lostports = list(set(curports) - set(newports)) + appendports = list(set(newports) - set(curports)) + + logging.debug("====== Input =======") + logging.debug(json.dumps(port_cfg, sort_keys=True, indent=4, separators=(',',': '))) + + logging.debug("====cur ports====") + logging.debug(curports) + logging.debug("====new ports====") + logging.debug(newports) + logging.debug("====lost ports====") + logging.debug(lostports) + logging.debug("====append ports====") + logging.debug(appendports) + + # remove all ports from port table + cur_cfg['PORT'].clear() + + # remove ports from other table + # skip this handling with empty list + empty_list = list() + cur_cfg = delete_ports_from_othertables(cur_cfg, empty_list) + + # append new ports + cur_cfg = insert_newports(cur_cfg, port_cfg) + + for port in cur_cfg['PORT'].keys(): + cur_cfg['PORT'][port]['admin_status']= 'up' + + logging.debug("==== Result =====") + logging.debug(json.dumps(cur_cfg, sort_keys=True, indent=4, separators=(',',': '))) + + # write to new config file + try: + cfg_file = open(target_file, 'w') + except Exception: + logging.error("Error: unable to create file: %s".format(target_file)) + sys.exit(1) + + json.dump(cur_cfg, cfg_file, sort_keys=True, indent=4, separators=(',',': ')) + + cfg_file.close() + + sys.exit(0) + +if __name__ == '__main__': + main() diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/esc600_128q_init_phymodule b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/esc600_128q_init_phymodule new file mode 100755 index 0000000000..434fb66499 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/esc600_128q_init_phymodule @@ -0,0 +1,40 @@ +#!/bin/bash +export CREDO_PATH=/lib/credo_sdk +export CAMEOLIB=$CREDO_PATH/libcameo_mdio.so +export CREDO_100G_PATH=${CREDO_PATH} +export CREDO_400G_PATH=${CREDO_PATH} + +d1=$(date +"%s") +# get the type of phy modules +for ((i=1; i<=8; i++)) +do + result[i]=`cat /sys/bus/i2c/devices/${i}-0032/model` +done + +#parse for credo phy module +for ((i=1; i<=8; i++)) +do + if [ "${result[i]}" = "Credo 100G" ]; then + c[i]=1 + elif [ "${result[i]}" = "Credo 400G" ]; then + c[i]=2 + else + c[i]=0 + fi +done + +#parse for inphi phy module +# not implement yet + +# reset phy modules +i2cset -f -y 0 0x30 0xa2 0x0 +sleep 1 +i2cset -f -y 0 0x30 0xa2 0xff +sleep 1 + +# start init the credo phy modules +credo_auto1357.sh ${c[1]} ${c[3]} ${c[5]} ${c[7]} +credo_auto2468.sh ${c[2]} ${c[4]} ${c[6]} ${c[8]} + +d2=$(date +"%s") +echo "initialize All Slots Done: "$((d2-d1))" sec" diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/esc600_128q_portcfg b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/esc600_128q_portcfg new file mode 100755 index 0000000000..cc514ad2ca --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/esc600_128q_portcfg @@ -0,0 +1,40 @@ +#!/usr/bin/python +# -*- coding: UTF-8 -*- +# Filename : esc600_128q_portcfg.py +import json +import subprocess + +def _get_port_config(): + GET_PORT_CONF_CMD = "sonic-cfggen --print-data -p -k esc600-128q" + p = subprocess.Popen(GET_PORT_CONF_CMD, shell=True, stdout=subprocess.PIPE) + out, err = p.communicate() + return out.rstrip('\n') + + +def main(): + cur_cfg = json.load(open("/etc/sonic/config_db.json")) + + port_cfg = json.loads(_get_port_config()) + #remove DEVICE_METADATA + port_cfg.pop('DEVICE_METADATA') + for element1 in port_cfg['PORT'].copy(): + if cur_cfg['PORT'].has_key(element1): + port_cfg['PORT'].pop(element1) + + for element1 in port_cfg['PORT'].copy(): + port_cfg['PORT'][element1]['admin_status']= 'up' + # Output the updated file with pretty JSON + #file_name="updated-file.json" + #open(file_name, "w").write( + # json.dumps(port_cfg, sort_keys=True, indent=4, separators=(',', ': ')) + #) + print(json.dumps(port_cfg, sort_keys=True, indent=4, separators=(',', ': '))) + #print "Loading new port config to current config..." + #command = "config load {}".format(file_name) + #run_command(command,display_cmd=True) + #print "Saving current config..." + #command = "config save" + #run_command(command,display_cmd=True) + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/esc600_128q_slot_check.py b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/esc600_128q_slot_check.py new file mode 100755 index 0000000000..82dcb0bf7b --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/esc600_128q_slot_check.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python + +import os, sys + +CAMEO_PORT_CFG = '/usr/share/sonic/device/x86_64-cameo_esc600_128q-r0/esc600-128q/port_config.ini' +# WARNING_FILE is used to notify user in login banner +WARNING_FILE = '/tmp/slotcheckfail' + +WARNING_STR1 = "****************************** WARNING *******************************" +WARNING_STR2 = "* Current port_config.ini does not match with physical configuration *" +WARNING_STR3 = "**********************************************************************" + +MAX_SLOT_NUM = 8 +SLOT_BUS_BASE = 1 + +def get_attr_value(attr_path): + retval = 'ERR' + try: + with open(attr_path, 'r') as fd: + retval = fd.read() + except Exception as error: + print("Unable to open ", attr_path, " file !") + return retval + + retval = retval.rstrip('\r\n') + return retval + + +def main(): + + current_portcfg_list = set() + current_slotphy_list = set() + + # record the current port list + try: + with open(CAMEO_PORT_CFG, 'r') as fd: + lines = fd.readlines() + + except Exception as error: + print("Unable to open ", CAMEO_PORT_CFG, " file !") + sys.exit(1) + + for l in lines[1:]: + split_l = l.split(' ') + current_portcfg_list.add(split_l[0]) + + # record all slot presence + for slotn in range(0,MAX_SLOT_NUM): + filepath = "/sys/bus/i2c/devices/{}-0032/portnum".format(SLOT_BUS_BASE+slotn) + if os.path.exists(filepath): + portnum = get_attr_value(filepath) + if portnum == 'ERR': + print("{} Error: Read {} error".format(__file__, filepath)) + sys.exit(1) + + portnum = int(portnum) + + for pn in range(0, portnum): + current_slotphy_list.add("Ethernet{0}-{1}".format(slotn+1, pn+1)) + + # not match + if(current_portcfg_list != current_slotphy_list): + if os.path.exists(WARNING_FILE) is False: + fd = open(WARNING_FILE, "w") + fd.close() + print(WARNING_STR1+'\n'+WARNING_STR2+'\n'+WARNING_STR3) + print('curret portcfg:\n{}'.format(current_portcfg_list)) + print('physical cfg:\n{}'.format(current_slotphy_list)) + sys.exit(2) + # match + else: + if os.path.exists(WARNING_FILE): + os.remove(WARNING_FILE) + + # match without error + sys.exit(0) + + +if __name__ == "__main__": + main() + diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/esc600_128q_slot_power b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/esc600_128q_slot_power new file mode 100755 index 0000000000..ef43649e63 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/esc600_128q_slot_power @@ -0,0 +1,72 @@ +#!/usr/bin/python +# -*- coding: UTF-8 -*- +# Filename : esc600_128q_slot_power.py +import os +import sys +import logging +import click +import subprocess + +def run_command(command): + p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE) + out, err = p.communicate() + return out.rstrip('\n') + +def set_attr_value(attr_path,input_val): + cmd='' + if not os.path.isfile(attr_path): + return + cmd = "echo 0x%x > %s" %(input_val,attr_path) + run_command(cmd) + + +def get_attr_value(attr_path): + retval = 'ERR' + if not os.path.isfile(attr_path): + return retval + + try: + with open(attr_path, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", attr_path, " file !") + + retval = retval.rstrip('\r\n') + fd.close() + return retval + + +@click.command() +@click.option('-c', '--card', 'card', help='Line card', type=click.IntRange(1, 8),required=True) +@click.argument('power',metavar='',nargs=1,required=True,type=str) + +def main(card,power): + retval = '' + if not(power == 'on' or power == 'off'): + print "Error: %s -c " %sys.argv[0] + sys.exit(0) + + filePath = '/sys/class/hwmon/hwmon2/device/ESC600_Module/module_enable' + + card = card -1 + if os.path.exists(filePath): + retval = get_attr_value(filePath) + if retval == 'ERR': + print "Fail to get value." + sys.exit(0) + value = int(retval[-4:],16) + if power == 'on': + value = value | (0x1 << card) + elif power == 'off': + value = value ^ (0x1 << card) + + #print "0x%x" %(value) + set_attr_value(filePath,value) + + else: + print "Error!" + sys.exit(0) + + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/halt b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/halt new file mode 100755 index 0000000000..85d88ae01c --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/halt @@ -0,0 +1,18 @@ +#!/bin/sh + +mr_reboot() { + + sudo rmmod x86-64-cameo-esc600-128q + sudo i2cset -y 0 0x30 0xa1 0 + +} + +if [ $# -eq 0 ] || [ $@ = "--halt" ] || [ $@ = "-f" ] || [ $@ = "--force" ]; then + sudo /sbin/halt +elif [ $@ = "-p" ] || [ $@ = "--reboot" ] || [ $@ = "--poweroff" ]; then + sync;sync + mr_reboot +else + echo "unsupported option" +fi + diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/install_slot_driver.py b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/install_slot_driver.py new file mode 100755 index 0000000000..55b2823671 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/install_slot_driver.py @@ -0,0 +1,230 @@ +#!/usr/bin/python +import os +import commands +import sys, getopt +import logging +import time + +DEBUG = False +SLOT_STATUS_CURRENT_FILE = '/sys/class/hwmon/hwmon2/device/ESC600_Module/module_insert' +INSERT_CARD_MODEL_FILE = '/sys/bus/i2c/devices/{0}-0032/model' +# SLOT_STATUS_CURRENT_FILE = 'module_insert' +# INSERT_CARD_MODEL_FILE = 'slot_model' +PATH_73_BUS_BASE = 1 +PATH_77_BUS_BASE = 9 +PATH_71_BUS_BASE = 33 + +channel_path_73 = '/sys/bus/i2c/devices/i2c-{0}/new_device' + + +def my_log(txt): + if DEBUG == True: + print("[ROY]" + txt) + return + + +''' +def do_cmd(cmd, show): + my_log(cmd) +''' + + +def do_cmd(cmd, show): + logging.info('Run :' + cmd) + status, output = commands.getstatusoutput(cmd) + my_log(cmd + " with result:" + str(status)) + my_log(" output:" + output) + if status: + logging.info('Failed :' + cmd) + if show: + print('Failed :' + cmd) + return status, output + + +def get_attr_value(attr_path): + retval = 'ERR' + if not os.path.isfile(attr_path): + return retval + + try: + with open(attr_path, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", attr_path, " file !") + + retval = retval.rstrip('\r\n') + fd.close() + return retval + + +def bmc_is_exist(): + bmc_filePath = '/sys/class/hwmon/hwmon2/device/ESC600_SYS/bmc_present' + if os.path.exists(bmc_filePath): + value = get_attr_value(bmc_filePath) + if value.find('not') < 0: + return True + else: + return False + else: + return False + + +def remove_devices_73(): + for slot_id in range(0,8): + if os.path.isfile('/sys/bus/i2c/devices/{0}-0032/name'.format(slot_id+PATH_73_BUS_BASE)): + cmd = 'echo 0x32 >/sys/bus/i2c/devices/i2c-{0}/delete_device'.format(slot_id+PATH_73_BUS_BASE) + do_cmd(cmd,0) + if os.path.isfile('/sys/bus/i2c/devices/{0}-0071/name'.format(slot_id + PATH_73_BUS_BASE)): + cmd = 'echo 0x71 >/sys/bus/i2c/devices/i2c-{0}/delete_device'.format(slot_id+PATH_73_BUS_BASE) + do_cmd(cmd, 0) + if os.path.isfile('/sys/bus/i2c/devices/{0}-0072/name'.format(slot_id + PATH_73_BUS_BASE)): + cmd = 'echo 0x72 >/sys/bus/i2c/devices/i2c-{0}/delete_device'.format(slot_id+PATH_73_BUS_BASE) + do_cmd(cmd, 0) + + +def remove_devices_77(): + for slot_id in range(0, 8): + if os.path.isfile('/sys/bus/i2c/devices/{0}-004c/name'.format(slot_id + PATH_77_BUS_BASE)): + cmd = 'echo 0x4c >/sys/bus/i2c/devices/i2c-%d/delete_device' % (slot_id+PATH_77_BUS_BASE) + do_cmd(cmd, 0) + if os.path.isfile('/sys/bus/i2c/devices/{0}-0011/name'.format(slot_id + PATH_77_BUS_BASE)): + cmd = 'echo 0x11 >/sys/bus/i2c/devices/i2c-%d/delete_device' % (slot_id+PATH_77_BUS_BASE) + do_cmd(cmd, 0) + if os.path.isfile('/sys/bus/i2c/devices/{0}-0012/name'.format(slot_id + PATH_77_BUS_BASE)): + cmd = 'echo 0x12 >/sys/bus/i2c/devices/i2c-%d/delete_device' % (slot_id+PATH_77_BUS_BASE) + do_cmd(cmd, 0) + if os.path.isfile('/sys/bus/i2c/devices/{0}-0013/name'.format(slot_id + PATH_77_BUS_BASE)): + cmd = 'echo 0x13 >/sys/bus/i2c/devices/i2c-%d/delete_device' % (slot_id+PATH_77_BUS_BASE) + do_cmd(cmd, 0) + + +def sfp_module_100g(slot_id, bus_no): + cmd = 'echo pca9548 0x71 > %s' % channel_path_73.format(PATH_73_BUS_BASE+slot_id) + do_cmd(cmd, 0) + cmd = 'echo pca9548 0x72 > %s' % channel_path_73.format(PATH_73_BUS_BASE+slot_id) + do_cmd(cmd, 0) + for i in range(bus_no,bus_no+16): + cmd = 'echo optoe1 0x50 >/sys/bus/i2c/devices/i2c-%d/new_device' % i + do_cmd(cmd,0) + # fd.write("/sys/bus/i2c/devices/{0}-0050/eeprom\n".format(i)) + return bus_no+16 + + +def sfp_module_400g(slot_id, bus_no): + cmd = 'echo pca9548 0x71 > %s' % channel_path_73.format(PATH_73_BUS_BASE+slot_id) + do_cmd(cmd, 0) + for i in range(bus_no,bus_no+4): + cmd = 'echo optoe1 0x50 >/sys/bus/i2c/devices/i2c-%d/new_device' % i + do_cmd(cmd,0) + # fd.write("/sys/bus/i2c/devices/{0}-0050/eeprom\n".format(i)) + return bus_no+8 + +def install_slot_73_cpld_driver(slot_id): + # install 0x32 cpld driver first, we need it to read the card model(100G or 400G) + cmd = 'echo phy_cpld640 0x32 > %s' % channel_path_73.format(PATH_73_BUS_BASE+slot_id) + do_cmd(cmd, 0) + time.sleep(0.1) + +def install_slot_73_sfp(slot_id, bus_no): + count= 0 + timeout_count = 50 + path = INSERT_CARD_MODEL_FILE.format(PATH_73_BUS_BASE+slot_id) + # path = INSERT_CARD_MODEL_FILE + while True: + if os.path.exists(path): + break + count += 1 + if count > timeout_count: + print("detect {} timeout".format(path)) + sys.exit() + time.sleep(0.2) + + with open(path, 'r') as fd: + text_lines = fd.readlines() + for line in text_lines: + if "100G" in line: + bus_no = sfp_module_100g(slot_id, bus_no) + if "400G" in line: + bus_no = sfp_module_400g(slot_id, bus_no) + return bus_no + + +def sensors_on_card(slot_id, is_100G): + cmd = 'echo g781 0x4c >/sys/bus/i2c/devices/i2c-%d/new_device' % (slot_id+PATH_77_BUS_BASE) + do_cmd(cmd, 0) + cmd = 'echo tps40425 0x11 >/sys/bus/i2c/devices/i2c-%d/new_device' % (slot_id+PATH_77_BUS_BASE) + do_cmd(cmd, 0) + if is_100G: + cmd = 'echo tps40425 0x12 >/sys/bus/i2c/devices/i2c-%d/new_device' % (slot_id+PATH_77_BUS_BASE) + do_cmd(cmd, 0) + cmd = 'echo tps40425 0x13 >/sys/bus/i2c/devices/i2c-%d/new_device' % (slot_id+PATH_77_BUS_BASE) + do_cmd(cmd, 0) + + +def install_slot_77(slot_id): + # Path already generate by install_73(73 must first install) + path = INSERT_CARD_MODEL_FILE.format(PATH_73_BUS_BASE+slot_id) + # path = INSERT_CARD_MODEL_FILE + with open(path, 'r') as fd: + text_lines = fd.readlines() + for line in text_lines: + if "100G" in line: + sensors_on_card(slot_id, True) + if "400G" in line: + sensors_on_card(slot_id, False) + + +def install_card_devices(bmc_exist): + global PATH_71_BUS_BASE + # adjust bus base + if bmc_exist: + PATH_71_BUS_BASE = 9 + bus_no = PATH_71_BUS_BASE + with open(SLOT_STATUS_CURRENT_FILE, 'r') as file_stream: + text_lines = file_stream.readlines() + for line in text_lines: + # got index from 1 we need from 0 ==> int(filter(str.isdigit, line))-1 + # install cpld driver for all slot + install_slot_73_cpld_driver(int(filter(str.isdigit, line))-1) + + time.sleep(0.5) # add delay to wait cpld sysfile ready + for line in text_lines: + if "is present" in line: + # install only the present one + # install_slot_73_cpld_driver(int(filter(str.isdigit, line))-1) + + bus_no = install_slot_73_sfp(int(filter(str.isdigit, line))-1, bus_no) + if not bmc_exist: + install_slot_77(int(filter(str.isdigit, line))-1) + + +def remove_card_devices(bmc_exist): + remove_devices_73() + if not bmc_exist: + remove_devices_77() + + +def main(): + global DEBUG + global args + options, args = getopt.getopt(sys.argv[1:], 'd', ['debug']) + bmc_exist = bmc_is_exist() + for opt, arg in options: + if opt in ('-d', '--debug'): + DEBUG = True + logging.basicConfig(level=logging.INFO) + else: + logging.info('no option') + for arg in args: + if arg == 'install': + # remove devices first + remove_card_devices(bmc_exist) + install_card_devices(bmc_exist) + elif arg == 'clean': + remove_card_devices(bmc_exist) + else: + return + + +if __name__ == "__main__": + main() diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/poweroff b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/poweroff new file mode 100755 index 0000000000..e54ee07b61 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/poweroff @@ -0,0 +1,18 @@ +#!/bin/sh + +mr_reboot() { + + sudo rmmod x86-64-cameo-esc600-128q + sudo i2cset -y 0 0x30 0xa1 0 + +} + +if [ $# -eq 0 ] || [ $@ = "-p" ] || [ $@ = "--reboot" ] || [ $@ = "--poweroff" ] || [ $@ = "-f" ] || [ $@ = "--force" ]; then + sync;sync + mr_reboot +elif [ $@ = "--halt" ]; then + sudo halt +else + echo "unsupported option" +fi + diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/shutdown b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/shutdown new file mode 100755 index 0000000000..f167a49ba3 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/shutdown @@ -0,0 +1,18 @@ +#!/bin/sh + +mr_reboot() { + + sudo rmmod x86-64-cameo-esc600-128q + sudo i2cset -y 0 0x30 0xa1 0 + +} + +if [ $# -eq 0 ] || [ $@ = "-r" ] || [ $@ = "--reboot" ] || [ $@ = "-h" ] || [ $@ = "-P" ] || [ $@ = "--poweroff" ]; then + sync;sync + mr_reboot +elif [ $@ = "-H" ] || [ $@ = "--halt" ]; then + sudo halt +else + echo "unsupported option" +fi + diff --git a/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/update_portcfg b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/update_portcfg new file mode 100755 index 0000000000..460cafb709 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc600-128q/utils/update_portcfg @@ -0,0 +1,24 @@ +#!/bin/sh + +AUTOCONFIG_FILE_PATH="/etc/esc600_autoconfig" +HW_CFG_PATH=/usr/share/sonic/device/x86_64-cameo_esc600_128q-r0/esc600-128q + +esc600_128q_autoconfig + +echo "import new configuration files:" +echo "...$HW_CFG_PATH/config_128x100G_Cameo-esc600-128q.yaml" +echo "...$HW_CFG_PATH/port_config.ini" + +cp $AUTOCONFIG_FILE_PATH/config_128x100G_Cameo-esc600-128q.yaml $HW_CFG_PATH/config_128x100G_Cameo-esc600-128q.yaml +cp $AUTOCONFIG_FILE_PATH/port_config.ini $HW_CFG_PATH/port_config.ini + +esc600_128q_fullportcfg /etc/esc600_autoconfig/config_db.json /etc/sonic/config_db.json +portcfg_result=$? +if [ $portcfg_result -eq 0 ]; then + echo "New config_db.json is created:" + echo ".../etc/sonic/config_db.json -> /etc/sonic/config_db.json.bk" + echo ".../etc/esc600_autoconfig/config_db.json -> /etc/sonic/config_db.json" + mv /etc/sonic/config_db.json /etc/sonic/config_db.json.bk + cp /etc/esc600_autoconfig/config_db.json /etc/sonic/config_db.json +fi + diff --git a/platform/innovium/sonic-platform-modules-cameo/esc601-32q/modules/Makefile b/platform/innovium/sonic-platform-modules-cameo/esc601-32q/modules/Makefile new file mode 100644 index 0000000000..4c1211f7f2 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc601-32q/modules/Makefile @@ -0,0 +1 @@ +obj-m := x86-64-cameo-esc601-32q.o nct7511.o mcp3425_smbus.o at24_smbus.o zrh2800k2.o diff --git a/platform/innovium/sonic-platform-modules-cameo/esc601-32q/modules/at24_smbus.c b/platform/innovium/sonic-platform-modules-cameo/esc601-32q/modules/at24_smbus.c new file mode 100644 index 0000000000..16d6594746 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc601-32q/modules/at24_smbus.c @@ -0,0 +1,847 @@ +/* + * at24.c - handle most I2C EEPROMs + * + * Copyright (C) 2005-2007 David Brownell + * Copyright (C) 2008 Wolfram Sang, Pengutronix + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * I2C EEPROMs from most vendors are inexpensive and mostly interchangeable. + * Differences between different vendor product lines (like Atmel AT24C or + * MicroChip 24LC, etc) won't much matter for typical read/write access. + * There are also I2C RAM chips, likewise interchangeable. One example + * would be the PCF8570, which acts like a 24c02 EEPROM (256 bytes). + * + * However, misconfiguration can lose data. "Set 16-bit memory address" + * to a part with 8-bit addressing will overwrite data. Writing with too + * big a page size also loses data. And it's not safe to assume that the + * conventional addresses 0x50..0x57 only hold eeproms; a PCF8563 RTC + * uses 0x51, for just one example. + * + * Accordingly, explicit board-specific configuration data should be used + * in almost all cases. (One partial exception is an SMBus used to access + * "SPD" data for DRAM sticks. Those only use 24c02 EEPROMs.) + * + * So this driver uses "new style" I2C driver binding, expecting to be + * told what devices exist. That may be in arch/X/mach-Y/board-Z.c or + * similar kernel-resident tables; or, configuration data coming from + * a bootloader. + * + * Other than binding model, current differences from "eeprom" driver are + * that this one handles write access and isn't restricted to 24c02 devices. + * It also handles larger devices (32 kbit and up) with two-byte addresses, + * which won't work on pure SMBus systems. + */ + +struct at24_data { + struct at24_platform_data chip; + int use_smbus; + int use_smbus_write; + + ssize_t (*read_func)(struct at24_data *, char *, unsigned int, size_t); + ssize_t (*write_func)(struct at24_data *, + const char *, unsigned int, size_t); + + /* + * Lock protects against activities from other Linux tasks, + * but not from changes by other I2C masters. + */ + struct mutex lock; + + u8 *writebuf; + unsigned write_max; + unsigned num_addresses; + + struct nvmem_config nvmem_config; + struct nvmem_device *nvmem; + + /* + * Some chips tie up multiple I2C addresses; dummy devices reserve + * them for us, and we'll use them with SMBus calls. + */ + struct i2c_client *client[]; +}; + +/* + * This parameter is to help this driver avoid blocking other drivers out + * of I2C for potentially troublesome amounts of time. With a 100 kHz I2C + * clock, one 256 byte read takes about 1/43 second which is excessive; + * but the 1/170 second it takes at 400 kHz may be quite reasonable; and + * at 1 MHz (Fm+) a 1/430 second delay could easily be invisible. + * + * This value is forced to be a power of two so that writes align on pages. + */ +static unsigned io_limit = 128; +module_param(io_limit, uint, 0); +MODULE_PARM_DESC(io_limit, "Maximum bytes per I/O (default 128)"); + +/* + * Specs often allow 5 msec for a page write, sometimes 20 msec; + * it's important to recover from write timeouts. + */ +static unsigned write_timeout = 25; +module_param(write_timeout, uint, 0); +MODULE_PARM_DESC(write_timeout, "Time (in ms) to try writes (default 25)"); + +#define AT24_SIZE_BYTELEN 5 +#define AT24_SIZE_FLAGS 8 + +#define AT24_BITMASK(x) (BIT(x) - 1) + +/* create non-zero magic value for given eeprom parameters */ +#define AT24_DEVICE_MAGIC(_len, _flags) \ + ((1 << AT24_SIZE_FLAGS | (_flags)) \ + << AT24_SIZE_BYTELEN | ilog2(_len)) + +/* + * Both reads and writes fail if the previous write didn't complete yet. This + * macro loops a few times waiting at least long enough for one entire page + * write to work while making sure that at least one iteration is run before + * checking the break condition. + * + * It takes two parameters: a variable in which the future timeout in jiffies + * will be stored and a temporary variable holding the time of the last + * iteration of processing the request. Both should be unsigned integers + * holding at least 32 bits. + */ +#define loop_until_timeout(tout, op_time) \ + for (tout = jiffies + msecs_to_jiffies(write_timeout), op_time = 0; \ + op_time ? time_before(op_time, tout) : true; \ + usleep_range(1000, 1500), op_time = jiffies) + +static const struct i2c_device_id at24_ids[] = { + { "24c64smbus", AT24_DEVICE_MAGIC(65536 / 8, AT24_FLAG_ADDR16) }, + { /* END OF LIST */ } +}; +MODULE_DEVICE_TABLE(i2c, at24_ids); + +static const struct acpi_device_id at24_acpi_ids[] = { + { "INT3499", AT24_DEVICE_MAGIC(8192 / 8, 0) }, + { } +}; +MODULE_DEVICE_TABLE(acpi, at24_acpi_ids); + +/*-------------------------------------------------------------------------*/ + +/* + * This routine supports chips which consume multiple I2C addresses. It + * computes the addressing information to be used for a given r/w request. + * Assumes that sanity checks for offset happened at sysfs-layer. + * + * Slave address and byte offset derive from the offset. Always + * set the byte address; on a multi-master board, another master + * may have changed the chip's "current" address pointer. + * + * REVISIT some multi-address chips don't rollover page reads to + * the next slave address, so we may need to truncate the count. + * Those chips might need another quirk flag. + * + * If the real hardware used four adjacent 24c02 chips and that + * were misconfigured as one 24c08, that would be a similar effect: + * one "eeprom" file not four, but larger reads would fail when + * they crossed certain pages. + */ +static struct i2c_client *at24_translate_offset(struct at24_data *at24, + unsigned int *offset) +{ + unsigned i; + + if (at24->chip.flags & AT24_FLAG_ADDR16) { + i = *offset >> 16; + *offset &= 0xffff; + } else { + i = *offset >> 8; + *offset &= 0xff; + } + + return at24->client[i]; +} + +static ssize_t at24_eeprom_read_smbus(struct at24_data *at24, char *buf, + unsigned int offset, size_t count) +{ + unsigned long timeout, read_time; + struct i2c_client *client; + int status,i,j; + + client = at24_translate_offset(at24, &offset); + + if (count > io_limit) + count = io_limit; + /* Smaller eeproms can work given some SMBus extension calls */ + if (count > I2C_SMBUS_BLOCK_MAX) + count = I2C_SMBUS_BLOCK_MAX; + + if(at24->chip.flags & AT24_FLAG_ADDR16){ + + + status = i2c_smbus_write_byte_data(client, offset>>8, + offset&0xff); + if(status < 0) + return status; + + mdelay(7); + for (i = 0; i < count; i++) { + j = i2c_smbus_read_byte(client); + if (j < 0) { + return j; + } + buf[i] = j; + } + return count; + + }else{ + + loop_until_timeout(timeout, read_time) { + status = i2c_smbus_read_i2c_block_data_or_emulated(client, + offset, + count, buf); + + dev_dbg(&client->dev, "read %zu@%d --> %d (%ld)\n", + count, offset, status, jiffies); + + if (status == count) + return count; + } + } + return -ETIMEDOUT; +} + +static ssize_t at24_eeprom_read_i2c(struct at24_data *at24, char *buf, + unsigned int offset, size_t count) +{ + unsigned long timeout, read_time; + struct i2c_client *client; + struct i2c_msg msg[2]; + int status, i; + u8 msgbuf[2]; + + memset(msg, 0, sizeof(msg)); + client = at24_translate_offset(at24, &offset); + + if (count > io_limit) + count = io_limit; + + /* + * When we have a better choice than SMBus calls, use a combined I2C + * message. Write address; then read up to io_limit data bytes. Note + * that read page rollover helps us here (unlike writes). msgbuf is + * u8 and will cast to our needs. + */ + i = 0; + if (at24->chip.flags & AT24_FLAG_ADDR16) + msgbuf[i++] = offset >> 8; + msgbuf[i++] = offset; + + msg[0].addr = client->addr; + msg[0].buf = msgbuf; + msg[0].len = i; + + msg[1].addr = client->addr; + msg[1].flags = I2C_M_RD; + msg[1].buf = buf; + msg[1].len = count; + + loop_until_timeout(timeout, read_time) { + status = i2c_transfer(client->adapter, msg, 2); + if (status == 2) + status = count; + + dev_dbg(&client->dev, "read %zu@%d --> %d (%ld)\n", + count, offset, status, jiffies); + + if (status == count) + return count; + } + + return -ETIMEDOUT; +} + +static ssize_t at24_eeprom_read_serial(struct at24_data *at24, char *buf, + unsigned int offset, size_t count) +{ + unsigned long timeout, read_time; + struct i2c_client *client; + struct i2c_msg msg[2]; + u8 addrbuf[2]; + int status; + + client = at24_translate_offset(at24, &offset); + + memset(msg, 0, sizeof(msg)); + msg[0].addr = client->addr; + msg[0].buf = addrbuf; + + /* + * The address pointer of the device is shared between the regular + * EEPROM array and the serial number block. The dummy write (part of + * the sequential read protocol) ensures the address pointer is reset + * to the desired position. + */ + if (at24->chip.flags & AT24_FLAG_ADDR16) { + /* + * For 16 bit address pointers, the word address must contain + * a '10' sequence in bits 11 and 10 regardless of the + * intended position of the address pointer. + */ + addrbuf[0] = 0x08; + addrbuf[1] = offset; + msg[0].len = 2; + } else { + /* + * Otherwise the word address must begin with a '10' sequence, + * regardless of the intended address. + */ + addrbuf[0] = 0x80 + offset; + msg[0].len = 1; + } + + msg[1].addr = client->addr; + msg[1].flags = I2C_M_RD; + msg[1].buf = buf; + msg[1].len = count; + + loop_until_timeout(timeout, read_time) { + status = i2c_transfer(client->adapter, msg, 2); + if (status == 2) + return count; + } + + return -ETIMEDOUT; +} + +static ssize_t at24_eeprom_read_mac(struct at24_data *at24, char *buf, + unsigned int offset, size_t count) +{ + unsigned long timeout, read_time; + struct i2c_client *client; + struct i2c_msg msg[2]; + u8 addrbuf[2]; + int status; + + client = at24_translate_offset(at24, &offset); + + memset(msg, 0, sizeof(msg)); + msg[0].addr = client->addr; + msg[0].buf = addrbuf; + /* EUI-48 starts from 0x9a, EUI-64 from 0x98 */ + addrbuf[0] = 0xa0 - at24->chip.byte_len + offset; + msg[0].len = 1; + msg[1].addr = client->addr; + msg[1].flags = I2C_M_RD; + msg[1].buf = buf; + msg[1].len = count; + + loop_until_timeout(timeout, read_time) { + status = i2c_transfer(client->adapter, msg, 2); + if (status == 2) + return count; + } + + return -ETIMEDOUT; +} + +/* + * Note that if the hardware write-protect pin is pulled high, the whole + * chip is normally write protected. But there are plenty of product + * variants here, including OTP fuses and partial chip protect. + * + * We only use page mode writes; the alternative is sloooow. These routines + * write at most one page. + */ + +static size_t at24_adjust_write_count(struct at24_data *at24, + unsigned int offset, size_t count) +{ + unsigned next_page; + + /* write_max is at most a page */ + if (count > at24->write_max) + count = at24->write_max; + + /* Never roll over backwards, to the start of this page */ + next_page = roundup(offset + 1, at24->chip.page_size); + if (offset + count > next_page) + count = next_page - offset; + + return count; +} + +static ssize_t at24_eeprom_write_smbus_block(struct at24_data *at24, + const char *buf, + unsigned int offset, size_t count) +{ + unsigned long timeout, write_time; + struct i2c_client *client; + ssize_t status = 0; + + client = at24_translate_offset(at24, &offset); + count = at24_adjust_write_count(at24, offset, count); + + loop_until_timeout(timeout, write_time) { + status = i2c_smbus_write_i2c_block_data(client, + offset, count, buf); + if (status == 0) + status = count; + + dev_dbg(&client->dev, "write %zu@%d --> %zd (%ld)\n", + count, offset, status, jiffies); + + if (status == count) + return count; + } + + return -ETIMEDOUT; +} + +static ssize_t at24_eeprom_write_smbus_byte(struct at24_data *at24, + const char *buf, + unsigned int offset, size_t count) +{ + unsigned long timeout, write_time; + struct i2c_client *client; + ssize_t status = 0; + + client = at24_translate_offset(at24, &offset); + + loop_until_timeout(timeout, write_time) { + status = i2c_smbus_write_byte_data(client, offset, buf[0]); + if (status == 0) + status = count; + + dev_dbg(&client->dev, "write %zu@%d --> %zd (%ld)\n", + count, offset, status, jiffies); + + if (status == count) + return count; + } + + return -ETIMEDOUT; +} + +static ssize_t at24_eeprom_write_i2c(struct at24_data *at24, const char *buf, + unsigned int offset, size_t count) +{ + unsigned long timeout, write_time; + struct i2c_client *client; + struct i2c_msg msg; + ssize_t status = 0; + int i = 0; + + client = at24_translate_offset(at24, &offset); + count = at24_adjust_write_count(at24, offset, count); + + msg.addr = client->addr; + msg.flags = 0; + + /* msg.buf is u8 and casts will mask the values */ + msg.buf = at24->writebuf; + if (at24->chip.flags & AT24_FLAG_ADDR16) + msg.buf[i++] = offset >> 8; + + msg.buf[i++] = offset; + memcpy(&msg.buf[i], buf, count); + msg.len = i + count; + + loop_until_timeout(timeout, write_time) { + status = i2c_transfer(client->adapter, &msg, 1); + if (status == 1) + status = count; + + dev_dbg(&client->dev, "write %zu@%d --> %zd (%ld)\n", + count, offset, status, jiffies); + + if (status == count) + return count; + } + + return -ETIMEDOUT; +} + +static int at24_read(void *priv, unsigned int off, void *val, size_t count) +{ + struct at24_data *at24 = priv; + char *buf = val; + + if (unlikely(!count)) + return count; + + if (off + count > at24->chip.byte_len) + return -EINVAL; + + /* + * Read data from chip, protecting against concurrent updates + * from this host, but not from other I2C masters. + */ + mutex_lock(&at24->lock); + + while (count) { + int status; + + status = at24->read_func(at24, buf, off, count); + if (status < 0) { + mutex_unlock(&at24->lock); + return status; + } + buf += status; + off += status; + count -= status; + } + + mutex_unlock(&at24->lock); + + return 0; +} + +static int at24_write(void *priv, unsigned int off, void *val, size_t count) +{ + struct at24_data *at24 = priv; + char *buf = val; + + if (unlikely(!count)) + return -EINVAL; + + if (off + count > at24->chip.byte_len) + return -EINVAL; + + /* + * Write data to chip, protecting against concurrent updates + * from this host, but not from other I2C masters. + */ + mutex_lock(&at24->lock); + + while (count) { + int status; + + status = at24->write_func(at24, buf, off, count); + if (status < 0) { + mutex_unlock(&at24->lock); + return status; + } + buf += status; + off += status; + count -= status; + } + + mutex_unlock(&at24->lock); + + return 0; +} + +#ifdef CONFIG_OF +static void at24_get_ofdata(struct i2c_client *client, + struct at24_platform_data *chip) +{ + const __be32 *val; + struct device_node *node = client->dev.of_node; + + if (node) { + if (of_get_property(node, "read-only", NULL)) + chip->flags |= AT24_FLAG_READONLY; + val = of_get_property(node, "pagesize", NULL); + if (val) + chip->page_size = be32_to_cpup(val); + } +} +#else +static void at24_get_ofdata(struct i2c_client *client, + struct at24_platform_data *chip) +{ } +#endif /* CONFIG_OF */ + +static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id) +{ + struct at24_platform_data chip; + kernel_ulong_t magic = 0; + bool writable; + int use_smbus = 0; + int use_smbus_write = 0; + struct at24_data *at24; + int err; + unsigned i, num_addresses; + u8 test_byte; + + if (client->dev.platform_data) { + chip = *(struct at24_platform_data *)client->dev.platform_data; + } else { + if (id) { + magic = id->driver_data; + } else { + const struct acpi_device_id *aid; + + aid = acpi_match_device(at24_acpi_ids, &client->dev); + if (aid) + magic = aid->driver_data; + } + if (!magic) + return -ENODEV; + + chip.byte_len = BIT(magic & AT24_BITMASK(AT24_SIZE_BYTELEN)); + magic >>= AT24_SIZE_BYTELEN; + chip.flags = magic & AT24_BITMASK(AT24_SIZE_FLAGS); + /* + * This is slow, but we can't know all eeproms, so we better + * play safe. Specifying custom eeprom-types via platform_data + * is recommended anyhow. + */ + chip.page_size = 1; + + /* update chipdata if OF is present */ + at24_get_ofdata(client, &chip); + + chip.setup = NULL; + chip.context = NULL; + } + + if (!is_power_of_2(chip.byte_len)) + dev_warn(&client->dev, + "byte_len looks suspicious (no power of 2)!\n"); + if (!chip.page_size) { + dev_err(&client->dev, "page_size must not be 0!\n"); + return -EINVAL; + } + if (!is_power_of_2(chip.page_size)) + dev_warn(&client->dev, + "page_size looks suspicious (no power of 2)!\n"); + + /* + * REVISIT: the size of the EUI-48 byte array is 6 in at24mac402, while + * the call to ilog2() in AT24_DEVICE_MAGIC() rounds it down to 4. + * + * Eventually we'll get rid of the magic values altoghether in favor of + * real structs, but for now just manually set the right size. + */ + if (chip.flags & AT24_FLAG_MAC && chip.byte_len == 4) + chip.byte_len = 6; + + /* Use I2C operations unless we're stuck with SMBus extensions. */ + if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { + //if (chip.flags & AT24_FLAG_ADDR16) + // return -EPFNOSUPPORT; + + if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { + use_smbus = I2C_SMBUS_I2C_BLOCK_DATA; + } else if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_READ_WORD_DATA)) { + use_smbus = I2C_SMBUS_WORD_DATA; + } else if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_READ_BYTE_DATA)) { + use_smbus = I2C_SMBUS_BYTE_DATA; + } else { + return -EPFNOSUPPORT; + } + + if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_WRITE_I2C_BLOCK)) { + use_smbus_write = I2C_SMBUS_I2C_BLOCK_DATA; + } else if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) { + use_smbus_write = I2C_SMBUS_BYTE_DATA; + chip.page_size = 1; + } + } + + if (chip.flags & AT24_FLAG_TAKE8ADDR) + num_addresses = 8; + else + num_addresses = DIV_ROUND_UP(chip.byte_len, + (chip.flags & AT24_FLAG_ADDR16) ? 65536 : 256); + + at24 = devm_kzalloc(&client->dev, sizeof(struct at24_data) + + num_addresses * sizeof(struct i2c_client *), GFP_KERNEL); + if (!at24) + return -ENOMEM; + + mutex_init(&at24->lock); + at24->use_smbus = use_smbus; + at24->use_smbus_write = use_smbus_write; + at24->chip = chip; + at24->num_addresses = num_addresses; + + if ((chip.flags & AT24_FLAG_SERIAL) && (chip.flags & AT24_FLAG_MAC)) { + dev_err(&client->dev, + "invalid device data - cannot have both AT24_FLAG_SERIAL & AT24_FLAG_MAC."); + return -EINVAL; + } + + if (chip.flags & AT24_FLAG_SERIAL) { + at24->read_func = at24_eeprom_read_serial; + } else if (chip.flags & AT24_FLAG_MAC) { + at24->read_func = at24_eeprom_read_mac; + } else { + at24->read_func = at24->use_smbus ? at24_eeprom_read_smbus + : at24_eeprom_read_i2c; + } + + if (at24->use_smbus) { + if (at24->use_smbus_write == I2C_SMBUS_I2C_BLOCK_DATA) + at24->write_func = at24_eeprom_write_smbus_block; + else + at24->write_func = at24_eeprom_write_smbus_byte; + } else { + at24->write_func = at24_eeprom_write_i2c; + } + + writable = !(chip.flags & AT24_FLAG_READONLY); + if (writable) { + if (!use_smbus || use_smbus_write) { + + unsigned write_max = chip.page_size; + + if (write_max > io_limit) + write_max = io_limit; + if (use_smbus && write_max > I2C_SMBUS_BLOCK_MAX) + write_max = I2C_SMBUS_BLOCK_MAX; + at24->write_max = write_max; + + /* buffer (data + address at the beginning) */ + at24->writebuf = devm_kzalloc(&client->dev, + write_max + 2, GFP_KERNEL); + if (!at24->writebuf) + return -ENOMEM; + } else { + dev_warn(&client->dev, + "cannot write due to controller restrictions."); + } + } + + at24->client[0] = client; + + /* use dummy devices for multiple-address chips */ + for (i = 1; i < num_addresses; i++) { + at24->client[i] = i2c_new_dummy(client->adapter, + client->addr + i); + if (!at24->client[i]) { + dev_err(&client->dev, "address 0x%02x unavailable\n", + client->addr + i); + err = -EADDRINUSE; + goto err_clients; + } + } + + i2c_set_clientdata(client, at24); + + /* + * Perform a one-byte test read to verify that the + * chip is functional. + */ + err = at24_read(at24, 0, &test_byte, 1); + if (err) { + err = -ENODEV; + goto err_clients; + } + + at24->nvmem_config.name = dev_name(&client->dev); + at24->nvmem_config.dev = &client->dev; + at24->nvmem_config.read_only = !writable; + at24->nvmem_config.root_only = true; + at24->nvmem_config.owner = THIS_MODULE; + at24->nvmem_config.compat = true; + at24->nvmem_config.base_dev = &client->dev; + at24->nvmem_config.reg_read = at24_read; + at24->nvmem_config.reg_write = at24_write; + at24->nvmem_config.priv = at24; + at24->nvmem_config.stride = 1; + at24->nvmem_config.word_size = 1; + at24->nvmem_config.size = chip.byte_len; + + at24->nvmem = nvmem_register(&at24->nvmem_config); + + if (IS_ERR(at24->nvmem)) { + err = PTR_ERR(at24->nvmem); + goto err_clients; + } + + dev_info(&client->dev, "%u byte %s EEPROM, %s, %u bytes/write\n", + chip.byte_len, client->name, + writable ? "writable" : "read-only", at24->write_max); + if (use_smbus == I2C_SMBUS_WORD_DATA || + use_smbus == I2C_SMBUS_BYTE_DATA) { + dev_notice(&client->dev, "Falling back to %s reads, " + "performance will suffer\n", use_smbus == + I2C_SMBUS_WORD_DATA ? "word" : "byte"); + } + + /* export data to kernel code */ + if (chip.setup) + chip.setup(at24->nvmem, chip.context); + + return 0; + +err_clients: + for (i = 1; i < num_addresses; i++) + if (at24->client[i]) + i2c_unregister_device(at24->client[i]); + + return err; +} + +static int at24_remove(struct i2c_client *client) +{ + struct at24_data *at24; + int i; + + at24 = i2c_get_clientdata(client); + + nvmem_unregister(at24->nvmem); + + for (i = 1; i < at24->num_addresses; i++) + i2c_unregister_device(at24->client[i]); + + return 0; +} + +/*-------------------------------------------------------------------------*/ + +static struct i2c_driver at24_driver = { + .driver = { + .name = "at24_smbus", + .acpi_match_table = ACPI_PTR(at24_acpi_ids), + }, + .probe = at24_probe, + .remove = at24_remove, + .id_table = at24_ids, +}; + +static int __init at24_init(void) +{ + if (!io_limit) { + pr_err("at24: io_limit must not be 0!\n"); + return -EINVAL; + } + + io_limit = rounddown_pow_of_two(io_limit); + return i2c_add_driver(&at24_driver); +} +module_init(at24_init); + +static void __exit at24_exit(void) +{ + i2c_del_driver(&at24_driver); +} +module_exit(at24_exit); + +MODULE_DESCRIPTION("Driver for most I2C EEPROMs"); +MODULE_AUTHOR("David Brownell and Wolfram Sang"); +MODULE_LICENSE("GPL"); diff --git a/platform/innovium/sonic-platform-modules-cameo/esc601-32q/modules/mcp3425_smbus.c b/platform/innovium/sonic-platform-modules-cameo/esc601-32q/modules/mcp3425_smbus.c new file mode 100644 index 0000000000..fea7a65886 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc601-32q/modules/mcp3425_smbus.c @@ -0,0 +1,406 @@ +/* + * mcp3422.c - driver for the Microchip mcp3421/2/3/4/5/6/7/8 chip family + * + * Copyright (C) 2013, Angelo Compagnucci + * Author: Angelo Compagnucci + * + * Datasheet: http://ww1.microchip.com/downloads/en/devicedoc/22088b.pdf + * http://ww1.microchip.com/downloads/en/DeviceDoc/22226a.pdf + * http://ww1.microchip.com/downloads/en/DeviceDoc/22072b.pdf + * + * This driver exports the value of analog input voltage to sysfs, the + * voltage unit is nV. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include + +#include +#include + +/* Masks */ +#define MCP3422_CHANNEL_MASK 0x60 +#define MCP3422_PGA_MASK 0x03 +#define MCP3422_SRATE_MASK 0x0C +#define MCP3422_SRATE_240 0x0 +#define MCP3422_SRATE_60 0x1 +#define MCP3422_SRATE_15 0x2 +#define MCP3422_SRATE_3 0x3 +#define MCP3422_PGA_1 0 +#define MCP3422_PGA_2 1 +#define MCP3422_PGA_4 2 +#define MCP3422_PGA_8 3 +#define MCP3422_CONT_SAMPLING 0x10 + +#define MCP3422_CHANNEL(config) (((config) & MCP3422_CHANNEL_MASK) >> 5) +#define MCP3422_PGA(config) ((config) & MCP3422_PGA_MASK) +#define MCP3422_SAMPLE_RATE(config) (((config) & MCP3422_SRATE_MASK) >> 2) + +#define MCP3422_CHANNEL_VALUE(value) (((value) << 5) & MCP3422_CHANNEL_MASK) +#define MCP3422_PGA_VALUE(value) ((value) & MCP3422_PGA_MASK) +#define MCP3422_SAMPLE_RATE_VALUE(value) ((value << 2) & MCP3422_SRATE_MASK) + +#define MCP3422_CHAN(_index) \ + { \ + .type = IIO_VOLTAGE, \ + .indexed = 1, \ + .channel = _index, \ + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) \ + | BIT(IIO_CHAN_INFO_SCALE), \ + .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SAMP_FREQ), \ + } + +static const int mcp3422_scales[4][4] = { + { 1000000, 500000, 250000, 125000 }, + { 250000, 125000, 62500, 31250 }, + { 62500, 31250, 15625, 7812 }, + { 15625, 7812, 3906, 1953 } }; + +/* Constant msleep times for data acquisitions */ +static const int mcp3422_read_times[4] = { + [MCP3422_SRATE_240] = 1000 / 240, + [MCP3422_SRATE_60] = 1000 / 60, + [MCP3422_SRATE_15] = 1000 / 15, + [MCP3422_SRATE_3] = 1000 / 3 }; + +/* sample rates to integer conversion table */ +static const int mcp3422_sample_rates[4] = { + [MCP3422_SRATE_240] = 240, + [MCP3422_SRATE_60] = 60, + [MCP3422_SRATE_15] = 15, + [MCP3422_SRATE_3] = 3 }; + +/* sample rates to sign extension table */ +static const int mcp3422_sign_extend[4] = { + [MCP3422_SRATE_240] = 11, + [MCP3422_SRATE_60] = 13, + [MCP3422_SRATE_15] = 15, + [MCP3422_SRATE_3] = 17 }; + +/* Client data (each client gets its own) */ +struct mcp3422 { + struct i2c_client *i2c; + u8 id; + u8 config; + u8 pga[4]; + struct mutex lock; +}; + +static int mcp3422_update_config(struct mcp3422 *adc, u8 newconfig) +{ + int ret; + + mutex_lock(&adc->lock); + + ret = i2c_master_send(adc->i2c, &newconfig, 1); + if (ret > 0) { + adc->config = newconfig; + ret = 0; + } + + mutex_unlock(&adc->lock); + + return ret; +} + +static int mcp3422_read(struct mcp3422 *adc, int *value, u8 *config) +{ + int ret = 0; + u8 sample_rate = MCP3422_SAMPLE_RATE(adc->config); + u8 buf[4] = {0, 0, 0, 0}; + u32 temp; + + if (sample_rate == MCP3422_SRATE_3) { + //ret = i2c_master_recv(adc->i2c, buf, 4); + ret = i2c_smbus_read_i2c_block_data(adc->i2c, 0, 4 , buf); + temp = buf[0] << 16 | buf[1] << 8 | buf[2]; + *config = buf[3]; + } else { + //ret = i2c_master_recv(adc->i2c, buf, 3); + ret = i2c_smbus_read_i2c_block_data(adc->i2c, 0, 3 , buf); + temp = buf[0] << 8 | buf[1]; + *config = buf[2]; + } + + *value = sign_extend32(temp, mcp3422_sign_extend[sample_rate]); + + return ret; +} + +static int mcp3422_read_channel(struct mcp3422 *adc, + struct iio_chan_spec const *channel, int *value) +{ + int ret; + u8 config; + u8 req_channel = channel->channel; + + if (req_channel != MCP3422_CHANNEL(adc->config)) { + config = adc->config; + config &= ~MCP3422_CHANNEL_MASK; + config |= MCP3422_CHANNEL_VALUE(req_channel); + config &= ~MCP3422_PGA_MASK; + config |= MCP3422_PGA_VALUE(adc->pga[req_channel]); + ret = mcp3422_update_config(adc, config); + if (ret < 0) + return ret; + msleep(mcp3422_read_times[MCP3422_SAMPLE_RATE(adc->config)]); + } + + return mcp3422_read(adc, value, &config); +} + +static int mcp3422_read_raw(struct iio_dev *iio, + struct iio_chan_spec const *channel, int *val1, + int *val2, long mask) +{ + struct mcp3422 *adc = iio_priv(iio); + int err; + + u8 sample_rate = MCP3422_SAMPLE_RATE(adc->config); + u8 pga = MCP3422_PGA(adc->config); + + switch (mask) { + case IIO_CHAN_INFO_RAW: + err = mcp3422_read_channel(adc, channel, val1); + if (err < 0) + return -EINVAL; + return IIO_VAL_INT; + + case IIO_CHAN_INFO_SCALE: + + *val1 = 0; + *val2 = mcp3422_scales[sample_rate][pga]; + return IIO_VAL_INT_PLUS_NANO; + + case IIO_CHAN_INFO_SAMP_FREQ: + *val1 = mcp3422_sample_rates[MCP3422_SAMPLE_RATE(adc->config)]; + return IIO_VAL_INT; + + default: + break; + } + + return -EINVAL; +} + +static int mcp3422_write_raw(struct iio_dev *iio, + struct iio_chan_spec const *channel, int val1, + int val2, long mask) +{ + struct mcp3422 *adc = iio_priv(iio); + u8 temp; + u8 config = adc->config; + u8 req_channel = channel->channel; + u8 sample_rate = MCP3422_SAMPLE_RATE(config); + u8 i; + + switch (mask) { + case IIO_CHAN_INFO_SCALE: + if (val1 != 0) + return -EINVAL; + + for (i = 0; i < ARRAY_SIZE(mcp3422_scales[0]); i++) { + if (val2 == mcp3422_scales[sample_rate][i]) { + adc->pga[req_channel] = i; + + config &= ~MCP3422_CHANNEL_MASK; + config |= MCP3422_CHANNEL_VALUE(req_channel); + config &= ~MCP3422_PGA_MASK; + config |= MCP3422_PGA_VALUE(adc->pga[req_channel]); + + return mcp3422_update_config(adc, config); + } + } + return -EINVAL; + + case IIO_CHAN_INFO_SAMP_FREQ: + switch (val1) { + case 240: + temp = MCP3422_SRATE_240; + break; + case 60: + temp = MCP3422_SRATE_60; + break; + case 15: + temp = MCP3422_SRATE_15; + break; + case 3: + if (adc->id > 4) + return -EINVAL; + temp = MCP3422_SRATE_3; + break; + default: + return -EINVAL; + } + + config &= ~MCP3422_CHANNEL_MASK; + config |= MCP3422_CHANNEL_VALUE(req_channel); + config &= ~MCP3422_SRATE_MASK; + config |= MCP3422_SAMPLE_RATE_VALUE(temp); + + return mcp3422_update_config(adc, config); + + default: + break; + } + + return -EINVAL; +} + +static int mcp3422_write_raw_get_fmt(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, long mask) +{ + switch (mask) { + case IIO_CHAN_INFO_SCALE: + return IIO_VAL_INT_PLUS_NANO; + case IIO_CHAN_INFO_SAMP_FREQ: + return IIO_VAL_INT_PLUS_MICRO; + default: + return -EINVAL; + } +} + +static ssize_t mcp3422_show_samp_freqs(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct mcp3422 *adc = iio_priv(dev_to_iio_dev(dev)); + + if (adc->id > 4) + return sprintf(buf, "240 60 15\n"); + + return sprintf(buf, "240 60 15 3\n"); +} + +static ssize_t mcp3422_show_scales(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct mcp3422 *adc = iio_priv(dev_to_iio_dev(dev)); + u8 sample_rate = MCP3422_SAMPLE_RATE(adc->config); + + return sprintf(buf, "0.%09u 0.%09u 0.%09u 0.%09u\n", + mcp3422_scales[sample_rate][0], + mcp3422_scales[sample_rate][1], + mcp3422_scales[sample_rate][2], + mcp3422_scales[sample_rate][3]); +} + +static IIO_DEVICE_ATTR(sampling_frequency_available, S_IRUGO, + mcp3422_show_samp_freqs, NULL, 0); +static IIO_DEVICE_ATTR(in_voltage_scale_available, S_IRUGO, + mcp3422_show_scales, NULL, 0); + +static struct attribute *mcp3422_attributes[] = { + &iio_dev_attr_sampling_frequency_available.dev_attr.attr, + &iio_dev_attr_in_voltage_scale_available.dev_attr.attr, + NULL, +}; + +static const struct attribute_group mcp3422_attribute_group = { + .attrs = mcp3422_attributes, +}; + +static const struct iio_chan_spec mcp3421_channels[] = { + MCP3422_CHAN(0), +}; + +static const struct iio_chan_spec mcp3422_channels[] = { + MCP3422_CHAN(0), + MCP3422_CHAN(1), +}; + +static const struct iio_chan_spec mcp3424_channels[] = { + MCP3422_CHAN(0), + MCP3422_CHAN(1), + MCP3422_CHAN(2), + MCP3422_CHAN(3), +}; + +static const struct iio_info mcp3422_info = { + .read_raw = mcp3422_read_raw, + .write_raw = mcp3422_write_raw, + .write_raw_get_fmt = mcp3422_write_raw_get_fmt, + .attrs = &mcp3422_attribute_group, + .driver_module = THIS_MODULE, +}; + +static int mcp3422_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct iio_dev *indio_dev; + struct mcp3422 *adc; + int err; + u8 config; +#if 0 + if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) + return -EOPNOTSUPP; +#endif + indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*adc)); + if (!indio_dev) + return -ENOMEM; + + adc = iio_priv(indio_dev); + adc->i2c = client; + adc->id = (u8)(id->driver_data); + + mutex_init(&adc->lock); + + indio_dev->dev.parent = &client->dev; + indio_dev->dev.of_node = client->dev.of_node; + indio_dev->name = dev_name(&client->dev); + indio_dev->modes = INDIO_DIRECT_MODE; + indio_dev->info = &mcp3422_info; + + switch (adc->id) { + case 1: + case 5: + indio_dev->channels = mcp3421_channels; + indio_dev->num_channels = ARRAY_SIZE(mcp3421_channels); + break; + } + + /* meaningful default configuration */ + config = (MCP3422_CONT_SAMPLING + | MCP3422_CHANNEL_VALUE(1) + | MCP3422_PGA_VALUE(MCP3422_PGA_1) + | MCP3422_SAMPLE_RATE_VALUE(MCP3422_SRATE_240)); + mcp3422_update_config(adc, config); + + err = devm_iio_device_register(&client->dev, indio_dev); + if (err < 0) + return err; + + i2c_set_clientdata(client, indio_dev); + + return 0; +} + +static const struct i2c_device_id mcp3422_id[] = { + + { "mcp3425_smbus", 5 }, + + { } +}; +MODULE_DEVICE_TABLE(i2c, mcp3422_id); + +static struct i2c_driver mcp3422_driver = { + .driver = { + .name = "mcp3425_smbus", + .of_match_table = of_match_ptr(mcp3422_of_match), + }, + .probe = mcp3422_probe, + .id_table = mcp3422_id, +}; +module_i2c_driver(mcp3422_driver); + +MODULE_AUTHOR("Angelo Compagnucci "); +MODULE_DESCRIPTION("Modify from mcp3422.c(Microchip mcp3421/2/3/4/5/6/7/8 driver)"); +MODULE_LICENSE("GPL v2"); diff --git a/platform/innovium/sonic-platform-modules-cameo/esc601-32q/modules/nct7511.c b/platform/innovium/sonic-platform-modules-cameo/esc601-32q/modules/nct7511.c new file mode 100644 index 0000000000..8ddf1919f5 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc601-32q/modules/nct7511.c @@ -0,0 +1,765 @@ +/* + + */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRVNAME "nct7511" + + +#define REG_BANK 0x00 +#define REG_TEMP_LSB 0x05 +#define REG_FANCOUNT_LOW 0x13 +#define REG_START 0x21 +#define REG_MODE 0x22 /* 7.2.32 Mode Selection Register */ +#define REG_FAN_ENABLE 0x24 +#define REG_PWM(x) (0x60 + (x)) +#define REG_SMARTFAN_EN(x) (0x64 + (x) / 2) +#define SMARTFAN_EN_SHIFT(x) ((x) % 2 * 4) +#define REG_VENDOR_ID 0xfd +#define REG_CHIP_ID 0xfe +#define REG_VERSION_ID 0xff + +/* + * Data structures and manipulation thereof + */ + +struct nct7511_data { + struct regmap *regmap; + struct mutex access_lock; /* for multi-byte read and write operations */ +}; + +static ssize_t show_temp_type(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct nct7511_data *data = dev_get_drvdata(dev); + struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr); + unsigned int mode; + int ret; + + ret = regmap_read(data->regmap, REG_MODE, &mode); + if (ret < 0) + return ret; + + return sprintf(buf, "%u\n", (mode >> (2 * sattr->index) & 3) + 2); +} + +static ssize_t store_temp_type(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct nct7511_data *data = dev_get_drvdata(dev); + struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr); + unsigned int type; + int err; + + err = kstrtouint(buf, 0, &type); + if (err < 0) + return err; + if (sattr->index == 2 && type != 4) /* RD3 */ + return -EINVAL; + if (type < 3 || type > 4) + return -EINVAL; + err = regmap_update_bits(data->regmap, REG_MODE, + 3 << 2 * sattr->index, (type - 2) << 2 * sattr->index); + return err ? : count; +} + +static ssize_t show_pwm_mode(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr); + struct nct7511_data *data = dev_get_drvdata(dev); + unsigned int regval; + int ret; + + if (sattr->index > 1) + return sprintf(buf, "1\n"); + + ret = regmap_read(data->regmap, 0x5E, ®val); + if (ret < 0) + return ret; + + return sprintf(buf, "%u\n", !(regval & (1 << sattr->index))); +} + +static ssize_t show_pwm(struct device *dev, struct device_attribute *devattr, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct nct7511_data *data = dev_get_drvdata(dev); + unsigned int val; + int ret; + + if (!attr->index) + return sprintf(buf, "255\n"); + + ret = regmap_read(data->regmap, attr->index, &val); + if (ret < 0) + return ret; + + return sprintf(buf, "%d\n", val); +} + +static ssize_t store_pwm(struct device *dev, struct device_attribute *devattr, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct nct7511_data *data = dev_get_drvdata(dev); + int err; + u8 val; + + err = kstrtou8(buf, 0, &val); + if (err < 0) + return err; + + err = regmap_write(data->regmap, attr->index, val); + return err ? : count; +} + +static ssize_t show_pwm_enable(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct nct7511_data *data = dev_get_drvdata(dev); + struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr); + unsigned int reg, enabled; + int ret; + + ret = regmap_read(data->regmap, REG_SMARTFAN_EN(sattr->index), ®); + if (ret < 0) + return ret; + enabled = reg >> SMARTFAN_EN_SHIFT(sattr->index) & 1; + return sprintf(buf, "%u\n", enabled + 1); +} + +static ssize_t store_pwm_enable(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct nct7511_data *data = dev_get_drvdata(dev); + struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr); + u8 val; + int ret; + + ret = kstrtou8(buf, 0, &val); + if (ret < 0) + return ret; + if (val < 1 || val > 2) + return -EINVAL; + ret = regmap_update_bits(data->regmap, REG_SMARTFAN_EN(sattr->index), + 1 << SMARTFAN_EN_SHIFT(sattr->index), + (val - 1) << SMARTFAN_EN_SHIFT(sattr->index)); + return ret ? : count; +} + +static int nct7511_read_temp(struct nct7511_data *data, + u8 reg_temp, u8 reg_temp_low, int *temp) +{ + unsigned int t1, t2 = 0; + int err; + + *temp = 0; + + mutex_lock(&data->access_lock); + err = regmap_read(data->regmap, reg_temp, &t1); + if (err < 0) + goto abort; + t1 <<= 8; + if (reg_temp_low) { /* 11 bit data */ + err = regmap_read(data->regmap, reg_temp_low, &t2); + if (err < 0) + goto abort; + } + t1 |= t2 & 0xe0; + *temp = (s16)t1 / 32 * 125; +abort: + mutex_unlock(&data->access_lock); + return err; +} + +static int nct7511_read_fan(struct nct7511_data *data, u8 reg_fan) +{ + unsigned int f1, f2; + int ret; + + mutex_lock(&data->access_lock); + ret = regmap_read(data->regmap, reg_fan, &f1); + if (ret < 0) + goto abort; + ret = regmap_read(data->regmap, REG_FANCOUNT_LOW, &f2); + if (ret < 0) + goto abort; + ret = (f1 << 5) | (f2 >> 3); + /* convert fan count to rpm */ + if (ret == 0x1fff) /* maximum value, assume fan is stopped */ + ret = 0; + else if (ret) + ret = DIV_ROUND_CLOSEST(1350000U, ret); +abort: + mutex_unlock(&data->access_lock); + return ret; +} + +static int nct7511_read_fan_min(struct nct7511_data *data, u8 reg_fan_low, + u8 reg_fan_high) +{ + unsigned int f1, f2; + int ret; + + mutex_lock(&data->access_lock); + ret = regmap_read(data->regmap, reg_fan_low, &f1); + if (ret < 0) + goto abort; + ret = regmap_read(data->regmap, reg_fan_high, &f2); + if (ret < 0) + goto abort; + ret = f1 | ((f2 & 0xf8) << 5); + /* convert fan count to rpm */ + if (ret == 0x1fff) /* maximum value, assume no limit */ + ret = 0; + else if (ret) + ret = DIV_ROUND_CLOSEST(1350000U, ret); + else + ret = 1350000U; +abort: + mutex_unlock(&data->access_lock); + return ret; +} + +static int nct7511_write_fan_min(struct nct7511_data *data, u8 reg_fan_low, + u8 reg_fan_high, unsigned long limit) +{ + int err; + + if (limit) + limit = DIV_ROUND_CLOSEST(1350000U, limit); + else + limit = 0x1fff; + limit = clamp_val(limit, 0, 0x1fff); + + mutex_lock(&data->access_lock); + err = regmap_write(data->regmap, reg_fan_low, limit & 0xff); + if (err < 0) + goto abort; + + err = regmap_write(data->regmap, reg_fan_high, (limit & 0x1f00) >> 5); +abort: + mutex_unlock(&data->access_lock); + return err; +} + +static ssize_t show_temp(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct nct7511_data *data = dev_get_drvdata(dev); + struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); + int err, temp; + + err = nct7511_read_temp(data, sattr->nr, sattr->index, &temp); + if (err < 0) + return err; + + return sprintf(buf, "%d\n", temp); +} + +static ssize_t store_temp(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); + struct nct7511_data *data = dev_get_drvdata(dev); + int nr = sattr->nr; + long val; + int err; + + err = kstrtol(buf, 10, &val); + if (err < 0) + return err; + + val = DIV_ROUND_CLOSEST(clamp_val(val, -128000, 127000), 1000); + + err = regmap_write(data->regmap, nr, val & 0xff); + return err ? : count; +} + +static ssize_t show_fan(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr); + struct nct7511_data *data = dev_get_drvdata(dev); + int speed; + + speed = nct7511_read_fan(data, sattr->index); + if (speed < 0) + return speed; + + return sprintf(buf, "%d\n", speed); +} + +static ssize_t show_fan_min(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); + struct nct7511_data *data = dev_get_drvdata(dev); + int speed; + + speed = nct7511_read_fan_min(data, sattr->nr, sattr->index); + if (speed < 0) + return speed; + + return sprintf(buf, "%d\n", speed); +} + +static ssize_t store_fan_min(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); + struct nct7511_data *data = dev_get_drvdata(dev); + unsigned long val; + int err; + + err = kstrtoul(buf, 10, &val); + if (err < 0) + return err; + + err = nct7511_write_fan_min(data, sattr->nr, sattr->index, val); + return err ? : count; +} + +static ssize_t show_alarm(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct nct7511_data *data = dev_get_drvdata(dev); + struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); + int bit = sattr->index; + unsigned int val; + int ret; + + ret = regmap_read(data->regmap, sattr->nr, &val); + if (ret < 0) + return ret; + + return sprintf(buf, "%u\n", !!(val & (1 << bit))); +} + +static ssize_t +show_beep(struct device *dev, struct device_attribute *attr, char *buf) +{ + struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); + struct nct7511_data *data = dev_get_drvdata(dev); + unsigned int regval; + int err; + + err = regmap_read(data->regmap, sattr->nr, ®val); + if (err) + return err; + + return sprintf(buf, "%u\n", !!(regval & (1 << sattr->index))); +} + +static ssize_t +store_beep(struct device *dev, struct device_attribute *attr, const char *buf, + size_t count) +{ + struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); + struct nct7511_data *data = dev_get_drvdata(dev); + unsigned long val; + int err; + + err = kstrtoul(buf, 10, &val); + if (err < 0) + return err; + if (val > 1) + return -EINVAL; + + err = regmap_update_bits(data->regmap, sattr->nr, 1 << sattr->index, + val ? 1 << sattr->index : 0); + return err ? : count; +} + +static SENSOR_DEVICE_ATTR(temp1_type, S_IRUGO | S_IWUSR, + show_temp_type, store_temp_type, 0); +static SENSOR_DEVICE_ATTR_2(temp1_input, S_IRUGO, show_temp, NULL, 0x01, + REG_TEMP_LSB); +static SENSOR_DEVICE_ATTR_2(temp1_min, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x31, 0); +static SENSOR_DEVICE_ATTR_2(temp1_max, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x30, 0); +static SENSOR_DEVICE_ATTR_2(temp1_crit, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x3a, 0); + +static SENSOR_DEVICE_ATTR(temp2_type, S_IRUGO | S_IWUSR, + show_temp_type, store_temp_type, 1); +static SENSOR_DEVICE_ATTR_2(temp2_input, S_IRUGO, show_temp, NULL, 0x02, + REG_TEMP_LSB); +static SENSOR_DEVICE_ATTR_2(temp2_min, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x33, 0); +static SENSOR_DEVICE_ATTR_2(temp2_max, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x32, 0); +static SENSOR_DEVICE_ATTR_2(temp2_crit, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x3b, 0); + +static SENSOR_DEVICE_ATTR(temp3_type, S_IRUGO | S_IWUSR, + show_temp_type, store_temp_type, 2); +static SENSOR_DEVICE_ATTR_2(temp3_input, S_IRUGO, show_temp, NULL, 0x03, + REG_TEMP_LSB); +static SENSOR_DEVICE_ATTR_2(temp3_min, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x35, 0); +static SENSOR_DEVICE_ATTR_2(temp3_max, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x34, 0); +static SENSOR_DEVICE_ATTR_2(temp3_crit, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x3c, 0); + +static SENSOR_DEVICE_ATTR_2(temp4_input, S_IRUGO, show_temp, NULL, 0x04, 0); +static SENSOR_DEVICE_ATTR_2(temp4_min, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x37, 0); +static SENSOR_DEVICE_ATTR_2(temp4_max, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x36, 0); +static SENSOR_DEVICE_ATTR_2(temp4_crit, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x3d, 0); + + +static SENSOR_DEVICE_ATTR_2(temp1_min_alarm, S_IRUGO, show_alarm, NULL, + 0x18, 0); +static SENSOR_DEVICE_ATTR_2(temp2_min_alarm, S_IRUGO, show_alarm, NULL, + 0x18, 1); +static SENSOR_DEVICE_ATTR_2(temp3_min_alarm, S_IRUGO, show_alarm, NULL, + 0x18, 2); +static SENSOR_DEVICE_ATTR_2(temp4_min_alarm, S_IRUGO, show_alarm, NULL, + 0x18, 3); + +static SENSOR_DEVICE_ATTR_2(temp1_max_alarm, S_IRUGO, show_alarm, NULL, + 0x19, 0); +static SENSOR_DEVICE_ATTR_2(temp2_max_alarm, S_IRUGO, show_alarm, NULL, + 0x19, 1); +static SENSOR_DEVICE_ATTR_2(temp3_max_alarm, S_IRUGO, show_alarm, NULL, + 0x19, 2); +static SENSOR_DEVICE_ATTR_2(temp4_max_alarm, S_IRUGO, show_alarm, NULL, + 0x19, 3); + + +static SENSOR_DEVICE_ATTR_2(temp1_crit_alarm, S_IRUGO, show_alarm, NULL, + 0x1b, 0); +static SENSOR_DEVICE_ATTR_2(temp2_crit_alarm, S_IRUGO, show_alarm, NULL, + 0x1b, 1); +static SENSOR_DEVICE_ATTR_2(temp3_crit_alarm, S_IRUGO, show_alarm, NULL, + 0x1b, 2); +static SENSOR_DEVICE_ATTR_2(temp4_crit_alarm, S_IRUGO, show_alarm, NULL, + 0x1b, 3); + +static SENSOR_DEVICE_ATTR_2(temp1_fault, S_IRUGO, show_alarm, NULL, 0x17, 0); +static SENSOR_DEVICE_ATTR_2(temp2_fault, S_IRUGO, show_alarm, NULL, 0x17, 1); +static SENSOR_DEVICE_ATTR_2(temp3_fault, S_IRUGO, show_alarm, NULL, 0x17, 2); + +static SENSOR_DEVICE_ATTR_2(temp1_beep, S_IRUGO | S_IWUSR, show_beep, + store_beep, 0x5c, 0); +static SENSOR_DEVICE_ATTR_2(temp2_beep, S_IRUGO | S_IWUSR, show_beep, + store_beep, 0x5c, 1); +static SENSOR_DEVICE_ATTR_2(temp3_beep, S_IRUGO | S_IWUSR, show_beep, + store_beep, 0x5c, 2); +static SENSOR_DEVICE_ATTR_2(temp4_beep, S_IRUGO | S_IWUSR, show_beep, + store_beep, 0x5c, 3); + +static struct attribute *nct7511_temp_attrs[] = { + &sensor_dev_attr_temp1_type.dev_attr.attr, + &sensor_dev_attr_temp1_input.dev_attr.attr, + &sensor_dev_attr_temp1_min.dev_attr.attr, + &sensor_dev_attr_temp1_max.dev_attr.attr, + &sensor_dev_attr_temp1_crit.dev_attr.attr, + &sensor_dev_attr_temp1_min_alarm.dev_attr.attr, + &sensor_dev_attr_temp1_max_alarm.dev_attr.attr, + &sensor_dev_attr_temp1_crit_alarm.dev_attr.attr, + &sensor_dev_attr_temp1_fault.dev_attr.attr, + &sensor_dev_attr_temp1_beep.dev_attr.attr, + + &sensor_dev_attr_temp2_type.dev_attr.attr, /* 10 */ + &sensor_dev_attr_temp2_input.dev_attr.attr, + &sensor_dev_attr_temp2_min.dev_attr.attr, + &sensor_dev_attr_temp2_max.dev_attr.attr, + &sensor_dev_attr_temp2_crit.dev_attr.attr, + &sensor_dev_attr_temp2_min_alarm.dev_attr.attr, + &sensor_dev_attr_temp2_max_alarm.dev_attr.attr, + &sensor_dev_attr_temp2_crit_alarm.dev_attr.attr, + &sensor_dev_attr_temp2_fault.dev_attr.attr, + &sensor_dev_attr_temp2_beep.dev_attr.attr, + + &sensor_dev_attr_temp3_type.dev_attr.attr, /* 20 */ + &sensor_dev_attr_temp3_input.dev_attr.attr, + &sensor_dev_attr_temp3_min.dev_attr.attr, + &sensor_dev_attr_temp3_max.dev_attr.attr, + &sensor_dev_attr_temp3_crit.dev_attr.attr, + &sensor_dev_attr_temp3_min_alarm.dev_attr.attr, + &sensor_dev_attr_temp3_max_alarm.dev_attr.attr, + &sensor_dev_attr_temp3_crit_alarm.dev_attr.attr, + &sensor_dev_attr_temp3_fault.dev_attr.attr, + &sensor_dev_attr_temp3_beep.dev_attr.attr, + + &sensor_dev_attr_temp4_input.dev_attr.attr, /* 30 */ + &sensor_dev_attr_temp4_min.dev_attr.attr, + &sensor_dev_attr_temp4_max.dev_attr.attr, + &sensor_dev_attr_temp4_crit.dev_attr.attr, + &sensor_dev_attr_temp4_min_alarm.dev_attr.attr, + &sensor_dev_attr_temp4_max_alarm.dev_attr.attr, + &sensor_dev_attr_temp4_crit_alarm.dev_attr.attr, + &sensor_dev_attr_temp4_beep.dev_attr.attr, + + NULL +}; + +static umode_t nct7511_temp_is_visible(struct kobject *kobj, + struct attribute *attr, int index) +{ + struct device *dev = container_of(kobj, struct device, kobj); + struct nct7511_data *data = dev_get_drvdata(dev); + unsigned int reg; + int err; + + err = regmap_read(data->regmap, REG_MODE, ®); + if (err < 0) + return 0; + + if (index < 10 && + (reg & 03) != 0x01 && (reg & 0x03) != 0x02) /* RD1 */ + return 0; + + if (index >= 10 && index < 20 && + (reg & 0x0c) != 0x04 && (reg & 0x0c) != 0x08) /* RD2 */ + return 0; + if (index >= 20 && index < 30 && (reg & 0x30) != 0x20) /* RD3 */ + return 0; + + if (index >= 30 && index < 38) /* local */ + return attr->mode; + + return attr->mode; +} + +static struct attribute_group nct7511_temp_group = { + .attrs = nct7511_temp_attrs, + .is_visible = nct7511_temp_is_visible, +}; + + +static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_fan, NULL, 0x10); +static SENSOR_DEVICE_ATTR_2(fan1_min, S_IRUGO | S_IWUSR, show_fan_min, + store_fan_min, 0x49, 0x4c); +static SENSOR_DEVICE_ATTR_2(fan1_alarm, S_IRUGO, show_alarm, NULL, 0x1a, 0); +static SENSOR_DEVICE_ATTR_2(fan1_beep, S_IRUGO | S_IWUSR, show_beep, store_beep, + 0x5b, 0); + +/* 7.2.89 Fan Control Output Type */ +static SENSOR_DEVICE_ATTR(pwm1_mode, S_IRUGO, show_pwm_mode, NULL, 0); + +/* 7.2.91... Fan Control Output Value */ +static SENSOR_DEVICE_ATTR(pwm1, S_IRUGO | S_IWUSR, show_pwm, store_pwm, + REG_PWM(0)); + + +/* 7.2.95... Temperature to Fan mapping Relationships Register */ +static SENSOR_DEVICE_ATTR(pwm1_enable, S_IRUGO | S_IWUSR, show_pwm_enable, + store_pwm_enable, 0); + + +static struct attribute *nct7511_fan_attrs[] = { + &sensor_dev_attr_fan1_input.dev_attr.attr, + &sensor_dev_attr_fan1_min.dev_attr.attr, + &sensor_dev_attr_fan1_alarm.dev_attr.attr, + &sensor_dev_attr_fan1_beep.dev_attr.attr, + NULL +}; + +static umode_t nct7511_fan_is_visible(struct kobject *kobj, + struct attribute *attr, int index) +{ + struct device *dev = container_of(kobj, struct device, kobj); + struct nct7511_data *data = dev_get_drvdata(dev); + int fan = index / 4; /* 4 attributes per fan */ + unsigned int reg; + int err; + + err = regmap_read(data->regmap, REG_FAN_ENABLE, ®); + if (err < 0 || !(reg & (1 << fan))) + return 0; + + return attr->mode; +} + +static struct attribute_group nct7511_fan_group = { + .attrs = nct7511_fan_attrs, + .is_visible = nct7511_fan_is_visible, +}; + +static struct attribute *nct7511_pwm_attrs[] = { + &sensor_dev_attr_pwm1_enable.dev_attr.attr, + &sensor_dev_attr_pwm1_mode.dev_attr.attr, + &sensor_dev_attr_pwm1.dev_attr.attr, + NULL +}; + +static struct attribute_group nct7511_pwm_group = { + .attrs = nct7511_pwm_attrs, +}; + +/* 7.2.115... 0x80-0x83, 0x84 Temperature (X-axis) transition */ +static SENSOR_DEVICE_ATTR_2(pwm1_auto_point1_temp, S_IRUGO | S_IWUSR, + show_temp, store_temp, 0x80, 0); +static SENSOR_DEVICE_ATTR_2(pwm1_auto_point2_temp, S_IRUGO | S_IWUSR, + show_temp, store_temp, 0x81, 0); +static SENSOR_DEVICE_ATTR_2(pwm1_auto_point3_temp, S_IRUGO | S_IWUSR, + show_temp, store_temp, 0x82, 0); +static SENSOR_DEVICE_ATTR_2(pwm1_auto_point4_temp, S_IRUGO | S_IWUSR, + show_temp, store_temp, 0x83, 0); +static SENSOR_DEVICE_ATTR_2(pwm1_auto_point5_temp, S_IRUGO | S_IWUSR, + show_temp, store_temp, 0x84, 0); + +/* 7.2.120... 0x85-0x88 PWM (Y-axis) transition */ +static SENSOR_DEVICE_ATTR(pwm1_auto_point1_pwm, S_IRUGO | S_IWUSR, + show_pwm, store_pwm, 0x85); +static SENSOR_DEVICE_ATTR(pwm1_auto_point2_pwm, S_IRUGO | S_IWUSR, + show_pwm, store_pwm, 0x86); +static SENSOR_DEVICE_ATTR(pwm1_auto_point3_pwm, S_IRUGO | S_IWUSR, + show_pwm, store_pwm, 0x87); +static SENSOR_DEVICE_ATTR(pwm1_auto_point4_pwm, S_IRUGO | S_IWUSR, + show_pwm, store_pwm, 0x88); +static SENSOR_DEVICE_ATTR(pwm1_auto_point5_pwm, S_IRUGO, show_pwm, NULL, 0); + + +static struct attribute *nct7511_auto_point_attrs[] = { + &sensor_dev_attr_pwm1_auto_point1_temp.dev_attr.attr, + &sensor_dev_attr_pwm1_auto_point2_temp.dev_attr.attr, + &sensor_dev_attr_pwm1_auto_point3_temp.dev_attr.attr, + &sensor_dev_attr_pwm1_auto_point4_temp.dev_attr.attr, + &sensor_dev_attr_pwm1_auto_point5_temp.dev_attr.attr, + + &sensor_dev_attr_pwm1_auto_point1_pwm.dev_attr.attr, + &sensor_dev_attr_pwm1_auto_point2_pwm.dev_attr.attr, + &sensor_dev_attr_pwm1_auto_point3_pwm.dev_attr.attr, + &sensor_dev_attr_pwm1_auto_point4_pwm.dev_attr.attr, + &sensor_dev_attr_pwm1_auto_point5_pwm.dev_attr.attr, + + NULL +}; + +static struct attribute_group nct7511_auto_point_group = { + .attrs = nct7511_auto_point_attrs, +}; + +static const struct attribute_group *nct7511_groups[] = { + &nct7511_temp_group, + &nct7511_fan_group, + &nct7511_pwm_group, + &nct7511_auto_point_group, + NULL +}; + +static int nct7511_detect(struct i2c_client *client, + struct i2c_board_info *info) +{ + int reg; + + reg = i2c_smbus_read_byte_data(client, REG_VENDOR_ID); + if (reg != 0x50) + return -ENODEV; + + reg = i2c_smbus_read_byte_data(client, REG_CHIP_ID); + if (reg != 0xc3) + return -ENODEV; + + reg = i2c_smbus_read_byte_data(client, REG_VERSION_ID); + if (reg < 0 || (reg & 0xf0) != 0x20) + return -ENODEV; + + /* Also validate lower bits of voltage and temperature registers */ + reg = i2c_smbus_read_byte_data(client, REG_TEMP_LSB); + if (reg < 0 || (reg & 0x1f)) + return -ENODEV; + + strlcpy(info->type, "nct7511", I2C_NAME_SIZE); + return 0; +} + +static bool nct7511_regmap_is_volatile(struct device *dev, unsigned int reg) +{ + return (reg != REG_BANK && reg <= 0x20) || + (reg >= REG_PWM(0) && reg <= REG_PWM(2)); +} + +static const struct regmap_config nct7511_regmap_config = { + .reg_bits = 8, + .val_bits = 8, + .cache_type = REGCACHE_RBTREE, + .volatile_reg = nct7511_regmap_is_volatile, +}; + +static int nct7511_init_chip(struct nct7511_data *data) +{ + int err; + + /* Enable ADC */ + err = regmap_update_bits(data->regmap, REG_START, 0x01, 0x01); + if (err) + return err; + /* Enable local temperature sensor */ + return regmap_update_bits(data->regmap, REG_MODE, 0x40, 0x40); +} + +static int nct7511_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct device *dev = &client->dev; + struct nct7511_data *data; + struct device *hwmon_dev; + int ret; + + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + if (data == NULL) + return -ENOMEM; + + data->regmap = devm_regmap_init_i2c(client, &nct7511_regmap_config); + if (IS_ERR(data->regmap)) + return PTR_ERR(data->regmap); + + mutex_init(&data->access_lock); + + ret = nct7511_init_chip(data); + if (ret < 0) + return ret; + + hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name, + data, + nct7511_groups); + return PTR_ERR_OR_ZERO(hwmon_dev); +} + + +static const struct i2c_device_id nct7511_idtable[] = { + { "nct7511", 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, nct7511_idtable); + +static struct i2c_driver nct7511_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = DRVNAME, + }, + .detect = nct7511_detect, + .probe = nct7511_probe, + .id_table = nct7511_idtable, +}; + +module_i2c_driver(nct7511_driver); + +MODULE_AUTHOR("Cameo "); +MODULE_DESCRIPTION("NCT7511Y Hardware Monitoring Driver"); +MODULE_LICENSE("GPL v2"); diff --git a/platform/innovium/sonic-platform-modules-cameo/esc601-32q/modules/x86-64-cameo-esc601-32q.c b/platform/innovium/sonic-platform-modules-cameo/esc601-32q/modules/x86-64-cameo-esc601-32q.c new file mode 100644 index 0000000000..28ea845075 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc601-32q/modules/x86-64-cameo-esc601-32q.c @@ -0,0 +1,4126 @@ +/* An hwmon driver for Cameo ESC601-32Q Innovium i2c Module */ +#pragma GCC diagnostic ignored "-Wformat-zero-length" +#include "x86-64-cameo-esc601-32q.h" + +/* Addresses scanned */ +static const unsigned short normal_i2c[] = { 0x30, 0x31, 0x32, I2C_CLIENT_END }; +#ifdef EEPROM_WANTED +static u_int8_t eeprom[1024]; +#endif +static int debug = 0; + +#if (defined THEMAL_WANTED)|| (defined ASPEED_BMC_WANTED) +int read_8bit_temp(u8 sign,u8 value) +{ + int result = 0; + if(sign) + { + //printf("read_8bit_temp UP %d\n", value & 0x80); + value = ~(value)+1; + result = value; + return result; + } + else + { + //printf("read_8bit_temp DOWN %d\n", value & 0x80); + result = value; + return result; + } +} +#endif + +/* i2c-0 function */ +#ifdef EEPROM_WANTED +static ssize_t tlv_status_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u16 i = 0; + u16 addr = 0; + u16 ret = 0x0; + u16 header_len = sizeof(tlvinfo_header_t); + u16 tlvinfo_len = 0, hibyte = 0, lobyte = 0; + + sprintf(buf, "\n"); + debug_print((KERN_ALERT "tlv_status_get header_len = %d\n", header_len)); + for (i = 0; i < header_len; i++) + { + ret = i2c_smbus_read_byte_data(Cameo_EEPROM_client, addr); + memcpy(&eeprom[i], &ret, 1); + + debug_print((KERN_ALERT "tlv_status_get data = %c\n", ret)); + debug_print((KERN_ALERT "tlv_status_get addr = 0x%X\n", addr)); + + if(i == header_len - 2) + { + hibyte = i2c_smbus_read_byte_data(Cameo_EEPROM_client, addr); + debug_print((KERN_ALERT "tlv_status_get hibyte = 0x%x\n", hibyte)); + } + if(i == header_len - 1) + { + lobyte = i2c_smbus_read_byte_data(Cameo_EEPROM_client, addr); + debug_print((KERN_ALERT "tlv_status_get lobyte = 0x%x\n", lobyte)); + } + addr++; + } + + tlvinfo_len = (hibyte << 8) | lobyte; + debug_print((KERN_ALERT "tlv_status_get tlvinfo_len = 0x%x\n", tlvinfo_len)); + + addr = header_len; + for (i = 0; i < tlvinfo_len; i++) + { + ret = i2c_smbus_read_byte_data(Cameo_EEPROM_client, addr); + memcpy(&eeprom[i + header_len], &ret, 1); + + debug_print((KERN_ALERT "tlv_status_get data = %c\n", ret)); + debug_print((KERN_ALERT "tlv_status_get addr = 0x%X\n", addr)); + + addr++; + } + eeprom[header_len + tlvinfo_len]='\0'; + show_eeprom(eeprom, buf, tlvinfo_len); + + return sprintf(buf, "%s\n", buf); +} +#endif + +static ssize_t psu_status_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 hw_ver = 0x10; // set 0x10 as default HW version + int i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + // masks for hw_ver > 0x10 + u8 PSU1_present_mask = 0x02; + u8 PSU2_present_mask = 0x01; + u8 PSU1_status_mask = 0x08; + u8 PSU2_status_mask = 0x04; + // get hw version + hw_ver = i2c_smbus_read_byte_data(ESC_601_i2c_client, 0x20); + + if(hw_ver < 0x10) + { + PSU1_present_mask = 0x01; + PSU2_present_mask = 0x02; + PSU1_status_mask = 0x04; + PSU2_status_mask = 0x08; + } + status = i2c_smbus_read_byte_data(ESC_601_i2c_client, 0xa0); + + debug_print((KERN_DEBUG "DEBUG : PSU_PRESENT status = %x\n",status)); + sprintf(buf, ""); + switch (attr->index) + { + case PSU_PRESENT: + if(hw_ver < 0x10 && hw_ver != 0x0d) + { + sprintf(buf, "%sPSU 2 is %s\n", buf, (status&PSU2_present_mask)?"not present":"present"); + sprintf(buf, "%sPSU 1 is %s\n", buf, (status&PSU1_present_mask)?"not present":"present"); + } + else + { + sprintf(buf, "%sPSU 2 is %s\n", buf, (status&PSU2_present_mask)?"present":"not present"); + sprintf(buf, "%sPSU 1 is %s\n", buf, (status&PSU1_present_mask)?"present":"not present"); + } + + break; + case PSU_STATUS: + sprintf(buf, "%sPSU 2 is %s\n", buf, (status&PSU2_status_mask)?"not power Good":"power Good"); + sprintf(buf, "%sPSU 1 is %s\n", buf, (status&PSU1_status_mask)?"not power Good":"power Good"); + + break; + } + return sprintf(buf, "%s\n", buf); +} + +#ifdef THEMAL_WANTED +static long read_reg_linear(s32 data) +{ + s16 exponent; + s32 mantissa; + long val; + + exponent = ((s16)data) >> 11; + mantissa = ((s16)((data & 0x7ff) << 5)) >> 5; + + val = mantissa; + val = val * 1000L; + + if (exponent >= 0) + val <<= exponent; + else + val >>= -exponent; + + return val/1000; +} + +static long read_reg_linear_1000(s32 data) +{ + s16 exponent; + s32 mantissa; + long val; + + exponent = ((s16)data) >> 11; + mantissa = ((s16)((data & 0x7ff) << 5)) >> 5; + + val = mantissa; + val = val * 1000L; + + if (exponent >= 0) + val <<= exponent; + else + val >>= -exponent; + + return val; +} + +static long read_reg_linear_auto(s8 mode, u16 data) +{ + s16 exponent; + s32 mantissa; + long val; + + exponent = ((s8)(mode << 3)) >> 3; + mantissa = ((u16)data); + + val = mantissa; + + /*printk(KERN_ALERT "exponent= %d, mantissa= %d, val= %d\n",exponent,mantissa,val);*/ + + if (exponent >= 0) + val <<= exponent; + else + val >>= -exponent; + + return val*1000; +} +#endif + +#ifdef PSU_DEBUG +static long read_reg_vid(s32 data) +{ + long val; + val = (((data-1)*5)+250)*1000L; + return val/1000; +} + +static long read_reg_vid_10mv(s32 data) +{ + long val; + val = (((data-1)*10)+500)*1000L; + return val/1000; +} + +static long read_reg_vid_13mv(s32 data) +{ + long val; + val = ((((data-1)*1333)+65000)/100)*1000L; + return val/1000; +} +#endif + +#ifdef PSU_STAT_WANTED +static int two_complement_to_int(u16 data, u8 valid_bit, int mask) +{ + u16 valid_data = data & mask; + bool is_negative = valid_data >> (valid_bit - 1); + + return is_negative ? (-(((~valid_data) & mask) + 1)) : valid_data; +} + +static ssize_t psu_module_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 bmc_present = -EPERM; + u8 module_num = 0; + u8 psu_table [3][11] = + { + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + {0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a}, + {0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a} + }; + u32 psu_status [11] = {0}; + u8 mask = 0x1; + u8 i = 0; + u16 u16_val = 0; + int exponent = 0, mantissa = 0; + int multiplier = 1000; // lm-sensor uint: mV, mA, mC + + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + sprintf(buf, "\n"); + + bmc_present = i2c_smbus_read_byte_data(ESC_601_i2c_client, 0xa5); + if (bmc_present & mask) + { + switch(attr->index) + { + case PSU_MODULE_1: + module_num = 1; + break; + case PSU_MODULE_2: + module_num = 2; + break; + } + + for(i = 0; i < 10; i ++) + { + u16_val = i2c_smbus_read_word_data(Cameo_BMC_client, psu_table[module_num][i]); + /* word data with linear format */ + if (i != 2 && i != 8) { + multiplier = 1000; + if (i == 6 || i == 7) /* pin, pout */ + multiplier = 1000000; // lm-sensor unit: uW + if ( i == 5 ) /* fan_speed */ + multiplier = 1; + + exponent = two_complement_to_int(u16_val >> 11, 5, 0x1f); + mantissa = two_complement_to_int(u16_val & 0x7ff, 11, 0x7ff); + psu_status[i] = (exponent >= 0) ? ((mantissa << exponent)*multiplier) : \ + (mantissa*multiplier / (1 << -exponent)); + } + } + /* vout mode */ + multiplier = 1000; + u16_val = i2c_smbus_read_byte_data(Cameo_BMC_client, psu_table[module_num][10]); + psu_status[10] = u16_val; + exponent = two_complement_to_int(u16_val & 0x1f, 5, 0x1f); + /* vout */ + u16_val = i2c_smbus_read_word_data(Cameo_BMC_client, psu_table[module_num][2]); + psu_status[2] = (exponent >= 0) ? ((u16_val << exponent)*multiplier) : \ + (u16_val*multiplier / (1 << -exponent)); + + sprintf(buf, "%sPSU %d VIN is %u\n", buf, module_num, psu_status[0]); + sprintf(buf, "%sPSU %d IIN is %u\n", buf, module_num, psu_status[1]); + sprintf(buf, "%sPSU %d VOUT is %u\n", buf, module_num, psu_status[2]); + sprintf(buf, "%sPSU %d IOUT is %u\n", buf, module_num, psu_status[3]); + sprintf(buf, "%sPSU %d TEMP_1 is %u\n", buf, module_num, psu_status[4]); + sprintf(buf, "%sPSU %d FAN_SPEED is %u\n", buf, module_num, psu_status[5]); + sprintf(buf, "%sPSU %d POUT is %u\n", buf, module_num, psu_status[6]); + sprintf(buf, "%sPSU %d PIN is %u\n", buf, module_num, psu_status[7]); + sprintf(buf, "%sPSU %d MFR_MODEL is 0x%x\n", buf, module_num, psu_status[8]); + sprintf(buf, "%sPSU %d MFR_IOUT_MAX is %u\n", buf, module_num, psu_status[9]); + sprintf(buf, "%sPSU %d VMODE is %u\n", buf, module_num, psu_status[10]); + } + else + { + sprintf(buf, "%sBMC Module is not present\n", buf); + } + return sprintf(buf, "%s\n", buf); +} + +static ssize_t dc_chip_switch_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 bmc_present = -EPERM; + u8 dc_table [10] = {0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x9a}; + u16 dc_status [10] = {0}; + u8 mask = 0x1; + u8 i = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + sprintf(buf, "\n"); + if (attr->index == DC_CHIP_SWITCH) + { + bmc_present = i2c_smbus_read_byte_data(ESC_601_i2c_client, 0xa5); //to get 0x31 0xa3 + if (bmc_present & mask) + { + for(i = 0; i < 9; i ++) + { + dc_status[i] = i2c_smbus_read_word_data(Cameo_BMC_client, dc_table[i]); + } + sprintf(buf, "%sTPS53681 0x6c 0xd4 is 0x%x\n", buf, dc_status[0]); + sprintf(buf, "%sTPS53681 0x6c 0x8c is 0x%x\n", buf, dc_status[1]); + sprintf(buf, "%sTPS53681 0x6c 0x96 is 0x%x\n", buf, dc_status[2]); + sprintf(buf, "%sTPS53681 0x6e 0xd4 is 0x%x\n", buf, dc_status[3]); + sprintf(buf, "%sTPS53681 0x6e 0x8c is 0x%x\n", buf, dc_status[4]); + sprintf(buf, "%sTPS53681 0x6e 0x96 is 0x%x\n", buf, dc_status[5]); + sprintf(buf, "%sTPS53681 0x70 0xd4 is 0x%x\n", buf, dc_status[6]); + sprintf(buf, "%sTPS53681 0x70 0x8c is 0x%x\n", buf, dc_status[7]); + sprintf(buf, "%sTPS53681 0x70 0x96 is 0x%x\n", buf, dc_status[8]); + sprintf(buf, "%sTPS53681 0x70 0x96 is 0x%x\n", buf, dc_status[9]); + } + else + { + sprintf(buf, "%sBMC Module is not present\n", buf); + } + } + return sprintf(buf, "%s\n", buf); +} + +#endif + +#ifdef USB_CTRL_WANTED +static ssize_t usb_power_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 res = 0x1; + int i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + status = i2c_smbus_read_byte_data(ESC_601_i2c_client, 0xa2); + debug_print((KERN_DEBUG "DEBUG : USB_POWER status = %x\n",status)); + sprintf(buf, ""); + if (attr->index == USB_POWER) + { + for (i = 1; i <= 2; i++) + { + if (i == GET_USB) + { + if (status & res) + { + sprintf(buf, "%sUSB Power is ON\n", buf); + } + else + { + sprintf(buf, "%sUSB Power is OFF\n", buf); + } + } + res = res << 1; + } + } + return sprintf(buf, "%s\n", buf); +} + +static ssize_t usb_power_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 status = -EPERM; + u8 value = -EPERM; + u8 result = -EPERM; + u16 i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *data = i2c_get_clientdata(ESC_601_i2c_client); + + mutex_lock(&data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_lock\n")); + status = i2c_smbus_read_byte_data(ESC_601_i2c_client, 0xa2); + debug_print((KERN_DEBUG "DEBUG : USB_POWER status = %x\n",status)); + if (attr->index == USB_POWER) + { + i = simple_strtol(buf, NULL, 10); + if (i == TURN_ON) + { + value = status | USB_ON; + debug_print((KERN_DEBUG "DEBUG : USB_POWER value = %x\n",value)); + result = i2c_smbus_write_byte_data(ESC_601_i2c_client, 0xa2, value); + debug_print((KERN_DEBUG "DEBUG : USB_POWER result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: usb_ctrl_set ON FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "USB Power is ON\n")); + } + } + else if (i == TURN_OFF) + { + value = status & USB_OFF; + debug_print((KERN_DEBUG "DEBUG : USB_POWER value = %x\n",value)); + result = i2c_smbus_write_byte_data(ESC_601_i2c_client, 0xa2, value); + debug_print((KERN_DEBUG "DEBUG : USB_POWER result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: usb_power_set OFF FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "USB Power is OFF\n")); + } + } + else + { + printk(KERN_ALERT "USB_POWER set wrong Value\n"); + } + } + mutex_unlock(&data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_unlock\n")); + return count; +} +#endif + +#ifdef LED_CTRL_WANTED +static ssize_t led_ctrl_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 res = 0x1; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + if (attr->index == LED_CTRL) + { + status = i2c_smbus_read_byte_data(ESC_601_i2c_client, 0xa2); + debug_print((KERN_DEBUG "DEBUG : LED_CTRL status = %x\n",status)); + sprintf(buf, ""); + if (status & res) + { + sprintf(buf, "%sFiber LED is set to ON\n", buf); + } + else + { + sprintf(buf, "%sFiber LED is set to OFF\n", buf); + } + } + return sprintf(buf, "%s\n", buf); +} + +static ssize_t led_ctrl_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 status = 0; + u8 value = 0; + u8 result = 0; + u16 i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *data = i2c_get_clientdata(ESC_601_i2c_client); + + mutex_lock(&data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_lock\n")); + if (attr->index == LED_CTRL) + { + i = simple_strtol(buf, NULL, 10); + if (i == TURN_ON) + { + status = i2c_smbus_read_byte_data(ESC_601_i2c_client, 0xa2); + debug_print((KERN_DEBUG "DEBUG : LED_CTRL status = %x\n",status)); + value = status | LED_ON; + debug_print((KERN_DEBUG "DEBUG : LED_CTRL value = %x\n",value)); + result = i2c_smbus_write_byte_data(ESC_601_i2c_client, 0xa2, value); + debug_print((KERN_DEBUG "DEBUG : LED_CTRL result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: led_ctrl_set on FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "DEBUG : Fiber LED is set to ON\n")); + } + } + else if (i == TURN_OFF) + { + status = i2c_smbus_read_byte_data(ESC_601_i2c_client, 0xa2); + debug_print((KERN_DEBUG "DEBUG : LED_CTRL status = %x\n",status)); + value = status & LED_OFF; + debug_print((KERN_DEBUG "DEBUG : LED_CTRL value = %x\n",value)); + result = i2c_smbus_write_byte_data(ESC_601_i2c_client, 0xa2, value); + debug_print((KERN_DEBUG "DEBUG : LED_CTRL result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: led_ctrl_set off FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "DEBUG : Fiber LED is set to OFF\n")); + } + } + else + { + printk(KERN_ALERT "LED set wrong Value\n"); + } + } + mutex_unlock(&data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_unlock\n")); + return count; +} +#endif + +static ssize_t led_loc_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 res = 0x1; + int i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + status = i2c_smbus_read_byte_data(ESC_601_i2c_client, 0xa3); + debug_print((KERN_DEBUG "DEBUG : LED_LOC status = %x\n",status)); + sprintf(buf, ""); + if (attr->index == LED_LOC) + { + for (i = 1; i <= 3; i++) + { + if (i == GET_LOC) + { + if (status & res) + { + sprintf(buf, "%sLocate LED is set to OFF\n", buf); + } + else + { + sprintf(buf, "%sLocate LED is set to Blinking\n", buf); + } + } + res = res << 1; + } + } + return sprintf(buf, "%s\n", buf); +} + +static ssize_t led_loc_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 status = 0; + u8 value = 0; + u8 result = 0; + u16 i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *data = i2c_get_clientdata(ESC_601_i2c_client); + + mutex_lock(&data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_lock\n")); + status = i2c_smbus_read_byte_data(ESC_601_i2c_client, 0xa3); + debug_print((KERN_DEBUG "DEBUG : LED_LOC status = %x\n",status)); + if (attr->index == LED_LOC) + { + i = simple_strtol(buf, NULL, 10); + if (i == LOC_OFF) + { + value = status | LOC_LED_OFF; + debug_print((KERN_DEBUG "DEBUG : LED_LOC value = %x\n",value)); + result = i2c_smbus_write_byte_data(ESC_601_i2c_client, 0xa3, value); + debug_print((KERN_DEBUG "DEBUG : LED_LOC result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: led_loc_set OFF FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "Locate LED is set to OFF\n")); + } + } + else if (i == LOC_BLINK) + { + value = status & LOC_LED_BLINK; + debug_print((KERN_DEBUG "DEBUG : LED_LOC value = %x\n",value)); + result = i2c_smbus_write_byte_data(ESC_601_i2c_client, 0xa3, value); + debug_print((KERN_DEBUG "DEBUG : LED_LOC result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: led_loc_set blinking FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "Locate LED is set to blinking\n")); + } + } + else + { + printk(KERN_ALERT "LED_LOC set wrong Value\n"); + } + } + mutex_unlock(&data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_unlock\n")); + return count; +} + +static ssize_t led_alarm_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + status = i2c_smbus_read_byte_data(ESC_601_i2c_client, 0xa3); + debug_print((KERN_DEBUG "DEBUG : LED_ALARM status = %x\n",status)); + sprintf(buf, ""); + if (attr->index == LED_ALARM) + { + if((status & 0x1) && (status & 0x2)) + { + sprintf(buf, "%sAlarm LED is set to OFF\n", buf); + } + if((status & 0x1) && (!(status & 0x2))) + { + sprintf(buf, "%sAlarm LED is set to Amber\n", buf); + } + if((!(status & 0x1)) && (status & 0x2)) + { + sprintf(buf, "%sAlarm LED is set to Green\n", buf); + } + } + return sprintf(buf, "%s\n", buf); +} + +static ssize_t led_alarm_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 status = 0; + u8 value = 0; + u8 result = 0; + u16 i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *data = i2c_get_clientdata(ESC_601_i2c_client); + + mutex_lock(&data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_lock\n")); + status = i2c_smbus_read_byte_data(ESC_601_i2c_client, 0xa3); + debug_print((KERN_DEBUG "DEBUG : LED_ALARM status = %x\n",status)); + if (attr->index == LED_ALARM) + { + i = simple_strtol(buf, NULL, 10); + if (i == ALARM_OFF) + { + value = status; + value |= 0x1; + value |= 0x2; + debug_print((KERN_DEBUG "DEBUG : LED_ALARM value = %x\n",value)); + result = i2c_smbus_write_byte_data(ESC_601_i2c_client, 0xa3, value); + debug_print((KERN_DEBUG "DEBUG : LED_ALARM result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: LED_ALARM set OFF FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "Alarm LED is set to OFF\n")); + } + } + else if (i == ALARM_AMBER) + { + value = status; + value |= 0x1; + value &= ~(0x2); + debug_print((KERN_DEBUG "DEBUG : LED_ALARM value = %x\n",value)); + result = i2c_smbus_write_byte_data(ESC_601_i2c_client, 0xa3, value); + debug_print((KERN_DEBUG "DEBUG : LED_ALARM result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: LED_ALARM set AMBER FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "Alarm LED is set to AMBER\n")); + } + } + else if (i == ALARM_GREEN) + { + value = status; + value |= 0x2; + value &= ~(0x1); + debug_print((KERN_DEBUG "DEBUG : LED_ALARM value = %x\n",value)); + result = i2c_smbus_write_byte_data(ESC_601_i2c_client, 0xa3, value); + debug_print((KERN_DEBUG "DEBUG : LED_ALARM result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: LED_ALARM set GREEN FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "Alarm LED is set to GREEN\n")); + } + } + else + { + printk(KERN_ALERT "LED_ALARM set wrong Value\n"); + } + } + mutex_unlock(&data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_unlock\n")); + return count; +} + +static ssize_t reset_mac_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 status = 0; + u8 value = 0; + u8 result = 0; + u16 i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *data = i2c_get_clientdata(ESC_601_i2c_client); + + mutex_lock(&data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_lock\n")); + status = i2c_smbus_read_byte_data(ESC_601_i2c_client, 0xa4); + debug_print((KERN_DEBUG "DEBUG : RESET_MAC status = %x\n",status)); + if (attr->index == RESET_MAC) + { + i = simple_strtol(buf, NULL, 10); + if (i == 0) + { + value = 0x0; + debug_print((KERN_DEBUG "DEBUG : RESET_MAC value = %x\n",value)); + result = i2c_smbus_write_byte_data(ESC_601_i2c_client, 0xa4, value); + debug_print((KERN_DEBUG "DEBUG : RESET_MAC result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: RESET_MAC set FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "Switch MAC chip is reset\n")); + } + } + else + { + printk(KERN_ALERT "RESET_MAC set wrong Value\n"); + } + } + mutex_unlock(&data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_unlock\n")); + return count; +} + +static ssize_t themal_status_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 res = 0x1; + int i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + status = i2c_smbus_read_byte_data(ESC_601_i2c_client, 0xc0); + debug_print((KERN_DEBUG "DEBUG : SENSOR_STATUS status = %x\n",status)); + sprintf(buf, ""); + if (attr->index == SENSOR_STATUS) + { + for (i = 1; i <= 4; i++) + { + if (status & res) + { + sprintf(buf, "%sSensor %d is OK\n", buf, i); + } + else + { + sprintf(buf, "%sSensor %d is NG\n", buf, i); + } + res = res << 1; + } + } + return sprintf(buf, "%s\n", buf); +} + +#ifdef THEMAL_WANTED +static ssize_t themal_temp_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 channel_status = -EPERM; + int i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *Switch_2_data = i2c_get_clientdata(Cameo_Switch_2_client); + struct Cameo_i2c_data *Sensor_data = i2c_get_clientdata(Cameo_Sensor_client); + + i = attr->index; + debug_print((KERN_DEBUG "DEBUG : themal_temp_get %d\n", i)); + mutex_lock(&Switch_2_data->update_lock); + mutex_lock(&Sensor_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : themal_temp_get mutex_lock\n")); + sprintf(buf, ""); + if (attr->index == SENSOR_TEMP) + { + channel_status = i2c_smbus_write_byte(Cameo_Switch_2_client, 0x02); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: themal_temp_get set channel 2 FAILED\n"); + } + status = i2c_smbus_read_byte_data(Cameo_Sensor_client, 0X0); + debug_print((KERN_DEBUG "DEBUG : Sensor 1 status = %x\n",status)); + if(status & 0x80) + { + sprintf(buf, "%sSensor 1 temp is -%d degrees (C)\n", buf, read_8bit_temp((status & 0x80),status)); + } + else + { + sprintf(buf, "%sSensor 1 temp is %d degrees (C)\n", buf, read_8bit_temp((status & 0x80),status)); + } + + channel_status = i2c_smbus_write_byte(Cameo_Switch_2_client, 0x04); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: themal_temp_get set channel 3 FAILED\n"); + } + status = i2c_smbus_read_byte_data(Cameo_Sensor_client, 0X0); + debug_print((KERN_DEBUG "DEBUG : Sensor 2 status = %x\n",status)); + if(status & 0x80) + { + sprintf(buf, "%sSensor 2 temp is -%d degrees (C)\n", buf, read_8bit_temp((status & 0x80),status)); + } + else + { + sprintf(buf, "%sSensor 2 temp is %d degrees (C)\n", buf, read_8bit_temp((status & 0x80),status)); + } + + channel_status = i2c_smbus_write_byte(Cameo_Switch_2_client, 0x08); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: themal_temp_get set channel 4 FAILED\n"); + } + status = i2c_smbus_read_byte_data(Cameo_Sensor_client, 0X0); + debug_print((KERN_DEBUG "DEBUG : Sensor 3 status = %x\n",status)); + if(status & 0x80) + { + sprintf(buf, "%sSensor 3 temp is -%d degrees (C)\n", buf, read_8bit_temp((status & 0x80),status)); + } + else + { + sprintf(buf, "%sSensor 3 temp is %d degrees (C)\n", buf, read_8bit_temp((status & 0x80),status)); + } + + channel_status = i2c_smbus_write_byte(Cameo_Switch_2_client, 0x01); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: themal_temp_get set channel 1 FAILED\n"); + } + status = i2c_smbus_read_byte_data(Cameo_Sensor_fan_client, 0X1); + debug_print((KERN_DEBUG "DEBUG : Sensor 4 status = %x\n",status)); + if(status & 0x80) + { + sprintf(buf, "%sSensor 4 temp is -%d degrees (C)\n", buf, read_8bit_temp((status & 0x80),status)); + } + else + { + sprintf(buf, "%sSensor 4 temp is %d degrees (C)\n", buf, read_8bit_temp((status & 0x80),status)); + } + } + channel_status = i2c_smbus_write_byte(Cameo_Switch_2_client, 0x0); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: themal_temp_get reset channel FAILED\n"); + } + mutex_unlock(&Switch_2_data->update_lock); + mutex_unlock(&Sensor_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_unlock\n")); + return sprintf(buf, "%s\n", buf); +} + +static ssize_t mac_temp_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u16 status = -EPERM; + u8 channel_status = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *Switch_2_data = i2c_get_clientdata(Cameo_Switch_2_client); + + mutex_lock(&Switch_2_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mac_temp_get mutex_lock\n")); + sprintf(buf, ""); + if (attr->index == MAC_TEMP) + { + channel_status = i2c_smbus_write_byte(Cameo_Switch_2_client, 0x40); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: mac_temp_get set channel 6 FAILED\n"); + } + status = i2c_smbus_read_word_data(Cameo_MAC_Sensor_client, 0X0); + debug_print((KERN_DEBUG "DEBUG : MAC Sensor status = %x\n",status)); + + sprintf(buf, "%s%x\n", buf,status); + } + channel_status = i2c_smbus_write_byte(Cameo_Switch_2_client, 0x0); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: mac_temp_get reset channel FAILED\n"); + } + mutex_unlock(&Switch_2_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_unlock\n")); + return sprintf(buf, "%s\n", buf); +} +#endif + +static ssize_t themal_mask_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 res = 0x1; + int i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + status = i2c_smbus_read_byte_data(ESC_601_i2c_client, 0xc1); + debug_print((KERN_DEBUG "DEBUG : SENSOR_INT_MASK status = %x\n",status)); + sprintf(buf, ""); + if (attr->index == SENSOR_INT_MASK) + { + for (i = 1; i <= 4; i++) + { + if (status & res) + { + sprintf(buf, "%sSensor %d interrupt is enabled\n", buf, i); + } + else + { + sprintf(buf, "%sSensor %d interrupt is disabled\n", buf, i); + } + res = res << 1; + } + } + return sprintf(buf, "%s\n", buf); +} + +static ssize_t themal_mask_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 status = -EPERM; + u8 value = -EPERM; + u8 result = -EPERM; + u8 res = 0x1; + u16 i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *data = i2c_get_clientdata(ESC_601_i2c_client); + + mutex_lock(&data->update_lock); + debug_print((KERN_DEBUG "DEBUG : themal_mask_set mutex_lock\n")); + i = simple_strtol(buf, NULL, 10); + debug_print((KERN_DEBUG "DEBUG : themal_mask_set input %d\n", i)); + status = i2c_smbus_read_byte_data(ESC_601_i2c_client, 0xc1); + debug_print((KERN_DEBUG "DEBUG : themal_mask_set status = %x\n",status)); + if (attr->index == 1) + { + if (i == TURN_ON) + { + value = status | res; + + } + else if (i == TURN_OFF) + { + value = status & (~res); + } + else + { + printk(KERN_ALERT "themal_mask_set set wrong value\n"); + } + } + else if (attr->index == 2) + { + res = res << 1; + if (i == TURN_ON) + { + value = status | res; + + } + else if (i == TURN_OFF) + { + value = status & (~res); + } + else + { + printk(KERN_ALERT "themal_mask_set set wrong value\n"); + } + } + else if (attr->index == 3) + { + res = res << 2; + if (i == TURN_ON) + { + value = status | res; + + } + else if (i == TURN_OFF) + { + value = status & (~res); + } + else + { + printk(KERN_ALERT "themal_mask_set set wrong value\n"); + } + } + else if (attr->index == 4) + { + res = res << 3; + if (i == TURN_ON) + { + value = status | res; + + } + else if (i == TURN_OFF) + { + value = status & (~res); + } + else + { + printk(KERN_ALERT "themal_mask_set set wrong value\n"); + } + } + debug_print((KERN_DEBUG "DEBUG : themal_mask_set %d value = %x\n", attr->index, value)); + result = i2c_smbus_write_byte_data(ESC_601_i2c_client, 0xc1, value); + debug_print((KERN_DEBUG "DEBUG : themal_mask_set %d result = %x\n", attr->index,result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: themal_mask_set %d FAILED!\n", attr->index); + } + else + { + debug_print((KERN_DEBUG "themal_mask_set %d : %x\n", attr->index, value)); + } + mutex_unlock(&data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_unlock\n")); + return count; +} + +static ssize_t int_status_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 res = 0x1; + int i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + res = 0x1; + status = i2c_smbus_read_byte_data(ESC_601_i2c_client, 0xd0); + debug_print((KERN_DEBUG "DEBUG : INT_STATUS status = %x\n",status)); + sprintf(buf, ""); + if (attr->index == INT_STATUS) + { + for (i = 1; i <= 7; i++) + { + if ( i == PCIE_INT) + { + if (!(status & res)) + { + sprintf(buf, "%sInterrupt is triggered by PCIe\n", buf); + } + } + else if( i == QSFP_1_INT) + { + if (!(status & res)) + { + sprintf(buf, "%sInterrupt is triggered by QSFP\n", buf); + } + } + else if( i == QSFP_2_INT) + { + if (!(status & res)) + { + sprintf(buf, "%sInterrupt is triggered by QSFP\n", buf); + } + } + else if( i == FAN_INT) + { + if (!(status & res)) + { + sprintf(buf, "%sInterrupt is triggered by FAN\n", buf); + } + } + else if( i == PSU_INT) + { + if (!(status & res)) + { + sprintf(buf, "%sInterrupt is triggered by PSU\n", buf); + } + } + else if( i == SENSOR_INT) + { + if (!(status & res)) + { + sprintf(buf, "%sInterrupt is triggered by Sensor\n", buf); + } + } + else if( i == USB_INT) + { + if (!(status & res)) + { + sprintf(buf, "%sInterrupt is triggered by USB\n", buf); + } + } + res = res << 1; + } + if(status == 0xf) + { + sprintf(buf, "%sNo interrupt is triggered\n", buf); + } + } + return sprintf(buf, "%s\n", buf); +} + +static ssize_t low_power_all_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status_1 = -EPERM; //Low power mode 01-08 port stat + u8 status_2 = -EPERM; //Low power mode 09-16 port stat + u8 status_3 = -EPERM; //Low power mode 17-24 port stat + u8 status_4 = -EPERM; //Low power mode 25-32 port stat + u8 res = 0x1; + int i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + status_1 = i2c_smbus_read_byte_data(Cameo_CPLD_2_client, 0x60); + status_2 = i2c_smbus_read_byte_data(Cameo_CPLD_2_client, 0x61); + status_3 = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0x60); + status_4 = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0x61); + debug_print((KERN_DEBUG "DEBUG : LOW_POWER_MODE_1 status = %x\n",status_1)); + debug_print((KERN_DEBUG "DEBUG : LOW_POWER_MODE_2 status = %x\n",status_2)); + debug_print((KERN_DEBUG "DEBUG : LOW_POWER_MODE_3 status = %x\n",status_3)); + debug_print((KERN_DEBUG "DEBUG : LOW_POWER_MODE_4 status = %x\n",status_4)); + sprintf(buf, ""); + if (attr->index == QSFP_LOW_POWER_ALL) + { + for (i = 1; i <= 8; i++) + { + if (status_1 & res) + { + sprintf(buf, "%sQSFP %02d low power mode: ON\n", buf, i); + } + else + { + sprintf(buf, "%sQSFP %02d low power mode: OFF\n", buf, i); + } + res = res << 1; + } + res = 0x1; + for (i = 1; i <= 8; i++) + { + if (status_2 & res) + { + sprintf(buf, "%sQSFP %02d low power mode: ON\n", buf, i + 8); + } + else + { + sprintf(buf, "%sQSFP %02d low power mode: OFF\n", buf, i + 8); + } + res = res << 1; + } + res = 0x1; + for (i = 1; i <= 8; i++) + { + if (status_3 & res) + { + sprintf(buf, "%sQSFP %02d low power mode: ON\n", buf, i + 16); + } + else + { + sprintf(buf, "%sQSFP %02d low power mode: OFF\n", buf, i + 16); + } + res = res << 1; + } + res = 0x1; + for (i = 1; i <= 8; i++) + { + if (status_4 & res) + { + sprintf(buf, "%sQSFP %02d low power mode: ON\n", buf, i + 24); + } + else + { + sprintf(buf, "%sQSFP %02d low power mode: OFF\n", buf, i + 24); + } + res = res << 1; + } + } + return sprintf(buf, "%s\n", buf); +} +static ssize_t low_power_all_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 value = 0x0; + u8 status_1 = -EPERM; //Low power mode 01-08 port stat + u8 status_2 = -EPERM; //Low power mode 09-16 port stat + u8 status_3 = -EPERM; //Low power mode 17-24 port stat + u8 status_4 = -EPERM; //Low power mode 25-32 port stat + u8 result_1 = -EPERM; + u8 result_2 = -EPERM; + u8 result_3 = -EPERM; + u8 result_4 = -EPERM; + u8 j = 0; + u16 i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *CPLD_2_data = i2c_get_clientdata(Cameo_CPLD_2_client); + struct Cameo_i2c_data *CPLD_3_data = i2c_get_clientdata(Cameo_CPLD_3_client); + + if (attr->index == QSFP_LOW_POWER_ALL) + { + i = simple_strtol(buf, NULL, 10); + status_1 = i2c_smbus_read_byte_data(Cameo_CPLD_2_client, 0x60); + status_2 = i2c_smbus_read_byte_data(Cameo_CPLD_2_client, 0x61); + status_3 = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0x60); + status_4 = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0x61); + debug_print((KERN_DEBUG "DEBUG : LOW_POWER_MODE_1 status_1 = %x\n",status_1)); + debug_print((KERN_DEBUG "DEBUG : LOW_POWER_MODE_2 status_2 = %x\n",status_2)); + debug_print((KERN_DEBUG "DEBUG : LOW_POWER_MODE_3 status_3 = %x\n",status_3)); + debug_print((KERN_DEBUG "DEBUG : LOW_POWER_MODE_4 status_4 = %x\n",status_4)); + mutex_lock(&CPLD_2_data->update_lock); + mutex_lock(&CPLD_3_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : low_power_all_set mutex_lock\n")); + if (i == TURN_ON) + { + value = 0xff; + debug_print((KERN_DEBUG "DEBUG : QSFP_LOW_POWER_ALL value = %x\n",value)); + result_1 = i2c_smbus_write_byte_data(Cameo_CPLD_2_client, 0x60, value); + result_2 = i2c_smbus_write_byte_data(Cameo_CPLD_2_client, 0x61, value); + result_3 = i2c_smbus_write_byte_data(Cameo_CPLD_3_client, 0x60, value); + result_4 = i2c_smbus_write_byte_data(Cameo_CPLD_3_client, 0x61, value); + debug_print((KERN_DEBUG "DEBUG : QSFP_LOW_POWER_ALL result_1 = %x\n",result_1)); + debug_print((KERN_DEBUG "DEBUG : QSFP_LOW_POWER_ALL result_2 = %x\n",result_2)); + debug_print((KERN_DEBUG "DEBUG : QSFP_LOW_POWER_ALL result_3 = %x\n",result_3)); + debug_print((KERN_DEBUG "DEBUG : QSFP_LOW_POWER_ALL result_4 = %x\n",result_4)); + if (result_1 < 0 || result_2 < 0 || result_3 < 0 || result_4 < 0) + { + printk(KERN_ALERT "ERROR: QSFP_LOW_POWER_ALL set ON FAILED!\n"); + } + else + { + for(j=1; j<=32; j++) + { + debug_print((KERN_DEBUG "QSFP %02d low power mode: ON\n", j)); + } + } + } + else if(i == TURN_OFF) + { + value = 0x0; + debug_print((KERN_DEBUG "DEBUG : QSFP_LOW_POWER_ALL value = %x\n",value)); + result_1 = i2c_smbus_write_byte_data(Cameo_CPLD_2_client, 0x60, value); + result_2 = i2c_smbus_write_byte_data(Cameo_CPLD_2_client, 0x61, value); + result_3 = i2c_smbus_write_byte_data(Cameo_CPLD_3_client, 0x60, value); + result_4 = i2c_smbus_write_byte_data(Cameo_CPLD_3_client, 0x61, value); + debug_print((KERN_DEBUG "DEBUG : QSFP_LOW_POWER_ALL result_1 = %x\n",result_1)); + debug_print((KERN_DEBUG "DEBUG : QSFP_LOW_POWER_ALL result_2 = %x\n",result_2)); + debug_print((KERN_DEBUG "DEBUG : QSFP_LOW_POWER_ALL result_3 = %x\n",result_3)); + debug_print((KERN_DEBUG "DEBUG : QSFP_LOW_POWER_ALL result_4 = %x\n",result_4)); + if (result_1 < 0 || result_2 < 0 || result_3 < 0 || result_4 < 0) + { + printk(KERN_ALERT "ERROR: QSFP_LOW_POWER_ALL set OFF FAILED!\n"); + } + else + { + for(j=1; j<=32; j++) + { + debug_print((KERN_DEBUG "QSFP %02d low power mode: OFF\n", j)); + } + } + } + else + { + printk(KERN_ALERT "QSFP_LOW_POWER_ALL set wrong value\n"); + } + mutex_unlock(&CPLD_2_data->update_lock); + mutex_unlock(&CPLD_3_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_unlock\n")); + } + return count; +} + +static ssize_t low_power_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; //Low power mode 01-08 port stat + u8 res = 0x1; + int i, j = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + i = attr->index; + sprintf(buf, ""); + debug_print((KERN_DEBUG "DEBUG : low_power_get port %d\n", i)); + + if (i >= 1 && i <= 8) + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_2_client, 0x60); + debug_print((KERN_DEBUG "DEBUG : LOW_POWER_MODE_%d status = %x\n", i, status)); + for (j = 1; j <= 8; j++) + { + if (j == i) + { + if (status & res) + { + sprintf(buf, "%sQSFP %02d low power mode: ON\n", buf, i); + } + else + { + sprintf(buf, "%sQSFP %02d low power mode: OFF\n", buf, i); + } + } + res = res << 1; + } + } + else if (i >= 9 && i <= 16) + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_2_client, 0x61); + debug_print((KERN_DEBUG "DEBUG : LOW_POWER_MODE_%d status = %x\n", i, status)); + for (j = 1; j <= 8; j++) + { + if (j == (i-8)) + { + if (status & res) + { + sprintf(buf, "%sQSFP %02d low power mode: ON\n", buf, i); + } + else + { + sprintf(buf, "%sQSFP %02d low power mode: OFF\n", buf, i); + } + } + res = res << 1; + } + } + else if (i >= 17 && i <= 24) + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0x60); + debug_print((KERN_DEBUG "DEBUG : LOW_POWER_MODE_%d status = %x\n", i, status)); + for (j = 1; j <= 8; j++) + { + if (j == (i-16)) + { + if (status & res) + { + sprintf(buf, "%sQSFP %02d low power mode: ON\n", buf, i); + } + else + { + sprintf(buf, "%sQSFP %02d low power mode: OFF\n", buf, i); + } + } + res = res << 1; + } + } + else if (i >= 25 && i <= 32) + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0x61); + debug_print((KERN_DEBUG "DEBUG : LOW_POWER_MODE_%d status = %x\n", i, status)); + for (j = 1; j <= 8; j++) + { + if (j == (i-24)) + { + if (status & res) + { + sprintf(buf, "%sQSFP %02d low power mode: ON\n", buf, i); + } + else + { + sprintf(buf, "%sQSFP %02d low power mode: OFF\n", buf, i); + } + } + res = res << 1; + } + } + else + { + printk(KERN_ALERT "QSFP_low_power_%d get wrong value\n", i); + } + return sprintf(buf, "%s\n", buf); +} + +static ssize_t low_power_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 status = 0; + u8 result = 0; + int i = 0; + int j = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *CPLD_2_data = i2c_get_clientdata(Cameo_CPLD_2_client); + struct Cameo_i2c_data *CPLD_3_data = i2c_get_clientdata(Cameo_CPLD_3_client); + + i = attr->index; + j = simple_strtol(buf, NULL, 10); + debug_print((KERN_DEBUG "DEBUG : low_power_set port %d\n", i)); + mutex_lock(&CPLD_2_data->update_lock); + mutex_lock(&CPLD_3_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : low_power_set mutex_lock\n")); + if (i >= 1 && i <= 8) + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_2_client, 0x60); + debug_print((KERN_DEBUG "DEBUG : LOW_POWER_MODE_1 status = %x\n",status)); + if( j == TURN_ON) + { + status |= (1 << (i-1)); + debug_print((KERN_DEBUG "DEBUG : LOW_POWER_MODE_1 value = %x\n",status)); + result = i2c_smbus_write_byte_data(Cameo_CPLD_2_client, 0x60, status); + debug_print((KERN_DEBUG "DEBUG : LOW_POWER_MODE_1 result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: QSFP_low_power_%d set ON FAILED!\n", i); + } + else + { + debug_print((KERN_DEBUG "QSFP %02d low power mode: ON\n", i)); + } + } + else if( j == TURN_OFF) + { + status &= ~(1 << (i-1)); + debug_print((KERN_DEBUG "DEBUG : LOW_POWER_MODE_1 value = %x\n",status)); + result = i2c_smbus_write_byte_data(Cameo_CPLD_2_client, 0X60, status); + debug_print((KERN_DEBUG "DEBUG : LOW_POWER_MODE_1 result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: QSFP_low_power_%d set OFF FAILED!\n", i); + } + else + { + debug_print((KERN_DEBUG "QSFP %02d low power mode: OFF\n", i)); + } + } + else + { + printk(KERN_ALERT "QSFP_low_power_%d set wrong value\n", i); + } + } + else if (i >= 9 && i <= 16) + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_2_client, 0x61); + debug_print((KERN_DEBUG "DEBUG : LOW_POWER_MODE_1 status = %x\n",status)); + if( j == TURN_ON) + { + status |= (1 << (i-9)); + debug_print((KERN_DEBUG "DEBUG : LOW_POWER_MODE_1 value = %x\n",status)); + result = i2c_smbus_write_byte_data(Cameo_CPLD_2_client, 0x61, status); + debug_print((KERN_DEBUG "DEBUG : LOW_POWER_MODE_1 result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: QSFP_low_power_%d set ON FAILED!\n", i); + } + else + { + debug_print((KERN_DEBUG "QSFP %02d low power mode: ON\n", i)); + } + } + else if( j == TURN_OFF) + { + status &= ~(1 << (i-9)); + debug_print((KERN_DEBUG "DEBUG : LOW_POWER_MODE_1 value = %x\n",status)); + result = i2c_smbus_write_byte_data(Cameo_CPLD_2_client, 0x61, status); + debug_print((KERN_DEBUG "DEBUG : LOW_POWER_MODE_1 result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: QSFP_low_power_%d set OFF FAILED!\n", i); + } + else + { + debug_print((KERN_DEBUG "QSFP %02d low power mode: OFF\n", i)); + } + } + else + { + printk(KERN_ALERT "QSFP_low_power_%d set wrong value\n", i); + } + } + else if (i >= 17 && i <= 24) + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0x60); + debug_print((KERN_DEBUG "DEBUG : LOW_POWER_MODE_1 status = %x\n",status)); + if( j == TURN_ON) + { + status |= (1 << (i-17)); + debug_print((KERN_DEBUG "DEBUG : LOW_POWER_MODE_1 value = %x\n",status)); + result = i2c_smbus_write_byte_data(Cameo_CPLD_3_client, 0x60, status); + debug_print((KERN_DEBUG "DEBUG : LOW_POWER_MODE_1 result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: QSFP_low_power_%d set ON FAILED!\n", i); + } + else + { + debug_print((KERN_DEBUG "QSFP %02d low power mode: ON\n", i)); + } + } + else if( j == TURN_OFF) + { + status &= ~(1 << (i-17)); + debug_print((KERN_DEBUG "DEBUG : LOW_POWER_MODE_1 value = %x\n",status)); + result = i2c_smbus_write_byte_data(Cameo_CPLD_3_client, 0x60, status); + debug_print((KERN_DEBUG "DEBUG : LOW_POWER_MODE_1 result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: QSFP_low_power_%d set OFF FAILED!\n", i); + } + else + { + debug_print((KERN_DEBUG "QSFP %02d low power mode: OFF\n", i)); + } + } + else + { + printk(KERN_ALERT "QSFP_low_power_%d set wrong value\n", i); + } + } + else if (i >= 25 && i <= 32) + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0x61); + debug_print((KERN_DEBUG "DEBUG : LOW_POWER_MODE_1 status = %x\n",status)); + if( j == TURN_ON) + { + status |= (1 << (i-25)); + debug_print((KERN_DEBUG "DEBUG : LOW_POWER_MODE_1 value = %x\n",status)); + result = i2c_smbus_write_byte_data(Cameo_CPLD_3_client, 0x61, status); + debug_print((KERN_DEBUG "DEBUG : LOW_POWER_MODE_1 result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: QSFP_low_power_%d set ON FAILED!\n", i); + } + else + { + debug_print((KERN_DEBUG "QSFP %02d low power mode: ON\n", i)); + } + } + else if( j == TURN_OFF) + { + status &= ~(1 << (i-25)); + debug_print((KERN_DEBUG "DEBUG : LOW_POWER_MODE_1 value = %x\n",status)); + result = i2c_smbus_write_byte_data(Cameo_CPLD_3_client, 0x61, status); + debug_print((KERN_DEBUG "DEBUG : LOW_POWER_MODE_1 result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: QSFP_low_power_%d set OFF FAILED!\n", i); + } + else + { + debug_print((KERN_DEBUG "QSFP %02d low power mode: OFF\n", i)); + } + } + else + { + printk(KERN_ALERT "QSFP_low_power_%d set wrong value\n", i); + } + } + else + { + printk(KERN_ALERT "low_power_set wrong value\n"); + } + mutex_unlock(&CPLD_2_data->update_lock); + mutex_unlock(&CPLD_3_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_unlock\n")); + return count; +} + +static ssize_t qsfp_reset_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 status = 0; + u8 value = 0; + u16 i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *CPLD_2_data = i2c_get_clientdata(Cameo_CPLD_2_client); + struct Cameo_i2c_data *CPLD_3_data = i2c_get_clientdata(Cameo_CPLD_3_client); + + mutex_lock(&CPLD_2_data->update_lock); + mutex_lock(&CPLD_3_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : qsfp_reset_set mutex_lock\n")); + if (attr->index == QSFP_RESET) + { + i = simple_strtol(buf, NULL, 10); + if (i >= 1 && i <= 8) + { + value = 0; + value = i2c_smbus_read_byte_data(Cameo_CPLD_2_client, 0x70); + debug_print((KERN_DEBUG "DEBUG : QSFP_RESET_1 value = %x\n",value)); + value ^= (1 << (i - 1)); + debug_print((KERN_DEBUG "DEBUG : QSFP_RESET_1 set value = %x\n",value)); + status = i2c_smbus_write_byte_data(Cameo_CPLD_2_client, 0x70, value); + if (status < 0) + { + printk(KERN_ALERT "ERROR: QSFP_RESET port %02d FAILED!\n", i); + } + else + { + debug_print((KERN_DEBUG "QSFP %02d reset success\n", i)); + } + } + else if (i >= 9 && i <= 16) + { + value = 0; + value = i2c_smbus_read_byte_data(Cameo_CPLD_2_client, 0x71); + debug_print((KERN_DEBUG "DEBUG : QSFP_RESET_2 value = %x\n",value)); + value ^= (1 << (i - 9)); + debug_print((KERN_DEBUG "DEBUG : QSFP_RESET_2 set value = %x\n",value)); + status = i2c_smbus_write_byte_data(Cameo_CPLD_2_client, 0x71, value); + if (status < 0) + { + printk(KERN_ALERT "ERROR: QSFP_RESET port %02d FAILED!\n", i); + } + else + { + debug_print((KERN_DEBUG "QSFP %02d reset success\n", i)); + } + } + else if (i >= 17 && i <= 24) + { + value = 0; + value = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0x70); + debug_print((KERN_DEBUG "DEBUG : QSFP_RESET_3 value = %x\n",value)); + value ^= (1 << (i - 17)); + debug_print((KERN_DEBUG "DEBUG : QSFP_RESET_3 set value = %x\n",value)); + status = i2c_smbus_write_byte_data(Cameo_CPLD_3_client, 0x70, value); + if (status < 0) + { + printk(KERN_ALERT "ERROR: QSFP_RESET port %02d FAILED!\n", i); + } + else + { + debug_print((KERN_DEBUG "QSFP %02d reset success\n", i)); + } + } + else if (i >= 25 && i <= 32) + { + value = 0; + value = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0x71); + debug_print((KERN_DEBUG "DEBUG : QSFP_RESET_4 value = %x\n",value)); + value ^= (1 << (i - 25)); + debug_print((KERN_DEBUG "DEBUG : QSFP_RESET_4 set value = %x\n",value)); + status = i2c_smbus_write_byte_data(Cameo_CPLD_3_client, 0x71, value); + if (status < 0) + { + printk(KERN_ALERT "ERROR: QSFP_RESET port %02d FAILED!\n", i); + } + else + { + debug_print((KERN_DEBUG "QSFP %02d reset success\n", i)); + } + } + else + { + printk(KERN_ALERT "qsfp_reset_set wrong value\n"); + } + } + mutex_unlock(&CPLD_2_data->update_lock); + mutex_unlock(&CPLD_3_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_unlock\n")); + return count; +} + +static ssize_t qsfp_status_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status_1 = -EPERM; //qsfp_status 01-08 port stat + u8 status_2 = -EPERM; //qsfp_status 09-16 port stat + u8 status_3 = -EPERM; //qsfp_status 17-24 port stat + u8 status_4 = -EPERM; //qsfp_status 25-32 port stat + u8 res = 0x1; + u16 i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + if (attr->index == QSFP_PRESENT) + { + sprintf(buf, ""); + status_1 = i2c_smbus_read_byte_data(Cameo_CPLD_2_client, 0x80); + status_2 = i2c_smbus_read_byte_data(Cameo_CPLD_2_client, 0x81); + status_3 = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0x80); + status_4 = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0x81); + debug_print((KERN_DEBUG "DEBUG : QSFP_PRESENT_1 status = %x\n",status_1)); + debug_print((KERN_DEBUG "DEBUG : QSFP_PRESENT_2 status = %x\n",status_2)); + debug_print((KERN_DEBUG "DEBUG : QSFP_PRESENT_3 status = %x\n",status_3)); + debug_print((KERN_DEBUG "DEBUG : QSFP_PRESENT_4 status = %x\n",status_4)); + for (i = 1; i <= 8; i++) + { + if (status_1 & res) + { + sprintf(buf, "%sQSFP %02d is not present\n", buf, i); + } + else + { + sprintf(buf, "%sQSFP %02d is present\n", buf, i); + } + res = res << 1; + } + res = 0x1; + for (i = 1; i <= 8; i++) + { + if (status_2 & res) + { + sprintf(buf, "%sQSFP %02d is not present\n", buf, i + 8); + } + else + { + sprintf(buf, "%sQSFP %02d is present\n", buf, i + 8); + } + res = res << 1; + } + res = 0x1; + for (i = 1; i <= 8; i++) + { + if (status_3 & res) + { + sprintf(buf, "%sQSFP %02d is not present\n", buf, i + 16); + } + else + { + sprintf(buf, "%sQSFP %02d is present\n", buf, i + 16); + } + res = res << 1; + } + res = 0x1; + for (i = 1; i <= 8; i++) + { + if (status_4 & res) + { + sprintf(buf, "%sQSFP %02d is not present\n", buf, i + 24); + } + else + { + sprintf(buf, "%sQSFP %02d is present\n", buf, i + 24); + } + res = res << 1; + } + } + if (attr->index == QSFP_INT) + { + sprintf(buf, ""); + status_1 = i2c_smbus_read_byte_data(Cameo_CPLD_2_client, 0x90); + status_2 = i2c_smbus_read_byte_data(Cameo_CPLD_2_client, 0x91); + status_3 = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0x90); + status_4 = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0x91); + debug_print((KERN_DEBUG "DEBUG : QSFP_INT_1 status = %x\n",status_1)); + debug_print((KERN_DEBUG "DEBUG : QSFP_INT_2 status = %x\n",status_2)); + debug_print((KERN_DEBUG "DEBUG : QSFP_INT_3 status = %x\n",status_3)); + debug_print((KERN_DEBUG "DEBUG : QSFP_INT_4 status = %x\n",status_4)); + res = 0x1; + for (i = 1; i <= 8; i++) + { + if (status_1 & res) + { + sprintf(buf, "%sQSFP %02d is OK\n", buf, i); + } + else + { + sprintf(buf, "%sQSFP %02d is abnormal\n", buf, i); + } + res = res << 1; + } + res = 0x1; + for (i = 1; i <= 8; i++) + { + if (status_2 & res) + { + sprintf(buf, "%sQSFP %02d is OK\n", buf, i + 8); + } + else + { + sprintf(buf, "%sQSFP %02d is abnormal\n", buf, i + 8); + } + res = res << 1; + } + res = 0x1; + for (i = 1; i <= 8; i++) + { + if (status_3 & res) + { + sprintf(buf, "%sQSFP %02d is OK\n", buf, i + 16); + } + else + { + sprintf(buf, "%sQSFP %02d is abnormal\n", buf, i + 16); + } + res = res << 1; + } + res = 0x1; + for (i = 1; i <= 8; i++) + { + if (status_4 & res) + { + sprintf(buf, "%sQSFP %02d is OK\n", buf, i + 24); + } + else + { + sprintf(buf, "%sQSFP %02d is abnormal\n", buf, i + 24); + } + res = res << 1; + } + } + return sprintf(buf, "%s\n", buf); +} + +#ifdef QSFP_WANTED +static ssize_t qsfp_temp_get(struct device *dev, struct device_attribute *da, char *buf) +{ + s32 res = -EPERM; + u8 channel_status = -EPERM; + u8 qsfp_channel_status = -EPERM; + u8 port_num = 1; + u16 i; + u16 j; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *Switch_1_data = i2c_get_clientdata(Cameo_Switch_1_client); + struct Cameo_i2c_data *QSFP_Switch_data = i2c_get_clientdata(Cameo_QSFP_Switch_client); + + debug_print((KERN_DEBUG "DEBUG : qsfp_temp_get mutex_lock\n")); + sprintf(buf, ""); + if (attr->index == QSFP_TEMP) + { + for(j = 0x10; j <= 0x80; j = j*2) + { + //QSFP Port 01-32 + mutex_lock(&Switch_1_data->update_lock); + channel_status = i2c_smbus_write_byte(Cameo_Switch_1_client, j); + mutex_unlock(&Switch_1_data->update_lock); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: qsfp_temp_get set channel 0x10 FAILED\n"); + } + for(i = 0x1; i <= 0x80; i = i*2) + { + mutex_lock(&QSFP_Switch_data->update_lock); + qsfp_channel_status = i2c_smbus_write_byte(Cameo_QSFP_Switch_client, i); + if(qsfp_channel_status < 0) + { + printk(KERN_ALERT "ERROR: qsfp_temp_get set qsfp channel FAILED\n"); + } + else + { + res = i2c_smbus_read_word_data(Cameo_QSFP_client, 0x16); + if (res < 0) + { + sprintf(buf, "%sQSFP %02d temp read FAILED\n", buf, port_num); + } + else + { + res = ((res&0xff00)>>8) | ((res&0xff)<<8); + res = res / 256; + sprintf(buf, "%sQSFP %02d temp is %d degrees (C)\n", buf, port_num, res); + } + } + port_num++; + mutex_unlock(&QSFP_Switch_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_unlock\n")); + } + } + } + return sprintf(buf, "%s\n", buf); +} + +static ssize_t qsfp_date_get(struct device *dev, struct device_attribute *da, char *buf) +{ + s32 res = -EPERM; + char xbuf[6]; + u8 channel_status = -EPERM; + u8 qsfp_channel_status = -EPERM; + u8 port_num = 1; + u16 i; + u16 j; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *Switch_1_data = i2c_get_clientdata(Cameo_Switch_1_client); + struct Cameo_i2c_data *QSFP_Switch_data = i2c_get_clientdata(Cameo_QSFP_Switch_client); + + debug_print((KERN_DEBUG "DEBUG : qsfp_date_get mutex_lock\n")); + sprintf(buf, ""); + if (attr->index == QSFP_DATE) + { + for(j = 0x10; j <= 0x80; j = j*2) + { + //QSFP Port 01-32 + mutex_lock(&Switch_1_data->update_lock); + channel_status = i2c_smbus_write_byte(Cameo_Switch_1_client, j); + mutex_unlock(&Switch_1_data->update_lock); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: qsfp_date_get set channel 0x10 FAILED\n"); + } + for(i = 0x1; i <= 0x80; i = i*2) + { + mutex_lock(&QSFP_Switch_data->update_lock); + qsfp_channel_status = i2c_smbus_write_byte(Cameo_QSFP_Switch_client, i); + if(qsfp_channel_status < 0) + { + printk(KERN_ALERT "ERROR: qsfp_date_get set qsfp channel FAILED\n"); + } + else + { + res = i2c_smbus_read_byte_data(Cameo_QSFP_client, 0xd4); + if (res < 0) + { + sprintf(buf, "%sQSFP %02d Date Code: FAILED\n", buf, port_num); + } + else + { + xbuf[0] = (uint8_t)i2c_smbus_read_byte_data(Cameo_QSFP_client, 0xd4); + xbuf[1] = (uint8_t)i2c_smbus_read_byte_data(Cameo_QSFP_client, 0xd5); + xbuf[2] = (uint8_t)i2c_smbus_read_byte_data(Cameo_QSFP_client, 0xd6); + xbuf[3] = (uint8_t)i2c_smbus_read_byte_data(Cameo_QSFP_client, 0xd7); + xbuf[4] = (uint8_t)i2c_smbus_read_byte_data(Cameo_QSFP_client, 0xd8); + xbuf[5] = (uint8_t)i2c_smbus_read_byte_data(Cameo_QSFP_client, 0xd9); + sprintf(buf, "%sQSFP %02d Date Code: 20%c%c-%c%c-%c%c\n", buf, port_num, xbuf[0], xbuf[1], xbuf[2], xbuf[3], xbuf[4], xbuf[5]); + } + } + port_num++; + mutex_unlock(&QSFP_Switch_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_unlock\n")); + } + } + } + return sprintf(buf, "%s\n", buf); +} + +static ssize_t qsfp_sn_get(struct device *dev, struct device_attribute *da, char *buf) +{ + s32 res = -EPERM; + char xbuf[16]; + u8 channel_status = -EPERM; + u8 qsfp_channel_status = -EPERM; + u8 port_num = 1; + u8 reg; + u16 i; + u16 j; + u16 k; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *Switch_1_data = i2c_get_clientdata(Cameo_Switch_1_client); + struct Cameo_i2c_data *QSFP_Switch_data = i2c_get_clientdata(Cameo_QSFP_Switch_client); + + debug_print((KERN_DEBUG "DEBUG : qsfp_sn_get mutex_lock\n")); + sprintf(buf, "\n"); + if (attr->index == QSFP_SN) + { + for(j = 0x10; j <= 0x80; j = j*2) + { + //QSFP Port 01-32 + mutex_lock(&Switch_1_data->update_lock); + channel_status = i2c_smbus_write_byte(Cameo_Switch_1_client, j); + mutex_unlock(&Switch_1_data->update_lock); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: qsfp_sn_get set channel 0x10 FAILED\n"); + } + for(i = 0x1; i <= 0x80; i = i*2) + { + mutex_lock(&QSFP_Switch_data->update_lock); + qsfp_channel_status = i2c_smbus_write_byte(Cameo_QSFP_Switch_client, i); + if(qsfp_channel_status < 0) + { + printk(KERN_ALERT "ERROR: qsfp_sn_get set qsfp channel FAILED\n"); + } + else + { + res = i2c_smbus_read_byte_data(Cameo_QSFP_client, 0xc4); + if (res < 0) + { + sprintf(buf, "%sQSFP %02d SN: FAILED\n", buf, port_num); + } + else + { + reg = 0xc4; + for(k = 0; k < 15; k++) + { + xbuf[k] = (uint8_t)i2c_smbus_read_byte_data(Cameo_QSFP_client, reg); + reg = reg + 1; + } + sprintf(buf, "%sQSFP %02d SN: %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c \n", buf, port_num, + xbuf[0], xbuf[1], xbuf[2], xbuf[3], + xbuf[4], xbuf[5], xbuf[6], xbuf[7], + xbuf[8], xbuf[9], xbuf[10], xbuf[11], + xbuf[12], xbuf[13], xbuf[14], xbuf[15] + ); + } + } + port_num++; + mutex_unlock(&QSFP_Switch_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_unlock\n")); + } + } + } + return sprintf(buf, "%s\n", buf); +} + +static ssize_t qsfp_pn_get(struct device *dev, struct device_attribute *da, char *buf) +{ + s32 res = -EPERM; + char xbuf[16]; + u8 channel_status = -EPERM; + u8 qsfp_channel_status = -EPERM; + u8 port_num = 1; + u8 reg; + u16 i; + u16 j; + u16 k; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *Switch_1_data = i2c_get_clientdata(Cameo_Switch_1_client); + struct Cameo_i2c_data *QSFP_Switch_data = i2c_get_clientdata(Cameo_QSFP_Switch_client); + + debug_print((KERN_DEBUG "DEBUG : qsfp_pn_get mutex_lock\n")); + sprintf(buf, ""); + if (attr->index == QSFP_PN) + { + for(j = 0x10; j <= 0x80; j = j*2) + { + //QSFP Port 01-32 + mutex_lock(&Switch_1_data->update_lock); + channel_status = i2c_smbus_write_byte(Cameo_Switch_1_client, j); + mutex_unlock(&Switch_1_data->update_lock); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: qsfp_pn_get set channel 0x10 FAILED\n"); + } + for(i = 0x1; i <= 0x80; i = i*2) + { + mutex_lock(&QSFP_Switch_data->update_lock); + qsfp_channel_status = i2c_smbus_write_byte(Cameo_QSFP_Switch_client, i); + if(qsfp_channel_status < 0) + { + printk(KERN_ALERT "ERROR: qsfp_pn_get set qsfp channel FAILED\n"); + } + else + { + res = i2c_smbus_read_byte_data(Cameo_QSFP_client, 0xa8); + if (res < 0) + { + sprintf(buf, "%sQSFP %02d PN: FAILED\n", buf, port_num); + } + else + { + reg = 0xa8; + for(k = 0; k < 15; k++) + { + xbuf[k] = (uint8_t)i2c_smbus_read_byte_data(Cameo_QSFP_client, reg); + reg = reg + 1; + } + sprintf(buf, "%sQSFP %02d PN: %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c\n", buf, port_num, + xbuf[0], xbuf[1], xbuf[2], xbuf[3], + xbuf[4], xbuf[5], xbuf[6], xbuf[7], + xbuf[8], xbuf[9], xbuf[10], xbuf[11], + xbuf[12], xbuf[13], xbuf[14], xbuf[15] + ); + } + } + port_num++; + mutex_unlock(&QSFP_Switch_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_unlock\n")); + } + } + } + return sprintf(buf, "%s\n", buf); +} + +static ssize_t qsfp_name_get(struct device *dev, struct device_attribute *da, char *buf) +{ + s32 res = -EPERM; + char xbuf[16]; + u8 channel_status = -EPERM; + u8 qsfp_channel_status = -EPERM; + u8 port_num = 1; + u8 reg; + u16 i; + u16 j; + u16 k; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *Switch_1_data = i2c_get_clientdata(Cameo_Switch_1_client); + struct Cameo_i2c_data *QSFP_Switch_data = i2c_get_clientdata(Cameo_QSFP_Switch_client); + + debug_print((KERN_DEBUG "DEBUG : qsfp_name_get mutex_lock\n")); + sprintf(buf, ""); + if (attr->index == QSFP_NAME) + { + for(j = 0x10; j <= 0x80; j = j*2) + { + //QSFP Port 01-32 + mutex_lock(&Switch_1_data->update_lock); + channel_status = i2c_smbus_write_byte(Cameo_Switch_1_client, j); + mutex_unlock(&Switch_1_data->update_lock); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: qsfp_name_get set channel 0x10 FAILED\n"); + } + for(i = 0x1; i <= 0x80; i = i*2) + { + mutex_lock(&QSFP_Switch_data->update_lock); + qsfp_channel_status = i2c_smbus_write_byte(Cameo_QSFP_Switch_client, i); + if(qsfp_channel_status < 0) + { + printk(KERN_ALERT "ERROR: qsfp_name_get set qsfp channel FAILED\n"); + } + else + { + res = i2c_smbus_read_byte_data(Cameo_QSFP_client, 0x94); + if (res < 0) + { + sprintf(buf, "%sQSFP %02d Name: FAILED\n", buf, port_num); + } + else + { + reg = 0x94; + for(k = 0; k < 15; k++) + { + xbuf[k] = (uint8_t)i2c_smbus_read_byte_data(Cameo_QSFP_client, reg); + reg = reg + 1; + } + sprintf(buf, "%sQSFP %02d Name: %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c\n", buf, port_num, + xbuf[0], xbuf[1], xbuf[2], xbuf[3], + xbuf[4], xbuf[5], xbuf[6], xbuf[7], + xbuf[8], xbuf[9], xbuf[10], xbuf[11], + xbuf[12], xbuf[13], xbuf[14], xbuf[15] + ); + } + } + port_num++; + mutex_unlock(&QSFP_Switch_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_unlock\n")); + } + } + } + return sprintf(buf, "%s\n", buf); +} + +static ssize_t qsfp_oui_get(struct device *dev, struct device_attribute *da, char *buf) +{ + s32 res = -EPERM; + char xbuf[3]; + u8 channel_status = -EPERM; + u8 qsfp_channel_status = -EPERM; + u8 port_num = 1; + u8 reg; + u16 i; + u16 j; + u16 k; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *Switch_1_data = i2c_get_clientdata(Cameo_Switch_1_client); + struct Cameo_i2c_data *QSFP_Switch_data = i2c_get_clientdata(Cameo_QSFP_Switch_client); + + debug_print((KERN_DEBUG "DEBUG : qsfp_oui_get mutex_lock\n")); + sprintf(buf, ""); + if (attr->index == QSFP_OUI) + { + for(j = 0x10; j <= 0x80; j = j*2) + { + //QSFP Port 01-32 + mutex_lock(&Switch_1_data->update_lock); + channel_status = i2c_smbus_write_byte(Cameo_Switch_1_client, j); + mutex_unlock(&Switch_1_data->update_lock); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: qsfp_oui_get set channel 0x10 FAILED\n"); + } + for(i = 0x1; i <= 0x80; i = i*2) + { + mutex_lock(&QSFP_Switch_data->update_lock); + qsfp_channel_status = i2c_smbus_write_byte(Cameo_QSFP_Switch_client, i); + if(qsfp_channel_status < 0) + { + printk(KERN_ALERT "ERROR: qsfp_oui_get set qsfp channel FAILED\n"); + } + else + { + res = i2c_smbus_read_byte_data(Cameo_QSFP_client, 0xa5); + if (res < 0) + { + sprintf(buf, "%sQSFP %02d OUI: FAILED\n", buf, port_num); + } + else + { + reg = 0xa5; + for(k = 0; k < 3; k++) + { + xbuf[k] = (uint8_t)i2c_smbus_read_byte_data(Cameo_QSFP_client, reg); + reg = reg + 1; + } + sprintf(buf, "%sQSFP %02d OUI: %02X-%02X-%02X\n", buf, port_num, + xbuf[0], xbuf[1], xbuf[2]); + } + } + port_num++; + mutex_unlock(&QSFP_Switch_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_unlock\n")); + } + } + } + return sprintf(buf, "%s\n", buf); +} + +static ssize_t qsfp_rev_get(struct device *dev, struct device_attribute *da, char *buf) +{ + s32 res = -EPERM; + char xbuf[2]; + u8 channel_status = -EPERM; + u8 qsfp_channel_status = -EPERM; + u8 port_num = 1; + u8 reg; + u16 i; + u16 j; + u16 k; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *Switch_1_data = i2c_get_clientdata(Cameo_Switch_1_client); + struct Cameo_i2c_data *QSFP_Switch_data = i2c_get_clientdata(Cameo_QSFP_Switch_client); + + debug_print((KERN_DEBUG "DEBUG : qsfp_rev_get mutex_lock\n")); + sprintf(buf, ""); + if (attr->index == QSFP_REV) + { + for(j = 0x10; j <= 0x80; j = j*2) + { + //QSFP Port 01-32 + mutex_lock(&Switch_1_data->update_lock); + channel_status = i2c_smbus_write_byte(Cameo_Switch_1_client, j); + mutex_unlock(&Switch_1_data->update_lock); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: qsfp_rev_get set channel 0x10 FAILED\n"); + } + for(i = 0x1; i <= 0x80; i = i*2) + { + mutex_lock(&QSFP_Switch_data->update_lock); + qsfp_channel_status = i2c_smbus_write_byte(Cameo_QSFP_Switch_client, i); + if(qsfp_channel_status < 0) + { + printk(KERN_ALERT "ERROR: qsfp_rev_get set qsfp channel FAILED\n"); + } + else + { + res = i2c_smbus_read_byte_data(Cameo_QSFP_client, 0xb8); + if (res < 0) + { + sprintf(buf, "%sQSFP %02d Rev: FAILED\n", buf, port_num); + } + else + { + reg = 0xb8; + for(k = 0; k < 2; k++) + { + xbuf[k] = (uint8_t)i2c_smbus_read_byte_data(Cameo_QSFP_client, reg); + reg = reg + 1; + } + sprintf(buf, "%sQSFP %02d Rev: %c\n", buf, port_num, + xbuf[0]); + } + } + port_num++; + mutex_unlock(&QSFP_Switch_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_unlock\n")); + } + } + } + return sprintf(buf, "%s\n", buf); +} + +static ssize_t qsfp_connector_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int res = -EPERM; + u8 channel_status = -EPERM; + u8 qsfp_channel_status = -EPERM; + u8 port_num = 1; + u16 i; + u16 j; + u16 k; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *Switch_1_data = i2c_get_clientdata(Cameo_Switch_1_client); + struct Cameo_i2c_data *QSFP_Switch_data = i2c_get_clientdata(Cameo_QSFP_Switch_client); + + debug_print((KERN_DEBUG "DEBUG : qsfp_connector_get mutex_lock\n")); + sprintf(buf, ""); + if (attr->index == QSFP_CONNECTOR) + { + for(j = 0x10; j <= 0x80; j = j*2) + { + //QSFP Port 01-32 + mutex_lock(&Switch_1_data->update_lock); + channel_status = i2c_smbus_write_byte(Cameo_Switch_1_client, j); + mutex_unlock(&Switch_1_data->update_lock); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: qsfp_connector_get set channel 0x10 FAILED\n"); + } + for(i = 0x1; i <= 0x80; i = i*2) + { + mutex_lock(&QSFP_Switch_data->update_lock); + qsfp_channel_status = i2c_smbus_write_byte(Cameo_QSFP_Switch_client, i); + if(qsfp_channel_status < 0) + { + printk(KERN_ALERT "ERROR: qsfp_connector_get set qsfp channel FAILED\n"); + } + else + { + res = i2c_smbus_read_byte_data(Cameo_QSFP_client, 0x82); + if (res < 0) + { + sprintf(buf, "%sQSFP %02d Connector: FAILED\n", buf, port_num); + } + else + { + for(k=0; k<17; k++) + { + if(conn[k].v == res) + { + sprintf(buf, "%sQSFP %02d Connector: %s\n", buf, port_num, conn[k].n); + break; + } + } + } + } + port_num++; + mutex_unlock(&QSFP_Switch_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_unlock\n")); + } + } + } + return sprintf(buf, "%s\n", buf); +} + +static ssize_t qsfp_encoding_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int res = -EPERM; + u8 channel_status = -EPERM; + u8 qsfp_channel_status = -EPERM; + u8 port_num = 1; + u16 i; + u16 j; + u16 k; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *Switch_1_data = i2c_get_clientdata(Cameo_Switch_1_client); + struct Cameo_i2c_data *QSFP_Switch_data = i2c_get_clientdata(Cameo_QSFP_Switch_client); + + debug_print((KERN_DEBUG "DEBUG : qsfp_encoding_get mutex_lock\n")); + sprintf(buf, ""); + if (attr->index == QSFP_ENCODING) + { + for(j = 0x10; j <= 0x80; j = j*2) + { + //QSFP Port 01-32 + mutex_lock(&Switch_1_data->update_lock); + channel_status = i2c_smbus_write_byte(Cameo_Switch_1_client, j); + mutex_unlock(&Switch_1_data->update_lock); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: qsfp_encoding_get set channel 0x10 FAILED\n"); + } + for(i = 0x1; i <= 0x80; i = i*2) + { + mutex_lock(&QSFP_Switch_data->update_lock); + qsfp_channel_status = i2c_smbus_write_byte(Cameo_QSFP_Switch_client, i); + if(qsfp_channel_status < 0) + { + printk(KERN_ALERT "ERROR: qsfp_encoding_get set qsfp channel FAILED\n"); + } + else + { + res = i2c_smbus_read_byte_data(Cameo_QSFP_client, 0x8b); + if (res < 0) + { + sprintf(buf, "%sQSFP %02d Encoding: FAILED\n", buf, port_num); + } + else + { + for(k=0; k<7; k++) + { + if(encoding[k].v == res) + { + sprintf(buf, "%sQSFP %02d Encoding: %s\n", buf, port_num, encoding[k].n); + break; + } + } + } + } + port_num++; + mutex_unlock(&QSFP_Switch_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_unlock\n")); + } + } + } + return sprintf(buf, "%s\n", buf); +} + +static ssize_t qsfp_nominal_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int res = -EPERM; + u8 channel_status = -EPERM; + u8 qsfp_channel_status = -EPERM; + u8 port_num = 1; + u16 i; + u16 j; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *Switch_1_data = i2c_get_clientdata(Cameo_Switch_1_client); + struct Cameo_i2c_data *QSFP_Switch_data = i2c_get_clientdata(Cameo_QSFP_Switch_client); + + debug_print((KERN_DEBUG "DEBUG : qsfp_nominal_get mutex_lock\n")); + sprintf(buf, ""); + if (attr->index == QSFP_NOMINAL) + { + for(j = 0x10; j <= 0x80; j = j*2) + { + //QSFP Port 01-32 + mutex_lock(&Switch_1_data->update_lock); + channel_status = i2c_smbus_write_byte(Cameo_Switch_1_client, j); + mutex_unlock(&Switch_1_data->update_lock); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: qsfp_nominal_get set channel 0x10 FAILED\n"); + } + for(i = 0x1; i <= 0x80; i = i*2) + { + mutex_lock(&QSFP_Switch_data->update_lock); + qsfp_channel_status = i2c_smbus_write_byte(Cameo_QSFP_Switch_client, i); + if(qsfp_channel_status < 0) + { + printk(KERN_ALERT "ERROR: qsfp_nominal_get set qsfp channel FAILED\n"); + } + else + { + res = i2c_smbus_read_byte_data(Cameo_QSFP_client, 0x8c); + if (res < 0) + { + sprintf(buf, "%sQSFP %02d Nominal Bit Rate(100Mbs): FAILED\n", buf, port_num); + } + else + { + sprintf(buf, "%sQSFP %02d Nominal Bit Rate(100Mbs): %d\n", buf, port_num, res); + } + } + port_num++; + mutex_unlock(&QSFP_Switch_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_unlock\n")); + } + } + } + return sprintf(buf, "%s\n", buf); +} + +static ssize_t qsfp_ext_rate_com_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int res = -EPERM; + u8 channel_status = -EPERM; + u8 qsfp_channel_status = -EPERM; + u8 port_num = 1; + u16 i; + u16 j; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *Switch_1_data = i2c_get_clientdata(Cameo_Switch_1_client); + struct Cameo_i2c_data *QSFP_Switch_data = i2c_get_clientdata(Cameo_QSFP_Switch_client); + + debug_print((KERN_DEBUG "DEBUG : qsfp_ext_rate_com_get mutex_lock\n")); + sprintf(buf, ""); + if (attr->index == QSFP_EXT_RATE_COM) + { + for(j = 0x10; j <= 0x80; j = j*2) + { + //QSFP Port 01-32 + mutex_lock(&Switch_1_data->update_lock); + channel_status = i2c_smbus_write_byte(Cameo_Switch_1_client, j); + mutex_unlock(&Switch_1_data->update_lock); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: qsfp_ext_rate_com_get set channel 0x10 FAILED\n"); + } + for(i = 0x1; i <= 0x80; i = i*2) + { + mutex_lock(&QSFP_Switch_data->update_lock); + qsfp_channel_status = i2c_smbus_write_byte(Cameo_QSFP_Switch_client, i); + if(qsfp_channel_status < 0) + { + printk(KERN_ALERT "ERROR: qsfp_ext_rate_com_get set qsfp channel FAILED\n"); + } + else + { + res = i2c_smbus_read_byte_data(Cameo_QSFP_client, 0x8d); + if (res < 0) + { + sprintf(buf, "%sQSFP %02d Extended RateSelect Compliance: FAILED\n", buf, port_num); + } + else if(res == 0) + { + sprintf(buf, "%sQSFP %02d Extended RateSelect Compliance: QSFP+ Rate Select Version 1\n", buf, port_num); + } + else + { + sprintf(buf, "%sQSFP %02d Extended RateSelect Compliance: Unknown\n", buf, port_num); + } + } + port_num++; + mutex_unlock(&QSFP_Switch_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_unlock\n")); + } + } + } + return sprintf(buf, "%s\n", buf); +} + +static ssize_t qsfp_eth_com_code_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int res = -EPERM; + u8 channel_status = -EPERM; + u8 qsfp_channel_status = -EPERM; + u8 port_num = 1; + u16 i; + u16 j; + u16 k; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *Switch_1_data = i2c_get_clientdata(Cameo_Switch_1_client); + struct Cameo_i2c_data *QSFP_Switch_data = i2c_get_clientdata(Cameo_QSFP_Switch_client); + + debug_print((KERN_DEBUG "DEBUG : qsfp_eth_com_code_get mutex_lock\n")); + sprintf(buf, ""); + if (attr->index == QSFP_ETH_COM_CODE) + { + for(j = 0x10; j <= 0x80; j = j*2) + { + //QSFP Port 01-32 + mutex_lock(&Switch_1_data->update_lock); + channel_status = i2c_smbus_write_byte(Cameo_Switch_1_client, j); + mutex_unlock(&Switch_1_data->update_lock); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: qsfp_eth_com_code_get set channel 0x10 FAILED\n"); + } + for(i = 0x1; i <= 0x80; i = i*2) + { + mutex_lock(&QSFP_Switch_data->update_lock); + qsfp_channel_status = i2c_smbus_write_byte(Cameo_QSFP_Switch_client, i); + if(qsfp_channel_status < 0) + { + printk(KERN_ALERT "ERROR: qsfp_eth_com_code_get set qsfp channel FAILED\n"); + } + else + { + res = i2c_smbus_read_byte_data(Cameo_QSFP_client, 0x83); + if (res < 0) + { + sprintf(buf, "%sQSFP %02d 10/40G Ethernet Compliance Code: FAILED\n", buf, port_num); + } + else + { + for(k=0; k<9; k++) + { + if(eth_1040g[k].v == res) + { + sprintf(buf, "%sQSFP %02d 10/40G Ethernet Compliance Code: %s\n", buf, port_num, eth_1040g[k].n); + break; + } + if(eth_1040g[k].n == NULL) + { + sprintf(buf, "%sQSFP %02d 10/40G Ethernet Compliance Code: Unknown\n", buf, port_num); + break; + } + } + } + } + port_num++; + mutex_unlock(&QSFP_Switch_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_unlock\n")); + } + } + } + return sprintf(buf, "%s\n", buf); +} + +static ssize_t qsfp_identifier_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int res = -EPERM; + u8 channel_status = -EPERM; + u8 qsfp_channel_status = -EPERM; + u8 port_num = 1; + u16 i; + u16 j; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *Switch_1_data = i2c_get_clientdata(Cameo_Switch_1_client); + struct Cameo_i2c_data *QSFP_Switch_data = i2c_get_clientdata(Cameo_QSFP_Switch_client); + + debug_print((KERN_DEBUG "DEBUG : qsfp_identifier_get mutex_lock\n")); + sprintf(buf, ""); + if (attr->index == QSFP_IDENTIFIER) + { + for(j = 0x10; j <= 0x80; j = j*2) + { + //QSFP Port 01-32 + mutex_lock(&Switch_1_data->update_lock); + channel_status = i2c_smbus_write_byte(Cameo_Switch_1_client, j); + mutex_unlock(&Switch_1_data->update_lock); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: qsfp_identifier_get set channel 0x10 FAILED\n"); + } + for(i = 0x1; i <= 0x80; i = i*2) + { + mutex_lock(&QSFP_Switch_data->update_lock); + qsfp_channel_status = i2c_smbus_write_byte(Cameo_QSFP_Switch_client, i); + if(qsfp_channel_status < 0) + { + printk(KERN_ALERT "ERROR: qsfp_identifier_get set qsfp channel FAILED\n"); + } + else + { + res = i2c_smbus_read_byte_data(Cameo_QSFP_client, 0x80); + if (res < 0) + { + sprintf(buf, "%sQSFP %02d Identifier: FAILED\n", buf, port_num); + } + else if(res == 0x0c) + { + sprintf(buf, "%sQSFP %02d Identifier: QSFP\n", buf, port_num); + } + else if(res == 0x0d) + { + sprintf(buf, "%sQSFP %02d Identifier: QSFP+\n", buf, port_num); + } + else + { + sprintf(buf, "%sQSFP %02d Identifier: Unknown\n", buf, port_num); + } + } + port_num++; + mutex_unlock(&QSFP_Switch_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_unlock\n")); + } + } + } + return sprintf(buf, "%s\n", buf); +} + +static ssize_t qsfp_fc_media_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int res = -EPERM; + u8 channel_status = -EPERM; + u8 qsfp_channel_status = -EPERM; + u8 port_num = 1; + u16 i; + u16 j; + u16 k; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *Switch_1_data = i2c_get_clientdata(Cameo_Switch_1_client); + struct Cameo_i2c_data *QSFP_Switch_data = i2c_get_clientdata(Cameo_QSFP_Switch_client); + + debug_print((KERN_DEBUG "DEBUG : qsfp_fc_media_get mutex_lock\n")); + sprintf(buf, ""); + if (attr->index == QSFP_FCMEDIA) + { + for(j = 0x10; j <= 0x80; j = j*2) + { + //QSFP Port 01-32 + mutex_lock(&Switch_1_data->update_lock); + channel_status = i2c_smbus_write_byte(Cameo_Switch_1_client, j); + mutex_unlock(&Switch_1_data->update_lock); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: qsfp_fc_media_get set channel 0x10 FAILED\n"); + } + for(i = 0x1; i <= 0x80; i = i*2) + { + mutex_lock(&QSFP_Switch_data->update_lock); + qsfp_channel_status = i2c_smbus_write_byte(Cameo_QSFP_Switch_client, i); + if(qsfp_channel_status < 0) + { + printk(KERN_ALERT "ERROR: qsfp_fc_media_get set qsfp channel FAILED\n"); + } + else + { + res = i2c_smbus_read_byte_data(Cameo_QSFP_client, 0x89); + if (res < 0) + { + sprintf(buf, "%sQSFP %02d Fibre Channel transmission media: FAILED\n", buf, port_num); + } + else + { + for(k=0; k<9; k++) + { + if(fc_media[k].v == res) + { + sprintf(buf, "%sQSFP %02d Fibre Channel transmission media: %s\n", buf, port_num, fc_media[k].n); + break; + } + } + } + } + port_num++; + mutex_unlock(&QSFP_Switch_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_unlock\n")); + } + } + } + return sprintf(buf, "%s\n", buf); +} + +static ssize_t qsfp_fc_speed_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int res = -EPERM; + u8 channel_status = -EPERM; + u8 qsfp_channel_status = -EPERM; + u8 port_num = 1; + u16 i; + u16 j; + const char *tech_speed; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *Switch_1_data = i2c_get_clientdata(Cameo_Switch_1_client); + struct Cameo_i2c_data *QSFP_Switch_data = i2c_get_clientdata(Cameo_QSFP_Switch_client); + + debug_print((KERN_DEBUG "DEBUG : qsfp_fc_speed_get mutex_lock\n")); + sprintf(buf, ""); + if (attr->index == QSFP_FCSPEED) + { + for(j = 0x10; j <= 0x80; j = j*2) + { + //QSFP Port 01-32 + mutex_lock(&Switch_1_data->update_lock); + channel_status = i2c_smbus_write_byte(Cameo_Switch_1_client, j); + mutex_unlock(&Switch_1_data->update_lock); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: qsfp_fc_speed_get set channel 0x10 FAILED\n"); + } + for(i = 0x1; i <= 0x80; i = i*2) + { + mutex_lock(&QSFP_Switch_data->update_lock); + qsfp_channel_status = i2c_smbus_write_byte(Cameo_QSFP_Switch_client, i); + if(qsfp_channel_status < 0) + { + printk(KERN_ALERT "ERROR: qsfp_fc_speed_get set qsfp channel FAILED\n"); + } + else + { + tech_speed = NULL; + res = i2c_smbus_read_byte_data(Cameo_QSFP_client, 0x8a); + if (res < 0) + { + sprintf(buf, "%sQSFP %02d Fibre Channel Speed: FAILED\n", buf, port_num); + } + else + { + tech_speed = find_zero_bit(fc_speed, res, 1); + sprintf(buf, "%sQSFP %02d Fibre Channel Speed: %s\n", buf, port_num, tech_speed); + } + } + port_num++; + mutex_unlock(&QSFP_Switch_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_unlock\n")); + } + } + } + return sprintf(buf, "%s\n", buf); +} + +static ssize_t qsfp_cab_tech_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int res = -EPERM; + u8 channel_status = -EPERM; + u8 qsfp_channel_status = -EPERM; + u8 port_num = 1; + u16 i; + u16 j; + const char *tech_tech; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *Switch_1_data = i2c_get_clientdata(Cameo_Switch_1_client); + struct Cameo_i2c_data *QSFP_Switch_data = i2c_get_clientdata(Cameo_QSFP_Switch_client); + + debug_print((KERN_DEBUG "DEBUG : qsfp_cab_tech_get mutex_lock\n")); + sprintf(buf, ""); + if (attr->index == QSFP_FCTECH) + { + for(j = 0x10; j <= 0x80; j = j*2) + { + //QSFP Port 01-32 + mutex_lock(&Switch_1_data->update_lock); + channel_status = i2c_smbus_write_byte(Cameo_Switch_1_client, j); + mutex_unlock(&Switch_1_data->update_lock); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: qsfp_cab_tech_get set channel 0x10 FAILED\n"); + } + for(i = 0x1; i <= 0x80; i = i*2) + { + mutex_lock(&QSFP_Switch_data->update_lock); + qsfp_channel_status = i2c_smbus_write_byte(Cameo_QSFP_Switch_client, i); + if(qsfp_channel_status < 0) + { + printk(KERN_ALERT "ERROR: qsfp_cab_tech_get set qsfp channel FAILED\n"); + } + else + { + tech_tech = NULL; + res = ((i2c_smbus_read_byte_data(Cameo_QSFP_client, 0x87) << 8) | i2c_smbus_read_byte_data(Cameo_QSFP_client, 0x88)); + if (res < 0) + { + sprintf(buf, "%sQSFP %02d Fibre Channel link length/Transmitter Technology: FAILED\n", buf, port_num); + } + else + { + tech_tech = find_zero_bit(cab_tech, res, 2); + sprintf(buf, "%sQSFP %02d Fibre Channel link length/Transmitter Technology: %s\n", buf, port_num, tech_tech); + } + } + port_num++; + mutex_unlock(&QSFP_Switch_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_unlock\n")); + } + } + } + return sprintf(buf, "%s\n", buf); +} +#endif + +static ssize_t fan_status_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 res=0x1; + u16 fan_speed; + int i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *target_client = NULL; + + sprintf(buf, ""); + if (attr->index == FAN_STATUS) + { + if(i2c_smbus_read_byte_data(ESC_601_i2c_client, 0xa5) == 0x1) + { + status = i2c_smbus_read_byte_data(Cameo_BMC_client, 0x80); + } + else + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_4_client, 0x0); + } + debug_print((KERN_DEBUG "DEBUG : FAN_STATUS status = %x\n",status)); + for(i=1; i<=5; i++) + { + if(status & res) + { + sprintf(buf, "%sFan %d is Good\n", buf, i); + } + else + { + sprintf(buf, "%sFan %d is Fail\n", buf, i); + } + res=res<<1; + } + } + else if (attr->index == FAN_PRESENT) + { + if(i2c_smbus_read_byte_data(ESC_601_i2c_client, 0xa5) == 0x1) + { + status = i2c_smbus_read_byte_data(Cameo_BMC_client, 0x81); + } + else + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_4_client, 0x1); + } + debug_print((KERN_DEBUG "DEBUG : FAN_PRESENT status = %x\n",status)); + for(i=1; i<=5; i++) + { + if(status & res) + { + sprintf(buf, "%sFan %d is present\n", buf, i); + } + else + { + sprintf(buf, "%sFan %d is not present\n", buf, i); + } + res=res<<1; + } + } + else if (attr->index == FAN_POWER) + { + if(i2c_smbus_read_byte_data(ESC_601_i2c_client, 0xa5) == 0x1) + { + status = i2c_smbus_read_byte_data(Cameo_BMC_client, 0x82); + } + else + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_4_client, 0x2); + } + debug_print((KERN_DEBUG "DEBUG : FAN_POWER status = %x\n",status)); + for(i=1; i<=5; i++) + { + if(status & res) + { + sprintf(buf, "%sFan %d is power Good\n", buf, i); + } + else + { + sprintf(buf, "%sFan %d is not power Good\n", buf, i); + } + res=res<<1; + } + } + else if (attr->index == FAN_SPEED_RPM) + { + res = -EPERM; + if(i2c_smbus_read_byte_data(ESC_601_i2c_client, 0xa5) == 0x1) + { + target_client = Cameo_BMC_client; + res = i2c_smbus_read_byte_data(Cameo_BMC_client, 0x81); + } + else + { + target_client = Cameo_CPLD_4_client; + res = i2c_smbus_read_byte_data(Cameo_CPLD_4_client, 0x1); + } + + if(res < 0) { + sprintf(buf, "%sCheck fan present error\n", buf); + return sprintf(buf, "%s\n",buf); + } + + // first fan of couple + for(i=0; iupdate_lock); + + sprintf(buf, ""); + if (attr->index == FAN_MODE) + { + channel_status = i2c_smbus_write_byte(Cameo_Switch_2_client, 0x01); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: fan_mode_get set channel 1 FAILED\n"); + } + + status = i2c_smbus_read_byte_data(Cameo_Sensor_fan_client, 0x64); + debug_print((KERN_DEBUG "DEBUG : FAN_MODE get status = %x\n",status)); + + channel_status = i2c_smbus_write_byte(Cameo_Switch_2_client, 0x00); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: fan_mode_get channel reset FAILED\n"); + } + sprintf(buf, "%s0x%x\n", buf, status); + } + mutex_unlock(&Switch_2_data->update_lock); + return sprintf(buf, "%s\n",buf); +} + +static ssize_t fan_mode_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 status = -EPERM; + u8 channel_status = -EPERM; + u16 i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *Switch_2_data = i2c_get_clientdata(Cameo_Switch_2_client); + struct Cameo_i2c_data *Sensor_fan_data = i2c_get_clientdata(Cameo_Sensor_fan_client); + mutex_lock(&Switch_2_data->update_lock); + mutex_lock(&Sensor_fan_data->update_lock); + if (attr->index == FAN_MODE) + { + i = simple_strtol(buf, NULL, 16); + channel_status = i2c_smbus_write_byte(Cameo_Switch_2_client, 0x01); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: fan_mode_get set channel 1 FAILED\n"); + } + + status = i2c_smbus_write_byte_data(Cameo_Sensor_fan_client, 0x64, i); + debug_print((KERN_DEBUG "DEBUG : FAN_MODE set status = %x\n", status)); + + channel_status = i2c_smbus_write_byte(Cameo_Switch_2_client, 0x00); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: fan_mode_get channel reset FAILED\n"); + } + } + mutex_unlock(&Switch_2_data->update_lock); + mutex_unlock(&Sensor_fan_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_unlock\n")); + return count; +} +static ssize_t fan_rpm_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 channel_status = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *Switch_2_data = i2c_get_clientdata(Cameo_Switch_2_client); + mutex_lock(&Switch_2_data->update_lock); + + sprintf(buf, ""); + if (attr->index == FAN_RPM) + { + channel_status = i2c_smbus_write_byte(Cameo_Switch_2_client, 0x01); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: fan_rpm_get set channel 1 FAILED\n"); + } + + status = i2c_smbus_read_byte_data(Cameo_Sensor_fan_client, 0x60); + debug_print((KERN_DEBUG "DEBUG : FAN_RPM status = %x\n",status)); + + channel_status = i2c_smbus_write_byte(Cameo_Switch_2_client, 0x00); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: fan_rpm_get channel reset FAILED\n"); + } + sprintf(buf, "%s0x%x\n", buf, status); + } + mutex_unlock(&Switch_2_data->update_lock); + return sprintf(buf, "%s\n",buf); +} + +static ssize_t fan_rpm_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 status = -EPERM; + u8 channel_status = -EPERM; + u16 i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *Switch_2_data = i2c_get_clientdata(Cameo_Switch_2_client); + struct Cameo_i2c_data *Sensor_fan_data = i2c_get_clientdata(Cameo_Sensor_fan_client); + mutex_lock(&Switch_2_data->update_lock); + mutex_lock(&Sensor_fan_data->update_lock); + if (attr->index == FAN_RPM) + { + i = simple_strtol(buf, NULL, 16); + channel_status = i2c_smbus_write_byte(Cameo_Switch_2_client, 0x01); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: fan_mode_get set channel 1 FAILED\n"); + } + + status = i2c_smbus_write_byte_data(Cameo_Sensor_fan_client, 0x60, i); + debug_print((KERN_DEBUG "DEBUG : FAN_RPM set status = %x\n", status)); + + channel_status = i2c_smbus_write_byte(Cameo_Switch_2_client, 0x00); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: fan_mode_get channel reset FAILED\n"); + } + } + mutex_unlock(&Switch_2_data->update_lock); + mutex_unlock(&Sensor_fan_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_unlock\n")); + return count; +} +#endif + +#ifdef EEPROM_WANTED +const char * find_value(struct qsfp_table *x, int value) +{ + for (; x->n != NULL; x++) + if (x->v == value) + return (x->n); + return (NULL); +} + +const char * find_zero_bit(struct qsfp_table *x, int value, int sz) +{ + int v, m; + const char *s; + + v = 1; + for (v = 1, m = 1 << (8 * sz); v < m; v *= 2) { + if ((value & v) == 0) + continue; + if ((s = find_value(x, value & v)) != NULL) { + value &= ~v; + return (s); + } + } + + return (NULL); +} +#endif + +#ifdef FAN_DUTY_CTRL_WANTED +static ssize_t fan_duty_control(void) +{ + u8 channel_status = -EPERM; + u8 fan_status = -EPERM; + struct Cameo_i2c_data *Switch_2_data = i2c_get_clientdata(Cameo_Switch_2_client); + struct Cameo_i2c_data *Sensor_data = i2c_get_clientdata(Cameo_Sensor_client); + + mutex_lock(&Switch_2_data->update_lock); + mutex_lock(&Sensor_data->update_lock); + channel_status = i2c_smbus_write_byte(Cameo_Switch_2_client, 0x01); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: fan_duty_control set channel 0x01 FAILED\n"); + goto set_failed; + } + fan_status = i2c_smbus_write_byte_data(Cameo_Sensor_client, 0x4a, 0x20); + if(fan_status < 0) + { + printk(KERN_ALERT "ERROR: fan_duty_control set PWM 360KHz FAILED\n"); + goto set_failed; + } + fan_status = i2c_smbus_write_byte_data(Cameo_Sensor_client, 0x4d, 0x07); + if(fan_status < 0) + { + printk(KERN_ALERT "ERROR: fan_duty_control set PWM 25.71KHz FAILED\n"); + goto set_failed; + } + fan_status = i2c_smbus_write_byte_data(Cameo_Sensor_client, 0x4c, 0x07); + if(fan_status < 0) + { + printk(KERN_ALERT "ERROR: fan_duty_control set default duty 50 FAILED\n"); + goto set_failed; + } + fan_status = i2c_smbus_write_byte_data(Cameo_Sensor_client, 0x50, 0x00); + if(fan_status < 0) + { + printk(KERN_ALERT "ERROR: fan_duty_control set point 1 FAILED\n"); + goto set_failed; + } + fan_status = i2c_smbus_write_byte_data(Cameo_Sensor_client, 0x51, 0x05); + if(fan_status < 0) + { + printk(KERN_ALERT "ERROR: fan_duty_control set point 1 duty 35 FAILED\n"); + goto set_failed; + } + fan_status = i2c_smbus_write_byte_data(Cameo_Sensor_client, 0x52, 0x20); + if(fan_status < 0) + { + printk(KERN_ALERT "ERROR: fan_duty_control set point 2 FAILED\n"); + goto set_failed; + } + fan_status = i2c_smbus_write_byte_data(Cameo_Sensor_client, 0x53, 0x07); + if(fan_status < 0) + { + printk(KERN_ALERT "ERROR: fan_duty_control set point 2 duty 50 FAILED\n"); + goto set_failed; + } + fan_status = i2c_smbus_write_byte_data(Cameo_Sensor_client, 0x54, 0x24); + if(fan_status < 0) + { + printk(KERN_ALERT "ERROR: fan_duty_control set point 3 FAILED\n"); + goto set_failed; + } + fan_status = i2c_smbus_write_byte_data(Cameo_Sensor_client, 0x55, 0x0a); + if(fan_status < 0) + { + printk(KERN_ALERT "ERROR: fan_duty_control set point 3 duty 70 FAILED\n"); + goto set_failed; + } + fan_status = i2c_smbus_write_byte_data(Cameo_Sensor_client, 0x56, 0x2c); + if(fan_status < 0) + { + printk(KERN_ALERT "ERROR: fan_duty_control set point 4 FAILED\n"); + goto set_failed; + } + fan_status = i2c_smbus_write_byte_data(Cameo_Sensor_client, 0x57, 0x0a); + if(fan_status < 0) + { + printk(KERN_ALERT "ERROR: fan_duty_control set point 4 duty 85 FAILED\n"); + goto set_failed; + } + fan_status = i2c_smbus_write_byte_data(Cameo_Sensor_client, 0x4f, 0x03); + if(fan_status < 0) + { + printk(KERN_ALERT "ERROR: fan_duty_control set FAILED\n"); + goto set_failed; + } + fan_status = i2c_smbus_write_byte_data(Cameo_Sensor_client, 0x4a, 0x00); + if(fan_status < 0) + { + printk(KERN_ALERT "ERROR: fan_duty_control enable lookup table FAILED\n"); + goto set_failed; + } + mutex_unlock(&Switch_2_data->update_lock); + mutex_unlock(&Sensor_data->update_lock); + return 0; + + set_failed: + mutex_unlock(&Switch_2_data->update_lock); + mutex_unlock(&Sensor_data->update_lock); + return -1; +} +#endif /*FAN_DUTY_CTRL_WANTED*/ + +#ifdef ASPEED_BMC_WANTED +static ssize_t bmc_register_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u32 reg = -EPERM; + u32 status = -EPERM; + u8 len = -EPERM; + u8 idex =0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + sprintf(buf, ""); + switch (attr->index) + { + case BMC_SERSOR_1: + reg = 0x10; + len = 1; + idex = 1; + break; + case BMC_SERSOR_2: + reg = 0x20; + len = 1; + idex = 2; + break; + case BMC_SERSOR_3: + reg = 0x30; + len = 1; + idex = 3; + break; + case BMC_SERSOR_4: + reg = 0x40; + len = 1; + idex = 4; + break; + case BMC_MAC_SENSOR: + reg = 0x70; + len = 2; + idex = 5; + break; + } + if(len == 1) + { + status = i2c_smbus_read_byte_data(Cameo_BMC_client, reg); + debug_print((KERN_DEBUG "DEBUG : BMC byte status = 0x%x\n", status)); + } + else if (len == 2) + { + status = i2c_smbus_read_word_data(Cameo_BMC_client, reg); + debug_print((KERN_DEBUG "DEBUG : BMC word status = 0x%x\n", status)); + } + if(status == 0xfffffffa || status == 0xff || status == 0xffff) + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + else + { + + if(len == 1) + sprintf(buf, "%sSensor %d temp is %s%d degrees (C)\n", buf, idex,(status & 0x80)!=0 ? "-":"",read_8bit_temp((status & 0x80),status)); + else + sprintf(buf, "%s0x%x\n", buf, ((status&0xff)<<8)|((status&0xFF00)>>8)); + } + return sprintf(buf, "%s\n", buf); +} +static ssize_t bmc_module_detect(struct device *dev, struct device_attribute *da, char *buf) +{ + u32 status = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + sprintf(buf, ""); + if(attr->index == BMC_DETECT) + { + status = i2c_smbus_read_byte_data(ESC_601_i2c_client, 0xa5); + debug_print((KERN_DEBUG "DEBUG : BMC byte status = 0x%x\n", status)); + } + if(status == 0x1) + { + sprintf(buf, "%sBMC module is present\n", buf); + } + else + { + sprintf(buf, "%sBMC module is not present\n", buf); + } + return sprintf(buf, "%s\n", buf); +} +#endif /*ASPEED_BMC_WANTED*/ + +#ifdef WDT_CTRL_WANTED +static ssize_t wdt_status_get(struct device *dev, struct device_attribute *da, char *buf) +{ + sprintf(buf, ""); + return sprintf(buf, "%s\n", buf); +} +static ssize_t wdt_status_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + return count; +} +#endif /*WDT_CTRL_WANTED*/ + +#ifdef EEPROM_WP_WANTED +static ssize_t eeprom_wp_status_get(struct device *dev, struct device_attribute *da, char *buf) +{ + sprintf(buf, ""); + return sprintf(buf, "%s\n", buf); +} +static ssize_t eeprom_wp_status_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + return count; +} +#endif /*EEPROM_WP_WANTED*/ + +static ssize_t hw_version_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u32 status = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + sprintf(buf, ""); + if(attr->index == HW_VER) + { + status = i2c_smbus_read_byte_data(ESC_601_i2c_client, 0x20); + } + sprintf(buf, "%sHW version is 0x%x\n", buf, status); + return sprintf(buf, "%s\n", buf); +} + +static ssize_t cpld_version_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u32 status = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + sprintf(buf, ""); + + struct i2c_client *target_cpld_client; + + switch(attr->index) + { + case SWITCH_BORAD_CPLD1: + target_cpld_client = ESC_601_i2c_client; + break; + case SWITCH_BORAD_CPLD2: + target_cpld_client = Cameo_CPLD_2_client; + break; + case SWITCH_BORAD_CPLD3: + target_cpld_client = Cameo_CPLD_3_client; + break; + case FAN_BORAD_CPLD: + target_cpld_client = Cameo_CPLD_4_client; + break; + default: + return sprintf(buf, "ERR\n"); + } + + status = i2c_smbus_read_byte_data(target_cpld_client, 0x20); + + sprintf(buf, "%s0x%x\n", buf, status); + return sprintf(buf, "%s\n", buf); +} + +#ifdef EEPROM_WANTED +/* + * decode_tlv_value + * + * Decode a single TLV value into a string. + + * The validity of EEPROM contents and the TLV field have been verified + * prior to calling this function. + */ +#define DECODE_NAME_MAX 20 + +static void decode_tlv_value(tlvinfo_tlv_t * tlv, char* value) +{ + int i; + + switch (tlv->type) + { + case TLV_CODE_PRODUCT_NAME: + case TLV_CODE_PART_NUMBER: + case TLV_CODE_SERIAL_NUMBER: + case TLV_CODE_MANUF_DATE: + case TLV_CODE_LABEL_REVISION: + case TLV_CODE_PLATFORM_NAME: + case TLV_CODE_ONIE_VERSION: + case TLV_CODE_MANUF_NAME: + case TLV_CODE_MANUF_COUNTRY: + case TLV_CODE_VENDOR_NAME: + case TLV_CODE_DIAG_VERSION: + case TLV_CODE_SERVICE_TAG: + memcpy(value, tlv->value, tlv->length); + value[tlv->length] = 0; + break; + + case TLV_CODE_MAC_BASE: + sprintf(value, "%02X:%02X:%02X:%02X:%02X:%02X", + tlv->value[0], tlv->value[1], tlv->value[2], + tlv->value[3], tlv->value[4], tlv->value[5]); + break; + + case TLV_CODE_DEVICE_VERSION: + sprintf(value, "%u", tlv->value[0]); + break; + + case TLV_CODE_MAC_SIZE: + sprintf(value, "%u", (tlv->value[0] << 8) | tlv->value[1]); + break; + + case TLV_CODE_VENDOR_EXT: + value[0] = 0; + for (i = 0; (i < (TLV_DECODE_VALUE_MAX_LEN/5)) && (i < tlv->length); i++) + { + sprintf(value, "%s 0x%02X", value, tlv->value[i]); + } + break; + + case TLV_CODE_CRC_32: + sprintf(value, "0x%02X%02X%02X%02X", + tlv->value[0], tlv->value[1], tlv->value[2], + tlv->value[3]); + break; + + default: + break; + } + +} + +static inline const char* tlv_type2name(u_int8_t type) +{ + char* name = "Unknown"; + int i; + + for (i = 0; i < sizeof(tlv_code_list)/sizeof(tlv_code_list[0]); i++) { + if (tlv_code_list[i].m_code == type) { + name = tlv_code_list[i].m_name; + break; + } + } + return name; +} + +/* + * decode_tlv + * + * Print a string representing the contents of the TLV field. The format of + * the string is: + * 1. The name of the field left justified in 20 characters + * 2. The type code in hex right justified in 5 characters + * 3. The length in decimal right justified in 4 characters + * 4. The value, left justified in however many characters it takes + * The validity of EEPROM contents and the TLV field have been verified + * prior to calling this function. + */ +#define DECODE_NAME_MAX 20 + +static void decode_tlv(tlvinfo_tlv_t * tlv, char *buf) +{ + char name[DECODE_NAME_MAX]; + char value[TLV_DECODE_VALUE_MAX_LEN]; + + decode_tlv_value(tlv, value); + + strncpy(name, tlv_type2name(tlv->type), DECODE_NAME_MAX); + name[DECODE_NAME_MAX-1] = 0; +#ifdef DEBUG_MSG + printk(KERN_ALERT "%-20s 0x%02X %3d %s\n", name, tlv->type, tlv->length, value); +#endif + sprintf(buf, "%s%-20s 0x%02X %3d %s\n", buf, name, tlv->type, tlv->length, value); +} + +/* + * show_eeprom + * + * Display the contents of the EEPROM + */ +void show_eeprom(u_int8_t *eeprom, char *buf, int tlv_len ) +{ + int tlv_end; + int curr_tlv; + tlvinfo_header_t * eeprom_hdr = (tlvinfo_header_t *) eeprom; + tlvinfo_tlv_t * eeprom_tlv; + +#ifdef DEBUG_MSG + printk(KERN_ALERT "TlvInfo Header:\n"); + printk(KERN_ALERT " Id String: %s\n", eeprom_hdr->signature); + printk(KERN_ALERT " Version: %d\n", eeprom_hdr->version); + printk(KERN_ALERT " Total Length: %d\n", tlv_len); + printk(KERN_ALERT "TLV Name Code Len Value\n"); + printk(KERN_ALERT "-------------------- ---- --- -----\n"); +#endif + sprintf(buf, "%sTlvInfo Header:\n", buf); + sprintf(buf, "%s Id String: %s\n", buf, &eeprom_hdr->signature[0]); + sprintf(buf, "%s Version: %d\n", buf, eeprom_hdr->version); + sprintf(buf, "%s Total Length: %d\n", buf, tlv_len); + sprintf(buf, "%sTLV Name Code Len Value\n", buf); + sprintf(buf, "%s-------------------- ---- --- -----\n", buf); + + curr_tlv = sizeof(tlvinfo_header_t); + tlv_end = sizeof(tlvinfo_header_t) + tlv_len; + + while (curr_tlv < tlv_end) + { + eeprom_tlv = (tlvinfo_tlv_t *) &eeprom[curr_tlv]; + decode_tlv(eeprom_tlv, buf); + curr_tlv += sizeof(tlvinfo_tlv_t) + eeprom_tlv->length; + } + + return; +} +#endif + +/* end of function */ + +static int Cameo_i2c_probe(struct i2c_client *client, const struct i2c_device_id *dev_id) +{ + struct Cameo_i2c_data *data; + struct Cameo_i2c_data *CPLD_2_data; + struct Cameo_i2c_data *CPLD_3_data; + struct Cameo_i2c_data *CPLD_4_data; +#ifdef I2C_SWITCH_WANTED + struct Cameo_i2c_data *Switch_1_data; + struct Cameo_i2c_data *Switch_2_data; +#endif +#ifdef THEMAL_WANTED + struct Cameo_i2c_data *Sensor_data; + struct Cameo_i2c_data *MAC_Sensor_data; + struct Cameo_i2c_data *Sensor_fan_data; +#endif +#ifdef QSFP_WANTED + struct Cameo_i2c_data *QSFP_Switch_data; + struct Cameo_i2c_data *QSFP_data; +#endif +#ifdef EEPROM_WANTED + struct Cameo_i2c_data *EEPROM_data; +#endif + +#ifdef ASPEED_BMC_WANTED + struct Cameo_i2c_data *Cameo_BMC_data; +#endif + int status; + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA)) + { + status = -EIO; + goto exit; + } + data = kzalloc(sizeof(struct Cameo_i2c_data), GFP_KERNEL); + if (!data) + { + printk(KERN_ALERT "kzalloc fail\n"); + status = -ENOMEM; + goto exit; + } + CPLD_2_data = kzalloc(sizeof(struct Cameo_i2c_data), GFP_KERNEL); + if (!CPLD_2_data) + { + printk(KERN_ALERT "kzalloc fail\n"); + status = -ENOMEM; + goto exit; + } + CPLD_3_data = kzalloc(sizeof(struct Cameo_i2c_data), GFP_KERNEL); + if (!CPLD_3_data) + { + printk(KERN_ALERT "kzalloc fail\n"); + status = -ENOMEM; + goto exit; + } + CPLD_4_data = kzalloc(sizeof(struct Cameo_i2c_data), GFP_KERNEL); + if (!CPLD_4_data) + { + printk(KERN_ALERT "kzalloc fail\n"); + status = -ENOMEM; + goto exit; + } +#ifdef I2C_SWITCH_WANTED + Switch_1_data = kzalloc(sizeof(struct Cameo_i2c_data), GFP_KERNEL); + if (!Switch_1_data) + { + printk(KERN_ALERT "kzalloc fail\n"); + status = -ENOMEM; + goto exit; + } + Switch_2_data = kzalloc(sizeof(struct Cameo_i2c_data), GFP_KERNEL); + if (!Switch_2_data) + { + printk(KERN_ALERT "kzalloc fail\n"); + status = -ENOMEM; + goto exit; + } +#endif +#ifdef THEMAL_WANTED + Sensor_data = kzalloc(sizeof(struct Cameo_i2c_data), GFP_KERNEL); + if (!Sensor_data) + { + printk(KERN_ALERT "kzalloc fail\n"); + status = -ENOMEM; + goto exit; + } + MAC_Sensor_data = kzalloc(sizeof(struct Cameo_i2c_data), GFP_KERNEL); + if (!MAC_Sensor_data) + { + printk(KERN_ALERT "kzalloc fail\n"); + status = -ENOMEM; + goto exit; + } + Sensor_fan_data = kzalloc(sizeof(struct Cameo_i2c_data), GFP_KERNEL); + if (!Sensor_fan_data) + { + printk(KERN_ALERT "kzalloc fail\n"); + status = -ENOMEM; + goto exit; + } +#endif +#ifdef QSFP_WANTED + QSFP_Switch_data = kzalloc(sizeof(struct Cameo_i2c_data), GFP_KERNEL); + if (!QSFP_Switch_data) + { + printk(KERN_ALERT "kzalloc fail\n"); + status = -ENOMEM; + goto exit; + } + QSFP_data = kzalloc(sizeof(struct Cameo_i2c_data), GFP_KERNEL); + if (!QSFP_data) + { + printk(KERN_ALERT "kzalloc fail\n"); + status = -ENOMEM; + goto exit; + } +#endif +#ifdef EEPROM_WANTED + EEPROM_data = kzalloc(sizeof(struct Cameo_i2c_data), GFP_KERNEL); + if (!EEPROM_data) + { + printk(KERN_ALERT "kzalloc fail\n"); + status = -ENOMEM; + goto exit; + } +#endif + +#ifdef ASPEED_BMC_WANTED + Cameo_BMC_data = kzalloc(sizeof(struct Cameo_i2c_data), GFP_KERNEL); + if (!Cameo_BMC_data) + { + printk(KERN_ALERT "kzalloc fail\n"); + status = -ENOMEM; + goto exit; + } +#endif + i2c_set_clientdata(client, data); + i2c_set_clientdata(Cameo_CPLD_2_client, CPLD_2_data); + i2c_set_clientdata(Cameo_CPLD_3_client, CPLD_3_data); + i2c_set_clientdata(Cameo_CPLD_4_client, CPLD_4_data); +#ifdef I2C_SWITCH_WANTED + i2c_set_clientdata(Cameo_Switch_1_client, Switch_1_data); + i2c_set_clientdata(Cameo_Switch_2_client, Switch_2_data); +#endif +#ifdef THEMAL_WANTED + i2c_set_clientdata(Cameo_Sensor_client, Sensor_data); + i2c_set_clientdata(Cameo_MAC_Sensor_client, MAC_Sensor_data); + i2c_set_clientdata(Cameo_Sensor_fan_client, Sensor_fan_data); +#endif +#ifdef QSFP_WANTED + i2c_set_clientdata(Cameo_QSFP_Switch_client, QSFP_Switch_data); + i2c_set_clientdata(Cameo_QSFP_client, QSFP_data); +#endif +#ifdef EEPROM_WANTED + i2c_set_clientdata(Cameo_EEPROM_client, EEPROM_data); +#endif + mutex_init(&CPLD_2_data->update_lock); + mutex_init(&CPLD_3_data->update_lock); + mutex_init(&CPLD_4_data->update_lock); +#ifdef I2C_SWITCH_WANTED + mutex_init(&Switch_1_data->update_lock); + mutex_init(&Switch_2_data->update_lock); +#endif +#ifdef THEMAL_WANTED + mutex_init(&Sensor_data->update_lock); + mutex_init(&MAC_Sensor_data->update_lock); + mutex_init(&Sensor_fan_data->update_lock); +#endif +#ifdef QSFP_WANTED + mutex_init(&QSFP_Switch_data->update_lock); + mutex_init(&QSFP_data->update_lock); +#endif +#ifdef EEPROM_WANTED + mutex_init(&EEPROM_data->update_lock); +#endif +#ifdef ASPEED_BMC_WANTED + mutex_init(&Cameo_BMC_data->update_lock); +#endif + data->valid = 0; + mutex_init(&data->update_lock); + dev_info(&client->dev, "chip found\n"); + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &ESC601_PSU_group); + if (status) + { + goto exit_free; + } +#ifdef USB_CTRL_WANTED + status = sysfs_create_group(&client->dev.kobj, &ESC601_USB_group); + if (status) + { + goto exit_free; + } +#endif + status = sysfs_create_group(&client->dev.kobj, &ESC601_LED_group); + if (status) + { + goto exit_free; + } + status = sysfs_create_group(&client->dev.kobj, &ESC601_Reset_group); + if (status) + { + goto exit_free; + } + status = sysfs_create_group(&client->dev.kobj, &ESC601_Sensor_group); + if (status) + { + goto exit_free; + } + status = sysfs_create_group(&client->dev.kobj, &ESC601_INT_group); + if (status) + { + goto exit_free; + } + status = sysfs_create_group(&client->dev.kobj, &ESC601_QSFP_group); + if (status) + { + goto exit_free; + } + status = sysfs_create_group(&client->dev.kobj, &ESC601_FAN_group); + if (status) + { + goto exit_free; + } +#ifdef EEPROM_WANTED + status = sysfs_create_group(&client->dev.kobj, &ESC601_EEPROM_group); + if (status) + { + goto exit_free; + } +#endif +#ifdef ASPEED_BMC_WANTED + status = sysfs_create_group(&client->dev.kobj, &ESC601_BMC_group); + if (status) + { + goto exit_free; + } +#endif + status = sysfs_create_group(&client->dev.kobj, &ESC601_SYS_group); + if (status) + { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) + { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + dev_info(&client->dev, "%s: '%s'\n", dev_name(data->hwmon_dev), client->name); +#ifdef FAN_DUTY_CTRL_WANTED + if(fan_duty_control() != 0) + { + printk(KERN_ALERT "ERROR: FAN DUTY CONTROL SET FAILED\n"); + } + else + { + printk(KERN_ALERT "ESC601-32Q set fan duty control success\n"); + } +#endif /*FAN_DUTY_CTRL_WANTED*/ + return 0; +exit_remove: + sysfs_remove_group(&client->dev.kobj, &ESC601_PSU_group); +#ifdef USB_CTRL_WANTED + sysfs_remove_group(&client->dev.kobj, &ESC601_USB_group); +#endif + sysfs_remove_group(&client->dev.kobj, &ESC601_LED_group); + sysfs_remove_group(&client->dev.kobj, &ESC601_Reset_group); + sysfs_remove_group(&client->dev.kobj, &ESC601_Sensor_group); + sysfs_remove_group(&client->dev.kobj, &ESC601_INT_group); + sysfs_remove_group(&client->dev.kobj, &ESC601_QSFP_group); + sysfs_remove_group(&client->dev.kobj, &ESC601_FAN_group); +#ifdef EEPROM_WANTED + sysfs_remove_group(&client->dev.kobj, &ESC601_EEPROM_group); +#endif +#ifdef ASPEED_BMC_WANTED + sysfs_remove_group(&client->dev.kobj, &ESC601_BMC_group); +#endif + sysfs_remove_group(&client->dev.kobj, &ESC601_SYS_group); + +exit_free: + kfree(data); +exit: + return status; +} + +static int Cameo_i2c_remove(struct i2c_client *client) +{ + struct Cameo_i2c_data *data = i2c_get_clientdata(client); + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &ESC601_PSU_group); +#ifdef USB_CTRL_WANTED + sysfs_remove_group(&client->dev.kobj, &ESC601_USB_group); +#endif + sysfs_remove_group(&client->dev.kobj, &ESC601_LED_group); + sysfs_remove_group(&client->dev.kobj, &ESC601_Reset_group); + sysfs_remove_group(&client->dev.kobj, &ESC601_Sensor_group); + sysfs_remove_group(&client->dev.kobj, &ESC601_INT_group); + sysfs_remove_group(&client->dev.kobj, &ESC601_QSFP_group); + sysfs_remove_group(&client->dev.kobj, &ESC601_FAN_group); +#ifdef EEPROM_WANTED + sysfs_remove_group(&client->dev.kobj, &ESC601_EEPROM_group); +#endif +#ifdef ASPEED_BMC_WANTED + sysfs_remove_group(&client->dev.kobj, &ESC601_BMC_group); +#endif + sysfs_remove_group(&client->dev.kobj, &ESC601_SYS_group); + + kfree(data); + return 0; +} + +static const struct i2c_device_id Cameo_i2c_id[] = +{ + { "ESC_601_i2c", 0 }, + {}, +}; +MODULE_DEVICE_TABLE(i2c, Cameo_i2c_id); + +static struct i2c_driver Cameo_i2c_driver = +{ + .class = I2C_CLASS_HWMON, + .driver = + { + .name = "ESC_601_i2c", + }, + .probe = Cameo_i2c_probe, + .remove = Cameo_i2c_remove, + .id_table = Cameo_i2c_id, + .address_list = normal_i2c, +}; + +/*For main Switch board*/ +static struct i2c_board_info ESC_601_i2c_info[] __initdata = +{ + { + I2C_BOARD_INFO("ESC_601_i2c", 0x30), + .platform_data = NULL, + }, +}; + +/*For QSFP Port 01 - 16*/ +static struct i2c_board_info Cameo_CPLD_2_info[] __initdata = +{ + { + I2C_BOARD_INFO("Cameo_CPLD_2", 0x31), + .platform_data = NULL, + }, +}; +/*For QSFP Port 17 - 32*/ +static struct i2c_board_info Cameo_CPLD_3_info[] __initdata = +{ + { + I2C_BOARD_INFO("Cameo_CPLD_3", 0x32), + .platform_data = NULL, + }, +}; +/*For Fan status*/ +static struct i2c_board_info Cameo_CPLD_4_info[] __initdata = +{ + { + I2C_BOARD_INFO("Cameo_CPLD_4", 0x23), + .platform_data = NULL, + }, +}; +#ifdef I2C_SWITCH_WANTED +/*0x73*/ +static struct i2c_board_info Cameo_Switch_1_info[] __initdata = +{ + { + I2C_BOARD_INFO("Cameo_Switch_1", 0x73), + .platform_data = NULL, + }, +}; + +/*0x77*/ +static struct i2c_board_info Cameo_Switch_2_info[] __initdata = +{ + { + I2C_BOARD_INFO("Cameo_Switch_2", 0x77), + .platform_data = NULL, + }, +}; +#endif +#ifdef THEMAL_WANTED +/*0x4c*/ +static struct i2c_board_info Cameo_Sensor_info[] __initdata = +{ + { + I2C_BOARD_INFO("Cameo_Sensor", 0x4c), + .platform_data = NULL, + }, +}; + +/*0x4c*/ +static struct i2c_board_info Cameo_MAC_Sensor_info[] __initdata = +{ + { + I2C_BOARD_INFO("Cameo_MAC_Sensor", 0x68), + .platform_data = NULL, + }, +}; + +/*0x2e*/ +static struct i2c_board_info Cameo_Sensor_fan_info[] __initdata = +{ + { + I2C_BOARD_INFO("Cameo_Sensor_fan", 0x2e), + .platform_data = NULL, + }, +}; +#endif +#ifdef QSFP_WANTED +/*0x74*/ +static struct i2c_board_info Cameo_QSFP_Switch_info[] __initdata = +{ + { + I2C_BOARD_INFO("Cameo_QSFP_Switch", 0x74), + .platform_data = NULL, + }, +}; + +/*0x50*/ +static struct i2c_board_info Cameo_QSFP_info[] __initdata = +{ + { + I2C_BOARD_INFO("Cameo_QSFP", 0x50), + .platform_data = NULL, + }, +}; +#endif +#ifdef EEPROM_WANTED +/*0x56*/ +static struct i2c_board_info Cameo_EEPROM_info[] __initdata = +{ + { + I2C_BOARD_INFO("Cameo_EEPROM", 0x56), + .platform_data = NULL, + }, +}; +#endif + +#ifdef ASPEED_BMC_WANTED +static struct i2c_board_info Cameo_BMC_info[] __initdata = +{ + { + I2C_BOARD_INFO("Cameo_BMC", 0x14), + .platform_data = NULL, + }, +}; +#endif +static int __init Cameo_i2c_init(void) +{ + int ret; + int cmp; + char keyword[] = "SMBus I801"; + char buf1[128]; + struct i2c_adapter *i2c_adap; + struct file *fp; + mm_segment_t fs; + loff_t pos; + + printk("Open file...\n"); + fp = filp_open("/sys/class/i2c-dev/i2c-0/name", O_RDONLY , 0644); + if (IS_ERR(fp)) { + printk("Open file FAILED\n"); + return -1; + } + + fs = get_fs(); + set_fs(KERNEL_DS); + pos = 0; + vfs_read(fp, buf1, sizeof(buf1), &pos); + printk("Detect %s\n", buf1); + cmp = strncmp(keyword, buf1, sizeof(keyword)-1); + set_fs(fs); + + filp_close(fp, NULL); + + if(cmp == 0) + { + i2c_adap = i2c_get_adapter(0); + printk("SMBus I801 is at bus 0\n"); + } + else + { + i2c_adap = i2c_get_adapter(1); + printk("SMBus I801 is at bus 1\n"); + } + + debug_print((KERN_DEBUG "Cameo_i2c_init\n")); + if (i2c_adap == NULL) + { + printk("ERROR: i2c_get_adapter FAILED!\n"); + return -1; + } + ESC_601_i2c_client = i2c_new_device(i2c_adap, &ESC_601_i2c_info[0]); + Cameo_CPLD_2_client = i2c_new_device(i2c_adap, &Cameo_CPLD_2_info[0]); + Cameo_CPLD_3_client = i2c_new_device(i2c_adap, &Cameo_CPLD_3_info[0]); + Cameo_CPLD_4_client = i2c_new_device(i2c_adap, &Cameo_CPLD_4_info[0]); +#ifdef I2C_SWITCH_WANTED + Cameo_Switch_1_client = i2c_new_device(i2c_adap, &Cameo_Switch_1_info[0]); + Cameo_Switch_2_client = i2c_new_device(i2c_adap, &Cameo_Switch_2_info[0]); +#endif +#ifdef THEMAL_WANTED + Cameo_Sensor_client = i2c_new_device(i2c_adap, &Cameo_Sensor_info[0]); + Cameo_MAC_Sensor_client = i2c_new_device(i2c_adap, &Cameo_MAC_Sensor_info[0]); + Cameo_Sensor_fan_client = i2c_new_device(i2c_adap, &Cameo_Sensor_fan_info[0]); +#endif +#ifdef QSFP_WANTED + Cameo_QSFP_Switch_client = i2c_new_device(i2c_adap, &Cameo_QSFP_Switch_info[0]); + Cameo_QSFP_client = i2c_new_device(i2c_adap, &Cameo_QSFP_info[0]); +#endif +#ifdef EEPROM_WANTED + Cameo_EEPROM_client = i2c_new_device(i2c_adap, &Cameo_EEPROM_info[0]); +#endif + +#ifdef ASPEED_BMC_WANTED + Cameo_BMC_client = i2c_new_device(i2c_adap, &Cameo_BMC_info[0]); +#endif + + if (ESC_601_i2c_info == NULL || Cameo_CPLD_2_info == NULL || Cameo_CPLD_3_info == NULL || Cameo_CPLD_4_info == NULL ) + { + printk("ERROR: i2c_new_device FAILED!\n"); + return -1; + } +#ifdef I2C_SWITCH_WANTED + if (Cameo_Switch_1_info == NULL || Cameo_Switch_2_info == NULL ) + { + printk("ERROR: i2c_new_device FAILED!\n"); + return -1; + } +#endif +#ifdef THEMAL_WANTED + if (Cameo_Sensor_info == NULL || Cameo_MAC_Sensor_info == NULL || Cameo_Sensor_fan_info == NULL ) + { + printk("ERROR: i2c_new_device FAILED!\n"); + return -1; + } +#endif +#ifdef QSFP_WANTED + if (Cameo_QSFP_Switch_info == NULL || Cameo_QSFP_info == NULL ) + { + printk("ERROR: i2c_new_device FAILED!\n"); + return -1; + } +#endif +#ifdef EEPROM_WANTED + if (Cameo_EEPROM_info == NULL ) + { + printk("ERROR: i2c_new_device FAILED!\n"); + return -1; + } +#endif + +#ifdef ASPEED_BMC_WANTED + if (Cameo_BMC_info == NULL ) + { + printk("ERROR: i2c_new_device FAILED!\n"); + return -1; + } +#endif + i2c_put_adapter(i2c_adap); + ret = i2c_add_driver(&Cameo_i2c_driver); + printk(KERN_ALERT "ESC601-32Q i2c Driver Version: %s\n", DRIVER_VERSION); + printk(KERN_ALERT "ESC601-32Q i2c Driver INSTALL SUCCESS\n"); + return ret; +} + +static void __exit Cameo_i2c_exit(void) +{ + i2c_unregister_device(ESC_601_i2c_client); + i2c_unregister_device(Cameo_CPLD_2_client); + i2c_unregister_device(Cameo_CPLD_3_client); + i2c_unregister_device(Cameo_CPLD_4_client); +#ifdef I2C_SWITCH_WANTED + i2c_unregister_device(Cameo_Switch_1_client); + i2c_unregister_device(Cameo_Switch_2_client); +#endif +#ifdef THEMAL_WANTED + i2c_unregister_device(Cameo_Sensor_client); + i2c_unregister_device(Cameo_MAC_Sensor_client); + i2c_unregister_device(Cameo_Sensor_fan_client); +#endif +#ifdef QSFP_WANTED + i2c_unregister_device(Cameo_QSFP_Switch_client); + i2c_unregister_device(Cameo_QSFP_client); +#endif +#ifdef EEPROM_WANTED + i2c_unregister_device(Cameo_EEPROM_client); +#endif + +#ifdef ASPEED_BMC_WANTED + i2c_unregister_device(Cameo_BMC_client); +#endif + i2c_del_driver(&Cameo_i2c_driver); + printk(KERN_ALERT "ESC601-32Q i2c Driver UNINSTALL SUCCESS\n"); +} + +MODULE_AUTHOR("Cameo Inc."); +MODULE_DESCRIPTION("Cameo ESC601-32Q i2c Driver"); +MODULE_LICENSE("GPL"); +module_param(debug, int, 0); +MODULE_PARM_DESC(debug, "Enable debugging (0-1)"); + +module_init(Cameo_i2c_init); +module_exit(Cameo_i2c_exit); diff --git a/platform/innovium/sonic-platform-modules-cameo/esc601-32q/modules/x86-64-cameo-esc601-32q.h b/platform/innovium/sonic-platform-modules-cameo/esc601-32q/modules/x86-64-cameo-esc601-32q.h new file mode 100644 index 0000000000..a9cd54e31d --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc601-32q/modules/x86-64-cameo-esc601-32q.h @@ -0,0 +1,817 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRIVER_VERSION "3.1" + +#define TURN_OFF 0 +#define TURN_ON 1 +#define GET_USB 2 +#define GET_LOC 3 +#define LOC_OFF 0 +#define LOC_BLINK 1 +#define ALARM_OFF 0 +#define ALARM_AMBER 1 +#define ALARM_GREEN 2 +#define PSU_1_GOOD 3 +#define PSU_2_GOOD 4 +#define PCIE_INT 1 +#define QSFP_1_INT 2 +#define QSFP_2_INT 3 +#define FAN_INT 4 +#define PSU_INT 5 +#define SENSOR_INT 6 +#define USB_INT 7 +#define USB_ON 0x2 +#define USB_OFF 0xfd +#define DIAG_G_ON 0x2 +#define DIAG_G_OFF 0xfd +#define LED_ON 0x1 +#define LED_OFF 0xfe +#define DIAG_A_ON 0x1 +#define DIAG_A_OFF 0xfe +#define LOC_LED_OFF 0x4 +#define LOC_LED_BLINK 0xfb + +#define SYSFAN_MAX_NUM 5 + +struct i2c_adap { + int nr; + char *name; + const char *funcs; + const char *algo; +}; + +struct i2c_adap *gather_i2c_busses(void); +void free_adapters(struct i2c_adap *adapters); + +/* compiler conditional */ +#define LED_CTRL_WANTED +#define USB_CTRL_WANTED +#define ASPEED_BMC_WANTED +#define PSU_STAT_WANTED +//#define WDT_CTRL_WANTED +//#define EEPROM_WP_WANTED +//#define I2C_SWITCH_WANTED +//#define EEPROM_WANTED +//#define THEMAL_WANTED +//#define QSFP_WANTED +//#define FAN_CTRL_WANTED +//#define FAN_DUTY_CTRL_WANTED + +//#define DEBUG_MSG +#ifdef DEBUG_MSG + #define debug_print(s) printk s +#else + #define debug_print(s) +#endif + +/* end of compiler conditional */ + +/* i2c_client Declaration */ +static struct i2c_client *ESC_601_i2c_client; //0x30 for other device +static struct i2c_client *Cameo_CPLD_2_client; //0x31 for Port 01-16 +static struct i2c_client *Cameo_CPLD_3_client; //0x32 for Port 17-32 +static struct i2c_client *Cameo_CPLD_4_client; //0x23 for Fan Status +#ifdef I2C_SWITCH_WANTED +static struct i2c_client *Cameo_Switch_1_client; //0x73 +static struct i2c_client *Cameo_Switch_2_client; //0x77 +#endif +#ifdef QSFP_WANTED +static struct i2c_client *Cameo_QSFP_Switch_client; //0x74 +static struct i2c_client *Cameo_QSFP_client; //0x50 +#endif +#ifdef EEPROM_WANTED +static struct i2c_client *Cameo_EEPROM_client; //0x56 +#endif +#ifdef THEMAL_WANTED +static struct i2c_client *Cameo_Sensor_client; //0x4c themal sensor +static struct i2c_client *Cameo_MAC_Sensor_client; //0x68 MCP3425 +static struct i2c_client *Cameo_Sensor_fan_client; //0x2e themal sensor +#endif +#ifdef ASPEED_BMC_WANTED +static struct i2c_client *Cameo_BMC_client; //0x14 ASPEED BMC +#endif +/* end of i2c_client Declaration */ + +/* Function Declaration */ +/* i2c-0 */ +#ifdef EEPROM_WANTED +static ssize_t tlv_status_get(struct device *dev, struct device_attribute *da, char *buf); +#endif +static ssize_t psu_status_get(struct device *dev, struct device_attribute *da, char *buf); +#ifdef PSU_STAT_WANTED +static ssize_t psu_module_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t dc_chip_switch_get(struct device *dev, struct device_attribute *da, char *buf); +#endif +#ifdef USB_CTRL_WANTED +static ssize_t usb_power_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t usb_power_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +#endif +#ifdef LED_CTRL_WANTED +static ssize_t led_ctrl_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t led_ctrl_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +#endif +static ssize_t led_loc_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t led_loc_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t led_alarm_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t led_alarm_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t reset_mac_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t themal_status_get(struct device *dev, struct device_attribute *da, char *buf); +#ifdef THEMAL_WANTED +static ssize_t themal_temp_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t mac_temp_get(struct device *dev, struct device_attribute *da, char *buf); +#endif +static ssize_t themal_mask_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t themal_mask_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t int_status_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t low_power_all_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t low_power_all_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t low_power_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t low_power_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t qsfp_reset_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t qsfp_status_get(struct device *dev, struct device_attribute *da, char *buf); +#ifdef QSFP_WANTED +static ssize_t qsfp_temp_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t qsfp_date_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t qsfp_sn_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t qsfp_pn_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t qsfp_name_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t qsfp_oui_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t qsfp_rev_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t qsfp_connector_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t qsfp_encoding_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t qsfp_nominal_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t qsfp_ext_rate_com_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t qsfp_eth_com_code_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t qsfp_identifier_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t qsfp_fc_media_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t qsfp_fc_speed_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t qsfp_cab_tech_get(struct device *dev, struct device_attribute *da, char *buf); +#endif +static ssize_t fan_status_get(struct device *dev, struct device_attribute *da, char *buf); +#ifdef FAN_CTRL_WANTED +static ssize_t fan_mode_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t fan_mode_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t fan_rpm_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t fan_rpm_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +#endif +#ifdef FAN_DUTY_CTRL_WANTED +static ssize_t fan_duty_control(void); +#endif /*FAN_DUTY_CTRL_WANTED*/ +#ifdef ASPEED_BMC_WANTED +static ssize_t bmc_register_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t bmc_module_detect(struct device *dev, struct device_attribute *da, char *buf); +#endif +#ifdef WDT_CTRL_WANTED +static ssize_t wdt_status_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t wdt_status_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +#endif +#ifdef EEPROM_WP_WANTED +static ssize_t eeprom_wp_status_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t eeprom_wp_status_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +#endif +static ssize_t hw_version_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t cpld_version_get(struct device *dev, struct device_attribute *da, char *buf); +/* end of Function Declaration */ + +/* struct i2c_data */ +struct Cameo_i2c_data +{ + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 status; /* Status register read from CPLD */ +}; + +#ifdef EEPROM_WANTED +struct qsfp_table { + int v; + const char *n; +}; + +const char * find_value(struct qsfp_table *x, int value); +const char * find_zero_bit(struct qsfp_table *x, int value, int sz); + +/** + * The TLV Types. + * + * Keep these in sync with tlv_code_list in cmd_sys_eeprom.c + */ +#define TLV_CODE_PRODUCT_NAME 0x21 +#define TLV_CODE_PART_NUMBER 0x22 +#define TLV_CODE_SERIAL_NUMBER 0x23 +#define TLV_CODE_MAC_BASE 0x24 +#define TLV_CODE_MANUF_DATE 0x25 +#define TLV_CODE_DEVICE_VERSION 0x26 +#define TLV_CODE_LABEL_REVISION 0x27 +#define TLV_CODE_PLATFORM_NAME 0x28 +#define TLV_CODE_ONIE_VERSION 0x29 +#define TLV_CODE_MAC_SIZE 0x2A +#define TLV_CODE_MANUF_NAME 0x2B +#define TLV_CODE_MANUF_COUNTRY 0x2C +#define TLV_CODE_VENDOR_NAME 0x2D +#define TLV_CODE_DIAG_VERSION 0x2E +#define TLV_CODE_SERVICE_TAG 0x2F +#define TLV_CODE_VENDOR_EXT 0xFD +#define TLV_CODE_CRC_32 0xFE + +/* + * Struct for displaying the TLV codes and names. + */ +struct tlv_code_desc { + u_int8_t m_code; + char* m_name; +}; + +/* + * List of TLV codes and names. + */ +static const struct tlv_code_desc tlv_code_list[] = { + { TLV_CODE_PRODUCT_NAME , "Product Name"}, + { TLV_CODE_PART_NUMBER , "Part Number"}, + { TLV_CODE_SERIAL_NUMBER , "Serial Number"}, + { TLV_CODE_MAC_BASE , "Base MAC Address"}, + { TLV_CODE_MANUF_DATE , "Manufacture Date"}, + { TLV_CODE_DEVICE_VERSION , "Device Version"}, + { TLV_CODE_LABEL_REVISION , "Label Revision"}, + { TLV_CODE_PLATFORM_NAME , "Platform Name"}, + { TLV_CODE_ONIE_VERSION , "ONIE Version"}, + { TLV_CODE_MAC_SIZE , "MAC Addresses"}, + { TLV_CODE_MANUF_NAME , "Manufacturer"}, + { TLV_CODE_MANUF_COUNTRY , "Country Code"}, + { TLV_CODE_VENDOR_NAME , "Vendor Name"}, + { TLV_CODE_DIAG_VERSION , "Diag Version"}, + { TLV_CODE_SERVICE_TAG , "Service Tag"}, + { TLV_CODE_VENDOR_EXT , "Vendor Extension"}, + { TLV_CODE_CRC_32 , "CRC-32"}, +}; + +struct __attribute__ ((__packed__)) tlvinfo_header_s { + char signature[8]; /* 0x00 - 0x07 EEPROM Tag "TlvInfo" */ + u_int8_t version; /* 0x08 Structure version */ + u_int16_t totallen; /* 0x09 - 0x0A Length of all data which follows */ +}; +typedef struct tlvinfo_header_s tlvinfo_header_t; + +// Header Field Constants +#define TLV_INFO_ID_STRING "TlvInfo" +#define TLV_INFO_VERSION 0x01 + +struct __attribute__ ((__packed__)) tlvinfo_tlv_s { + u_int8_t type; + u_int8_t length; + u_int8_t value[0]; +}; +typedef struct tlvinfo_tlv_s tlvinfo_tlv_t; + +/* Maximum length of a TLV value in bytes */ +#define TLV_VALUE_MAX_LEN 255 +#define TLV_DECODE_VALUE_MAX_LEN ((5 * TLV_VALUE_MAX_LEN) + 1) + +static void decode_tlv_value(tlvinfo_tlv_t * tlv, char* value); +static inline const char* tlv_type2name(u_int8_t type); +static void decode_tlv(tlvinfo_tlv_t * tlv, char *buf); +void show_eeprom(u_int8_t *eeprom, char *buf,int tlv_len); +#endif + +#ifdef QSFP_WANTED +/* SFF-8472 Rev. 11.4 table 3.4: Connector values */ +static struct qsfp_table conn[] = { + { 0x00, "Unknown" }, + { 0x01, "SC" }, + { 0x02, "Fibre Channel Style 1 copper" }, + { 0x03, "Fibre Channel Style 2 copper" }, + { 0x04, "BNC/TNC" }, + { 0x05, "Fibre Channel coaxial" }, + { 0x06, "FiberJack" }, + { 0x07, "LC" }, + { 0x08, "MT-RJ" }, + { 0x09, "MU" }, + { 0x0A, "SG" }, + { 0x0B, "Optical pigtail" }, + { 0x0C, "MPO Parallel Optic" }, + { 0x20, "HSSDC II" }, + { 0x21, "Copper pigtail" }, + { 0x22, "RJ45" }, + { 0x23, "No separate connector" }, /* SFF-8436 */ + { 0, NULL } +}; + +/* Channel/Cable technology, byte 7-8 */ +static struct qsfp_table cab_tech[] = { + { 0x0400, "Shortwave laser (SA)" }, + { 0x0200, "Longwave laser (LC)" }, + { 0x0100, "Electrical inter-enclosure (EL)" }, + { 0x80, "Electrical intra-enclosure (EL)" }, + { 0x40, "Shortwave laser (SN)" }, + { 0x20, "Shortwave laser (SL)" }, + { 0x10, "Longwave laser (LL)" }, + { 0x08, "Active Cable" }, + { 0x04, "Passive Cable" }, + { 0, NULL } +}; + +/* FC Transmission media, byte 9 */ +static struct qsfp_table fc_media[] = { + { 0x80, "Twin Axial Pair" }, + { 0x40, "Twisted Pair" }, + { 0x20, "Miniature Coax" }, + { 0x10, "Viao Coax" }, + { 0x08, "Miltimode, 62.5um" }, + { 0x04, "Multimode, 50um" }, + { 0x02, "" }, + { 0x01, "Single Mode" }, + { 0, NULL } +}; + +/* FC Speed, byte 10 */ +static struct qsfp_table fc_speed[] = { + { 0x80, "1200 MBytes/sec" }, + { 0x40, "800 MBytes/sec" }, + { 0x20, "1600 MBytes/sec" }, + { 0x10, "400 MBytes/sec" }, + { 0x08, "3200 MBytes/sec" }, + { 0x04, "200 MBytes/sec" }, + { 0x01, "100 MBytes/sec" }, + { 0, NULL } +}; + +/* SFF-8436 Rev. 4.8 table 33: Specification compliance */ + +/* 10/40G Ethernet compliance codes, byte 128 + 3 */ +static struct qsfp_table eth_1040g[] = { + { 0x80, "Extended" }, + { 0x40, "10GBASE-LRM" }, + { 0x20, "10GBASE-LR" }, + { 0x10, "10GBASE-SR" }, + { 0x08, "40GBASE-CR4" }, + { 0x04, "40GBASE-SR4" }, + { 0x02, "40GBASE-LR4" }, + { 0x01, "40G Active Cable" }, + { 0, NULL } +}; +#define SFF_8636_EXT_COMPLIANCE 0x80 + +/* SFF-8636 Encoding */ +static struct qsfp_table encoding[] = { + { 0x1, "8B10B" }, + { 0x2, "4B5B" }, + { 0x3, "NRZ" }, + { 0x4, "SONET Scrambled" }, + { 0x5, "64B66B" }, + { 0x6, "Manchester" }, + { 0x0, "Unspecified" } +}; +#endif + +/* struct i2c_sysfs_attributes */ +enum Cameo_i2c_sysfs_attributes +{ +#ifdef EEPROM_WANTED + TLV_STATUS, +#endif + /* i2c-0 */ + /*CPLD 0X30*/ + PSU_PRESENT, + PSU_STATUS, +#ifdef PSU_STAT_WANTED + PSU_MODULE_1, + PSU_MODULE_2, + DC_CHIP_SWITCH, +#endif +#ifdef USB_CTRL_WANTED + USB_POWER, +#endif +#ifdef LED_CTRL_WANTED + LED_CTRL, +#endif + LED_LOC, + LED_ALARM, + RESET_MAC, + SENSOR_STATUS, +#ifdef THEMAL_WANTED + SENSOR_TEMP, + MAC_TEMP, +#endif + SENSOR_INT_MASK, + INT_STATUS, + /*CPLD 0X31 & 0X32*/ + QSFP_LOW_POWER_ALL, + QSFP_RESET, + QSFP_PRESENT, + QSFP_INT, +#ifdef QSFP_WANTED + QSFP_TEMP, + QSFP_DATE, + QSFP_SN, + QSFP_PN, + QSFP_NAME, + QSFP_OUI, + QSFP_REV, + QSFP_CONNECTOR, + QSFP_ENCODING, + QSFP_NOMINAL, + QSFP_EXT_RATE_COM, + QSFP_ETH_COM_CODE, + QSFP_IDENTIFIER, + QSFP_FCMEDIA, + QSFP_FCSPEED, + QSFP_FCTECH, +#endif + FAN_STATUS, + FAN_PRESENT, + FAN_POWER, + FAN_SPEED_RPM, +#ifdef FAN_CTRL_WANTED + FAN_MODE, + FAN_RPM, +#endif +#ifdef ASPEED_BMC_WANTED + BMC_SERSOR_1, + BMC_SERSOR_2, + BMC_SERSOR_3, + BMC_SERSOR_4, + BMC_MAC_SENSOR, + BMC_DETECT, +#endif +#ifdef WDT_CTRL_WANTED + WDT_CTRL, +#endif +#ifdef EEPROM_WP_WANTED + EEPROM_WP_CTRL, +#endif + HW_VER, + SWITCH_BORAD_CPLD1, + SWITCH_BORAD_CPLD2, + SWITCH_BORAD_CPLD3, + FAN_BORAD_CPLD +}; +/* end of struct i2c_sysfs_attributes */ + +/* sysfs attributes for SENSOR_DEVICE_ATTR */ +/* i2c-0 */ +#ifdef EEPROM_WANTED +static SENSOR_DEVICE_ATTR(tlv_status , S_IRUGO , tlv_status_get , NULL , TLV_STATUS); +#endif +/*CPLD 0X30*/ +static SENSOR_DEVICE_ATTR(psu_present , S_IRUGO , psu_status_get , NULL , PSU_PRESENT); +static SENSOR_DEVICE_ATTR(psu_status , S_IRUGO , psu_status_get , NULL , PSU_STATUS); +#ifdef PSU_STAT_WANTED +static SENSOR_DEVICE_ATTR(psu_module_1 , S_IRUGO , psu_module_get , NULL , PSU_MODULE_1); +static SENSOR_DEVICE_ATTR(psu_module_2 , S_IRUGO , psu_module_get , NULL , PSU_MODULE_2); +static SENSOR_DEVICE_ATTR(dc_chip_switch , S_IRUGO , dc_chip_switch_get , NULL , DC_CHIP_SWITCH); +#endif +#ifdef USB_CTRL_WANTED +static SENSOR_DEVICE_ATTR(usb_power , S_IRUGO | S_IWUSR , usb_power_get , usb_power_set , USB_POWER); +#endif +#ifdef LED_CTRL_WANTED +static SENSOR_DEVICE_ATTR(led_ctrl , S_IRUGO | S_IWUSR , led_ctrl_get , led_ctrl_set , LED_CTRL); +#endif +static SENSOR_DEVICE_ATTR(led_loc , S_IRUGO | S_IWUSR , led_loc_get , led_loc_set , LED_LOC); +static SENSOR_DEVICE_ATTR(led_alarm , S_IRUGO | S_IWUSR , led_alarm_get , led_alarm_set , LED_ALARM); +static SENSOR_DEVICE_ATTR(reset_mac , S_IRUGO | S_IWUSR , NULL , reset_mac_set , RESET_MAC); +static SENSOR_DEVICE_ATTR(sensor_status , S_IRUGO , themal_status_get , NULL , SENSOR_STATUS); +#ifdef THEMAL_WANTED +static SENSOR_DEVICE_ATTR(sensor_temp , S_IRUGO , themal_temp_get , NULL , SENSOR_TEMP); +static SENSOR_DEVICE_ATTR(mac_temp , S_IRUGO , mac_temp_get , NULL , MAC_TEMP); +#endif +static SENSOR_DEVICE_ATTR(sensor_int_mask , S_IRUGO , themal_mask_get , NULL , SENSOR_INT_MASK); +static SENSOR_DEVICE_ATTR(sensor_int_mask_1 , S_IRUGO | S_IWUSR , NULL , themal_mask_set , 1); +static SENSOR_DEVICE_ATTR(sensor_int_mask_2 , S_IRUGO | S_IWUSR , NULL , themal_mask_set , 2); +static SENSOR_DEVICE_ATTR(sensor_int_mask_3 , S_IRUGO | S_IWUSR , NULL , themal_mask_set , 3); +static SENSOR_DEVICE_ATTR(sensor_int_mask_4 , S_IRUGO | S_IWUSR , NULL , themal_mask_set , 4); +static SENSOR_DEVICE_ATTR(int_status , S_IRUGO , int_status_get , NULL , INT_STATUS); +/*CPLD 0X31 & 0X32*/ +static SENSOR_DEVICE_ATTR(QSFP_low_power_all , S_IRUGO | S_IWUSR , low_power_all_get , low_power_all_set , QSFP_LOW_POWER_ALL); +static SENSOR_DEVICE_ATTR(QSFP_low_power_1 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 1); +static SENSOR_DEVICE_ATTR(QSFP_low_power_2 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 2); +static SENSOR_DEVICE_ATTR(QSFP_low_power_3 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 3); +static SENSOR_DEVICE_ATTR(QSFP_low_power_4 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 4); +static SENSOR_DEVICE_ATTR(QSFP_low_power_5 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 5); +static SENSOR_DEVICE_ATTR(QSFP_low_power_6 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 6); +static SENSOR_DEVICE_ATTR(QSFP_low_power_7 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 7); +static SENSOR_DEVICE_ATTR(QSFP_low_power_8 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 8); +static SENSOR_DEVICE_ATTR(QSFP_low_power_9 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 9); +static SENSOR_DEVICE_ATTR(QSFP_low_power_10 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 10); +static SENSOR_DEVICE_ATTR(QSFP_low_power_11 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 11); +static SENSOR_DEVICE_ATTR(QSFP_low_power_12 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 12); +static SENSOR_DEVICE_ATTR(QSFP_low_power_13 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 13); +static SENSOR_DEVICE_ATTR(QSFP_low_power_14 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 14); +static SENSOR_DEVICE_ATTR(QSFP_low_power_15 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 15); +static SENSOR_DEVICE_ATTR(QSFP_low_power_16 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 16); +static SENSOR_DEVICE_ATTR(QSFP_low_power_17 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 17); +static SENSOR_DEVICE_ATTR(QSFP_low_power_18 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 18); +static SENSOR_DEVICE_ATTR(QSFP_low_power_19 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 19); +static SENSOR_DEVICE_ATTR(QSFP_low_power_20 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 20); +static SENSOR_DEVICE_ATTR(QSFP_low_power_21 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 21); +static SENSOR_DEVICE_ATTR(QSFP_low_power_22 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 22); +static SENSOR_DEVICE_ATTR(QSFP_low_power_23 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 23); +static SENSOR_DEVICE_ATTR(QSFP_low_power_24 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 24); +static SENSOR_DEVICE_ATTR(QSFP_low_power_25 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 25); +static SENSOR_DEVICE_ATTR(QSFP_low_power_26 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 26); +static SENSOR_DEVICE_ATTR(QSFP_low_power_27 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 27); +static SENSOR_DEVICE_ATTR(QSFP_low_power_28 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 28); +static SENSOR_DEVICE_ATTR(QSFP_low_power_29 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 29); +static SENSOR_DEVICE_ATTR(QSFP_low_power_30 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 30); +static SENSOR_DEVICE_ATTR(QSFP_low_power_31 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 31); +static SENSOR_DEVICE_ATTR(QSFP_low_power_32 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 32); +static SENSOR_DEVICE_ATTR(QSFP_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , QSFP_RESET); +static SENSOR_DEVICE_ATTR(QSFP_present , S_IRUGO , qsfp_status_get , NULL , QSFP_PRESENT); +static SENSOR_DEVICE_ATTR(QSFP_int , S_IRUGO , qsfp_status_get , NULL , QSFP_INT); +#ifdef QSFP_WANTED +static SENSOR_DEVICE_ATTR(QSFP_temp , S_IRUGO , qsfp_temp_get , NULL , QSFP_TEMP); +static SENSOR_DEVICE_ATTR(QSFP_date , S_IRUGO , qsfp_date_get , NULL , QSFP_DATE); +static SENSOR_DEVICE_ATTR(QSFP_sn , S_IRUGO , qsfp_sn_get , NULL , QSFP_SN); +static SENSOR_DEVICE_ATTR(QSFP_pn , S_IRUGO , qsfp_pn_get , NULL , QSFP_PN); +static SENSOR_DEVICE_ATTR(QSFP_name , S_IRUGO , qsfp_name_get , NULL , QSFP_NAME); +static SENSOR_DEVICE_ATTR(QSFP_oui , S_IRUGO , qsfp_oui_get , NULL , QSFP_OUI); +static SENSOR_DEVICE_ATTR(QSFP_rev , S_IRUGO , qsfp_rev_get , NULL , QSFP_REV); +static SENSOR_DEVICE_ATTR(QSFP_connector , S_IRUGO , qsfp_connector_get, NULL , QSFP_CONNECTOR); +static SENSOR_DEVICE_ATTR(QSFP_encoding , S_IRUGO , qsfp_encoding_get , NULL , QSFP_ENCODING); +static SENSOR_DEVICE_ATTR(QSFP_nominal , S_IRUGO , qsfp_nominal_get , NULL , QSFP_NOMINAL); +static SENSOR_DEVICE_ATTR(QSFP_ext_rate_com , S_IRUGO , qsfp_ext_rate_com_get , NULL , QSFP_EXT_RATE_COM); +static SENSOR_DEVICE_ATTR(QSFP_eth_com_code , S_IRUGO , qsfp_eth_com_code_get , NULL , QSFP_ETH_COM_CODE); +static SENSOR_DEVICE_ATTR(QSFP_identifier , S_IRUGO , qsfp_identifier_get , NULL , QSFP_IDENTIFIER); +static SENSOR_DEVICE_ATTR(QSFP_fcmedia , S_IRUGO , qsfp_fc_media_get , NULL , QSFP_FCMEDIA); +static SENSOR_DEVICE_ATTR(QSFP_fcspeed , S_IRUGO , qsfp_fc_speed_get , NULL , QSFP_FCSPEED); +static SENSOR_DEVICE_ATTR(QSFP_fctech , S_IRUGO , qsfp_cab_tech_get , NULL , QSFP_FCTECH); +#endif +static SENSOR_DEVICE_ATTR(fan_status , S_IRUGO , fan_status_get , NULL , FAN_STATUS); +static SENSOR_DEVICE_ATTR(fan_present , S_IRUGO , fan_status_get , NULL , FAN_PRESENT); +static SENSOR_DEVICE_ATTR(fan_power , S_IRUGO , fan_status_get , NULL , FAN_POWER); +static SENSOR_DEVICE_ATTR(fan_speed_rpm , S_IRUGO , fan_status_get , NULL , FAN_SPEED_RPM); +#ifdef FAN_CTRL_WANTED +static SENSOR_DEVICE_ATTR(fan_mode , S_IRUGO | S_IWUSR , fan_mode_get , fan_mode_set , FAN_MODE); +static SENSOR_DEVICE_ATTR(fan_rpm , S_IRUGO | S_IWUSR , fan_rpm_get , fan_rpm_set , FAN_RPM); +#endif +#ifdef ASPEED_BMC_WANTED +static SENSOR_DEVICE_ATTR(bmc_sersor_1 , S_IRUGO , bmc_register_get , NULL , BMC_SERSOR_1); +static SENSOR_DEVICE_ATTR(bmc_sersor_2 , S_IRUGO , bmc_register_get , NULL , BMC_SERSOR_2); +static SENSOR_DEVICE_ATTR(bmc_sersor_3 , S_IRUGO , bmc_register_get , NULL , BMC_SERSOR_3); +static SENSOR_DEVICE_ATTR(bmc_sersor_4 , S_IRUGO , bmc_register_get , NULL , BMC_SERSOR_4); +static SENSOR_DEVICE_ATTR(bmc_mac_sensor , S_IRUGO , bmc_register_get , NULL , BMC_MAC_SENSOR); +static SENSOR_DEVICE_ATTR(bmc_present , S_IRUGO , bmc_module_detect , NULL , BMC_DETECT); +#endif +#ifdef WDT_CTRL_WANTED +static SENSOR_DEVICE_ATTR(wdt_ctrl , S_IRUGO | S_IWUSR , wdt_status_get , wdt_status_set , WDT_CTRL); +#endif +#ifdef EEPROM_WP_WANTED +static SENSOR_DEVICE_ATTR(eeprom_wp_ctrl , S_IRUGO | S_IWUSR , eeprom_wp_status_get , eeprom_wp_status_set , EEPROM_WP_CTRL); +#endif +static SENSOR_DEVICE_ATTR(hw_version , S_IRUGO , hw_version_get , NULL , HW_VER); +static SENSOR_DEVICE_ATTR(cpld1_version , S_IRUGO , cpld_version_get , NULL , SWITCH_BORAD_CPLD1); +static SENSOR_DEVICE_ATTR(cpld2_version , S_IRUGO , cpld_version_get , NULL , SWITCH_BORAD_CPLD2); +static SENSOR_DEVICE_ATTR(cpld3_version , S_IRUGO , cpld_version_get , NULL , SWITCH_BORAD_CPLD3); +static SENSOR_DEVICE_ATTR(cpld4_version , S_IRUGO , cpld_version_get , NULL , FAN_BORAD_CPLD); +/* end of sysfs attributes for SENSOR_DEVICE_ATTR */ + +/* sysfs attributes for hwmon */ +/* i2c-0 */ +#ifdef EEPROM_WANTED +static struct attribute *ESC601_EEPROM_attributes[] = +{ + &sensor_dev_attr_tlv_status.dev_attr.attr, + NULL +}; +#endif + +static struct attribute *ESC601_SYS_attributes[] = +{ + &sensor_dev_attr_hw_version.dev_attr.attr, + &sensor_dev_attr_cpld1_version.dev_attr.attr, + &sensor_dev_attr_cpld2_version.dev_attr.attr, + &sensor_dev_attr_cpld3_version.dev_attr.attr, + &sensor_dev_attr_cpld4_version.dev_attr.attr, +#ifdef WDT_CTRL_WANTED + &sensor_dev_attr_wdt_ctrl.dev_attr.attr, +#endif +#ifdef EEPROM_WP_WANTED + &sensor_dev_attr_eeprom_wp_ctrl.dev_attr.attr, +#endif + NULL +}; + +static struct attribute *ESC601_PSU_attributes[] = +{ + &sensor_dev_attr_psu_present.dev_attr.attr, + &sensor_dev_attr_psu_status.dev_attr.attr, +#ifdef PSU_STAT_WANTED + &sensor_dev_attr_psu_module_1.dev_attr.attr, + &sensor_dev_attr_psu_module_2.dev_attr.attr, + &sensor_dev_attr_dc_chip_switch.dev_attr.attr, +#endif + NULL +}; +#ifdef USB_CTRL_WANTED +static struct attribute *ESC601_USB_attributes[] = +{ + &sensor_dev_attr_usb_power.dev_attr.attr, + NULL +}; +#endif +static struct attribute *ESC601_LED_attributes[] = +{ +#ifdef LED_CTRL_WANTED + &sensor_dev_attr_led_ctrl.dev_attr.attr, +#endif + &sensor_dev_attr_led_loc.dev_attr.attr, + &sensor_dev_attr_led_alarm.dev_attr.attr, + NULL +}; + +static struct attribute *ESC601_Reset_attributes[] = +{ + &sensor_dev_attr_reset_mac.dev_attr.attr, + NULL +}; + +static struct attribute *ESC601_Sensor_attributes[] = +{ + &sensor_dev_attr_sensor_status.dev_attr.attr, +#ifdef THEMAL_WANTED + &sensor_dev_attr_sensor_temp.dev_attr.attr, + &sensor_dev_attr_mac_temp.dev_attr.attr, +#endif + NULL +}; + +static struct attribute *ESC601_INT_attributes[] = +{ + &sensor_dev_attr_int_status.dev_attr.attr, + &sensor_dev_attr_QSFP_int.dev_attr.attr, + &sensor_dev_attr_sensor_int_mask.dev_attr.attr, + &sensor_dev_attr_sensor_int_mask_1.dev_attr.attr, + &sensor_dev_attr_sensor_int_mask_2.dev_attr.attr, + &sensor_dev_attr_sensor_int_mask_3.dev_attr.attr, + &sensor_dev_attr_sensor_int_mask_4.dev_attr.attr, + NULL +}; + +static struct attribute *ESC601_QSFP_attributes[] = +{ + &sensor_dev_attr_QSFP_present.dev_attr.attr, +#ifdef QSFP_WANTED + &sensor_dev_attr_QSFP_temp.dev_attr.attr, + &sensor_dev_attr_QSFP_date.dev_attr.attr, + &sensor_dev_attr_QSFP_sn.dev_attr.attr, + &sensor_dev_attr_QSFP_pn.dev_attr.attr, + &sensor_dev_attr_QSFP_name.dev_attr.attr, + &sensor_dev_attr_QSFP_oui.dev_attr.attr, + &sensor_dev_attr_QSFP_rev.dev_attr.attr, + &sensor_dev_attr_QSFP_connector.dev_attr.attr, + &sensor_dev_attr_QSFP_encoding.dev_attr.attr, + &sensor_dev_attr_QSFP_nominal.dev_attr.attr, + &sensor_dev_attr_QSFP_ext_rate_com.dev_attr.attr, + &sensor_dev_attr_QSFP_eth_com_code.dev_attr.attr, + &sensor_dev_attr_QSFP_identifier.dev_attr.attr, + &sensor_dev_attr_QSFP_fcmedia.dev_attr.attr, + &sensor_dev_attr_QSFP_fcspeed.dev_attr.attr, + &sensor_dev_attr_QSFP_fctech.dev_attr.attr, +#endif + &sensor_dev_attr_QSFP_reset.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_all.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_1.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_2.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_3.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_4.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_5.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_6.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_7.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_8.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_9.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_10.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_11.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_12.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_13.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_14.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_15.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_16.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_17.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_18.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_19.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_20.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_21.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_22.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_23.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_24.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_25.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_26.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_27.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_28.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_29.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_30.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_31.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_32.dev_attr.attr, + NULL +}; + +static struct attribute *ESC601_FAN_attributes[] = { + &sensor_dev_attr_fan_status.dev_attr.attr, + &sensor_dev_attr_fan_present.dev_attr.attr, + &sensor_dev_attr_fan_power.dev_attr.attr, + &sensor_dev_attr_fan_speed_rpm.dev_attr.attr, +#ifdef FAN_CTRL_WANTED + &sensor_dev_attr_fan_mode.dev_attr.attr, + &sensor_dev_attr_fan_rpm.dev_attr.attr, +#endif + NULL +}; + +#ifdef ASPEED_BMC_WANTED +static struct attribute *ESC601_BMC_attributes[] = { + &sensor_dev_attr_bmc_sersor_1.dev_attr.attr, + &sensor_dev_attr_bmc_sersor_2.dev_attr.attr, + &sensor_dev_attr_bmc_sersor_3.dev_attr.attr, + &sensor_dev_attr_bmc_sersor_4.dev_attr.attr, + &sensor_dev_attr_bmc_mac_sensor.dev_attr.attr, + &sensor_dev_attr_bmc_present.dev_attr.attr, + NULL +}; +#endif +/* end of sysfs attributes for hwmon */ + +/* struct attribute_group */ +#ifdef EEPROM_WANTED +static const struct attribute_group ESC601_EEPROM_group = +{ + .name = "ESC601_EEPROM", + .attrs = ESC601_EEPROM_attributes, +}; +#endif + +static const struct attribute_group ESC601_SYS_group = +{ + .name = "ESC601_SYS", + .attrs = ESC601_SYS_attributes, +}; + +static const struct attribute_group ESC601_PSU_group = +{ + .name = "ESC601_PSU", + .attrs = ESC601_PSU_attributes, +}; + +#ifdef USB_CTRL_WANTED +static const struct attribute_group ESC601_USB_group = +{ + .name = "ESC601_USB", + .attrs = ESC601_USB_attributes, +}; +#endif + +static const struct attribute_group ESC601_LED_group = +{ + .name = "ESC601_LED", + .attrs = ESC601_LED_attributes, +}; + +static const struct attribute_group ESC601_Reset_group = +{ + .name = "ESC601_Reset", + .attrs = ESC601_Reset_attributes, +}; + +static const struct attribute_group ESC601_Sensor_group = +{ + .name = "ESC601_Sensor", + .attrs = ESC601_Sensor_attributes, +}; + +static const struct attribute_group ESC601_INT_group = +{ + .name = "ESC601_INT", + .attrs = ESC601_INT_attributes, +}; + +static const struct attribute_group ESC601_QSFP_group = +{ + .name = "ESC601_QSFP", + .attrs = ESC601_QSFP_attributes, +}; + +static const struct attribute_group ESC601_FAN_group = +{ + .name = "ESC601_FAN", + .attrs = ESC601_FAN_attributes, +}; + +#ifdef ASPEED_BMC_WANTED +static const struct attribute_group ESC601_BMC_group = +{ + .name = "ESC601_BMC", + .attrs = ESC601_BMC_attributes, +}; +#endif +/* end of struct attribute_group */ diff --git a/platform/innovium/sonic-platform-modules-cameo/esc601-32q/modules/zrh2800k2.c b/platform/innovium/sonic-platform-modules-cameo/esc601-32q/modules/zrh2800k2.c new file mode 100644 index 0000000000..a24b2b8836 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc601-32q/modules/zrh2800k2.c @@ -0,0 +1,684 @@ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DEBUG_MSG +#ifdef DEBUG_MSG + #define debug_print(s) printk s +#else + #define debug_print(s) +#endif + +//#define SYMBOL_FOR_LM_SENSOR + + +struct zrh2800k2_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u64 last_energy_value_EIN; + u64 last_smaple_count_EIN; + u64 last_energy_value_EOUT; + u64 last_smaple_count_EOUT; +}; + +typedef enum _access_type_{ + READ_BYTE, + READ_WORD, + READ_BLOCK +}ACCESS_TYPE; + +typedef enum _value_format_{ + FORMAT_NORMAL, + FORMAT_DIRECT, + FORMAT_LINEAR +}VALUE_FORMAT; + +typedef enum _zrh2800k2_regs_ { + REG_CAPABILITY = 0x19, + REG_QUERY = 0X1A, + REG_VOUT_MODE = 0x20, + REG_COEFFICIENTS = 0X30, + REG_FAN_CONFIG_1_2 = 0x3A, + REG_STATUS_WORD = 0x79, + REG_STATUS_VOUT = 0x7A, + REG_STATUS_IOUT = 0x7B, + REG_STATUS_INPUT = 0x7C, + REG_STATUS_TEMPERATURE = 0x7D, + REG_STATUS_FANS_1_2 = 0x81, + REG_READ_EIN = 0x86, /* direct data format */ + REG_READ_EOUT = 0x87, /* direct data format */ + REG_READ_VIN = 0x88, + REG_READ_IIN = 0x89, + REG_READ_VOUT = 0x8B, /* linear data format */ + REG_READ_IOUT = 0x8C, /* linear data format */ + REG_READ_TEMPERATURE1 = 0x8D, /* linear data format */ + REG_READ_FAN_SPEED_1 = 0x90, /* linear data format */ + REG_READ_POUT = 0x96, /* linear data format */ + REG_READ_PIN = 0x97, /* linear data format */ + REG_READ_PMBUS_REVISION = 0x98, + REG_READ_MFR_ID = 0x99, /* ZIPPY 5 BYTES */ + REG_READ_MFR_MODEL = 0x9A, + REG_READ_MFR_VIN_MAX = 0xA4, /* linear data format */ + REG_READ_MFR_IOUT_MAX = 0xA6 /* lineat data format */ +}ZRH2800K2_REGS; + +enum zrh2800k2_sysfs_attributes { + PSU_CAPABILITY, /* 0 */ + PSU_QUERY, + PSU_VOUT_MODE, + PSU_COEFFICIENTS, + PSU_FAN_CONFIG_1_2, + PSU_STATUS_WORD, /* 5 */ + PSU_STATUS_VOUT, + PSU_STATUS_IOUT, + PSU_STATUS_INPUT, + PSU_STATUS_TEMPERATURE, + PSU_STATUS_FANS_1_2, /* 10 */ + PSU_EIN, + PSU_EOUT, + PSU_VIN, + PSU_IIN, + PSU_VOUT, /* 15 */ + PSU_IOUT, + PSU_TEMPERATURE_1, + PSU_FAN_SPEED_1, + PSU_POUT, + PSU_PIN, /* 20 */ + PSU_PMBUS_REVISION, + PSU_MFR_ID, + PSU_MFR_MODEL, + PSU_MFR_VIN_MAX, + PSU_MFR_IOUT_MAX +}; + +struct _OPERATION_SET_ { + ZRH2800K2_REGS reg; + ACCESS_TYPE type; + u8 data_size; // unit: byte, only used for block read +}; + +/* the index of operations are mapping to the zrh2800k2_sysfs_attributes */ +static struct _OPERATION_SET_ operation_set[] = { + { REG_CAPABILITY, READ_BYTE, 1 }, // 0 + { REG_QUERY, READ_BYTE, 1}, // 1 + { REG_VOUT_MODE, READ_BYTE, 1 }, // 2 + { REG_COEFFICIENTS, READ_BLOCK, 5 }, // 3 + { REG_FAN_CONFIG_1_2 , READ_BYTE, 1 }, // 4 + { REG_STATUS_WORD, READ_WORD, 2 }, // 5 + { REG_STATUS_VOUT, READ_BYTE, 1 }, // 6 + { REG_STATUS_IOUT, READ_BYTE, 1 }, // 7 + { REG_STATUS_INPUT, READ_BYTE, 1 }, // 8 + { REG_STATUS_TEMPERATURE, READ_BYTE, 1 }, //9 + { REG_STATUS_FANS_1_2, READ_BYTE, 1 }, // 10 + { REG_READ_EIN, READ_BLOCK, 6 }, // 11 + { REG_READ_EOUT, READ_BLOCK, 6 }, // 12 + { REG_READ_VIN, READ_WORD, 2 }, // 13 + { REG_READ_IIN, READ_WORD, 2 }, // 14 + { REG_READ_VOUT, READ_WORD, 2 }, // 15 + { REG_READ_IOUT, READ_WORD, 2 }, // 16 + { REG_READ_TEMPERATURE1, READ_WORD, 2 }, // 17 + { REG_READ_FAN_SPEED_1, READ_WORD, 2 }, // 18 + { REG_READ_POUT, READ_WORD, 2 }, // 19 + { REG_READ_PIN, READ_WORD, 2 }, // 20 + { REG_READ_PMBUS_REVISION, READ_BYTE, 1 }, //21 + { REG_READ_MFR_ID, READ_BLOCK, 5 }, // 22 + { REG_READ_MFR_MODEL, READ_BLOCK, 9 }, // 23 + { REG_READ_MFR_VIN_MAX, READ_WORD, 2 }, // 24 + { REG_READ_MFR_IOUT_MAX, READ_WORD, 2 } // 25 +}; + + +static int zrh2800k2_remove(struct i2c_client *client); +static int zrh2800k2_probe(struct i2c_client *client, const struct i2c_device_id *dev_id); +static ssize_t show_value(struct device *dev, struct device_attribute *da, char *buf); + +static ssize_t show_capability(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t psu_pm_query(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t psu_coefficient(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t set_fan_config(struct device *dev, struct device_attribute *da, const char *buf, size_t count); + + +/* Addresses scanned */ +static const unsigned short normal_i2c[] = { 0x58, 0x59, I2C_CLIENT_END }; + +/* sysfs attributes for hwmon */ +static SENSOR_DEVICE_ATTR(psu_query, S_IRUGO, psu_pm_query, NULL, PSU_QUERY); +static SENSOR_DEVICE_ATTR(psu_coeff, S_IRUGO, psu_coefficient,NULL, PSU_COEFFICIENTS); +static SENSOR_DEVICE_ATTR(psu_fan_config_1_2, S_IRUGO|S_IWUSR, show_value, set_fan_config, PSU_FAN_CONFIG_1_2); +static SENSOR_DEVICE_ATTR(psu_capability, S_IRUGO, show_capability, NULL, PSU_CAPABILITY); +static SENSOR_DEVICE_ATTR(psu_vout_mode, S_IRUGO, show_value, NULL, PSU_VOUT_MODE); +static SENSOR_DEVICE_ATTR(psu_status_word, S_IRUGO, show_value, NULL, PSU_STATUS_WORD); +static SENSOR_DEVICE_ATTR(psu_status_vout, S_IRUGO, show_value, NULL, PSU_STATUS_VOUT); +static SENSOR_DEVICE_ATTR(psu_status_iout, S_IRUGO, show_value, NULL, PSU_STATUS_IOUT); +static SENSOR_DEVICE_ATTR(psu_status_input, S_IRUGO, show_value, NULL, PSU_STATUS_INPUT); +static SENSOR_DEVICE_ATTR(psu_status_temp, S_IRUGO, show_value, NULL, PSU_STATUS_TEMPERATURE); +static SENSOR_DEVICE_ATTR(psu_status_fan_1_2, S_IRUGO, show_value, NULL, PSU_STATUS_FANS_1_2); +static SENSOR_DEVICE_ATTR(psu_ein, S_IRUGO, show_value, NULL, PSU_EIN); +static SENSOR_DEVICE_ATTR(psu_eout, S_IRUGO, show_value, NULL, PSU_EOUT); +static SENSOR_DEVICE_ATTR(psu_pmbus_rev,S_IRUGO, show_value, NULL, PSU_PMBUS_REVISION); +static SENSOR_DEVICE_ATTR(psu_mfr_id, S_IRUGO, show_value, NULL, PSU_MFR_ID); +static SENSOR_DEVICE_ATTR(psu_mfr_model,S_IRUGO, show_value, NULL, PSU_MFR_MODEL); + +static SENSOR_DEVICE_ATTR(psu_vin, S_IRUGO, show_value, NULL, PSU_VIN); +static SENSOR_DEVICE_ATTR(psu_vout, S_IRUGO, show_value, NULL, PSU_VOUT); +static SENSOR_DEVICE_ATTR(psu_iin, S_IRUGO, show_value, NULL, PSU_IIN); +static SENSOR_DEVICE_ATTR(psu_iout, S_IRUGO, show_value, NULL, PSU_IOUT); +static SENSOR_DEVICE_ATTR(psu_iout_max, S_IRUGO, show_value, NULL, PSU_MFR_IOUT_MAX); +static SENSOR_DEVICE_ATTR(psu_pin, S_IRUGO, show_value, NULL, PSU_PIN); +static SENSOR_DEVICE_ATTR(psu_pout, S_IRUGO, show_value, NULL, PSU_POUT); + +static SENSOR_DEVICE_ATTR(psu_temp_1, S_IRUGO, show_value, NULL, PSU_TEMPERATURE_1); +static SENSOR_DEVICE_ATTR(psu_fan_speed_1, S_IRUGO, show_value, NULL, PSU_FAN_SPEED_1); + +/* section for lm-sensor */ +#ifdef SYMBOL_FOR_LM_SENSOR +static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_value, NULL, PSU_VIN); +// static SENSOR_DEVICE_ATTR(in1_max, S_IRUGO, show_value, NULL, PSU_MFR_VIN_MAX); -> not support +static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_value, NULL, PSU_VOUT); +static SENSOR_DEVICE_ATTR(curr1_input, S_IRUGO, show_value, NULL, PSU_IIN); +static SENSOR_DEVICE_ATTR(curr2_input, S_IRUGO, show_value, NULL, PSU_IOUT); +static SENSOR_DEVICE_ATTR(curr2_max, S_IRUGO, show_value, NULL, PSU_MFR_IOUT_MAX); +static SENSOR_DEVICE_ATTR(power1_input, S_IRUGO, show_value, NULL, PSU_PIN); +static SENSOR_DEVICE_ATTR(power2_input, S_IRUGO, show_value, NULL, PSU_POUT); + +static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_value, NULL, PSU_TEMPERATURE_1); +static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_value, NULL, PSU_FAN_SPEED_1); +#endif + +static struct attribute *zrh2800k2_attributes[] = { + &sensor_dev_attr_psu_query.dev_attr.attr, + &sensor_dev_attr_psu_coeff.dev_attr.attr, + &sensor_dev_attr_psu_fan_config_1_2.dev_attr.attr, + &sensor_dev_attr_psu_capability.dev_attr.attr, + &sensor_dev_attr_psu_vout_mode.dev_attr.attr, + &sensor_dev_attr_psu_status_word.dev_attr.attr, + &sensor_dev_attr_psu_status_vout.dev_attr.attr, + &sensor_dev_attr_psu_status_iout.dev_attr.attr, + &sensor_dev_attr_psu_status_input.dev_attr.attr, + &sensor_dev_attr_psu_status_temp.dev_attr.attr, + &sensor_dev_attr_psu_status_fan_1_2.dev_attr.attr, + &sensor_dev_attr_psu_ein.dev_attr.attr, + &sensor_dev_attr_psu_eout.dev_attr.attr, + &sensor_dev_attr_psu_pmbus_rev.dev_attr.attr, + &sensor_dev_attr_psu_mfr_id.dev_attr.attr, + &sensor_dev_attr_psu_mfr_model.dev_attr.attr, + &sensor_dev_attr_psu_vin.dev_attr.attr, + &sensor_dev_attr_psu_vout.dev_attr.attr, + &sensor_dev_attr_psu_iin.dev_attr.attr, + &sensor_dev_attr_psu_iout.dev_attr.attr, + &sensor_dev_attr_psu_iout_max.dev_attr.attr, + &sensor_dev_attr_psu_pin.dev_attr.attr, + &sensor_dev_attr_psu_pout.dev_attr.attr, + &sensor_dev_attr_psu_temp_1.dev_attr.attr, + &sensor_dev_attr_psu_fan_speed_1.dev_attr.attr, +#ifdef SYMBOL_FOR_LM_SENSOR + &sensor_dev_attr_in1_input.dev_attr.attr, + &sensor_dev_attr_in2_input.dev_attr.attr, + &sensor_dev_attr_curr1_input.dev_attr.attr, + &sensor_dev_attr_curr2_input.dev_attr.attr, + &sensor_dev_attr_curr2_max.dev_attr.attr, + &sensor_dev_attr_power1_input.dev_attr.attr, + &sensor_dev_attr_power2_input.dev_attr.attr, + &sensor_dev_attr_temp1_input.dev_attr.attr, + &sensor_dev_attr_fan1_input.dev_attr.attr, +#endif + NULL +}; + +static const struct attribute_group zrh2800k2_group = { + .attrs = zrh2800k2_attributes, +}; + +static u32 easy_pow(u32 num, u32 power) +{ + if(power == 0) + return 1; + + power--; + + while(power) { + num = num*num; + power--; + } + return num; +} + +static int two_complement_to_int(u16 data, u8 valid_bit, int mask) +{ + u16 valid_data = data & mask; + bool is_negative = valid_data >> (valid_bit - 1); + + return is_negative ? (-(((~valid_data) & mask) + 1)) : valid_data; +} + + +static int zrh2800k2_read(struct device *dev, ACCESS_TYPE rtype , ZRH2800K2_REGS reg) +{ + + struct i2c_client *client = to_i2c_client(dev); + struct zrh2800k2_data *data = i2c_get_clientdata(client); + + int result; + + mutex_lock(&data->update_lock); + + if (rtype == READ_BYTE) { + result = i2c_smbus_read_byte_data(client, (u8)reg); + }else if(rtype == READ_WORD) { + result = i2c_smbus_read_word_data(client, (u8)reg); + }else{ + printk(KERN_ALERT "ERROR: unknown read type"); + } + + mutex_unlock(&data->update_lock); + + return result; + +} + + +static int zrh2800k2_read_block(struct device *dev, ZRH2800K2_REGS reg, u8* block_data, int block_data_len) +{ + + struct i2c_client *client = to_i2c_client(dev); + struct zrh2800k2_data *data = i2c_get_clientdata(client); + + int result; + + mutex_lock(&data->update_lock); + + result = i2c_smbus_read_i2c_block_data(client, (u8)reg, block_data_len, block_data); + + mutex_unlock(&data->update_lock); + + if (unlikely(result < 0)) { + goto read_block_exit; + } + + if (result != block_data_len) { + result = -EIO; + goto read_block_exit; + } + + result = 0; + +read_block_exit: + return result; + +} + +static int get_coefficient(struct device* dev, u16* m, u16* b, u8* R) +{ + u8 buf_block[6] = {0}; + int ret = zrh2800k2_read_block(dev, REG_COEFFICIENTS, buf_block, 6); + + + // [ byte_count,m-l,m-h,b-l,b-h,R ] + if (ret < 0) { + printk(KERN_ALERT "get coefficient fail(%d)\n", ret); + return -1; + } + + *R = buf_block[5]; + *m = buf_block[2]; + *m = ((*m)<<8 )+ buf_block[1]; + *b = buf_block[4]; + *b = ((*b)<<8 )+ buf_block[3]; + + debug_print((KERN_DEBUG " coefficient read : 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x \n", buf_block[0], buf_block[1], buf_block[2], + buf_block[3], buf_block[4], buf_block[5])); + debug_print((KERN_DEBUG " coefficient r m b: 0x%x, 0x%x, 0x%x \n", *R, *m, *b)); + + return 0; + +} + + +/* read a byte or word value and show*/ +static ssize_t show_value(struct device *dev, struct device_attribute *da, char *buf) +{ + + u16 u16_val = 0; + int exponent = 0, mantissa = 0; + int multiplier = 1000; // lm-sensor uint: mV, mA, mC + + u8 buf_block[11] = {0}; // used to save enough data from read block. + + char *ascii = NULL; + int ret = 0; + + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + debug_print((KERN_DEBUG "show value op[%d]: reg %d\n", attr->index, + operation_set[attr->index].reg )); + + switch (operation_set[attr->index].type) { + + case READ_BYTE: + case READ_WORD: + ret = zrh2800k2_read(dev, operation_set[attr->index].type , operation_set[attr->index].reg); + break; + + case READ_BLOCK: + ret = zrh2800k2_read_block(dev, operation_set[attr->index].reg, buf_block, operation_set[attr->index].data_size + 1); + break; + + default: + printk(KERN_ALERT "unknown access type\n"); + return 0; + + } + + if (ret < 0) { + printk(KERN_ALERT "ERROR: Read fail ret(%d)\n", ret); + return 0; + } + + /* arrange return buf */ + switch (attr->index) { + + /* case directly return */ + case PSU_STATUS_WORD: + case PSU_VOUT_MODE: + return sprintf(buf, "%d\n", ret); + + case PSU_STATUS_VOUT: + return sprintf(buf, + "VOUT Over Voltage Fault : %d \nVOUT Over Voltage Warning : %d \nVOUT Under Voltage Warning : %d \nVOUT Under Voltage Fault : %d \n", + (ret>>7)&0x1,(ret>>6)&0x1, + (ret>>5)&0x1,(ret>>4)&0x1); + + case PSU_STATUS_IOUT: + return sprintf(buf, + "IOUT Overcurrent Fault : %d \nIOUT Overcurrent Warnning : %d \nPOUT Overcurrent Fault : %d \nPOUT Overcurrent Warnning : %d \n", + (ret>>7)&0x1, (ret>>5)&0x1, + (ret>>1)&0x1, ret&0x1); + + case PSU_STATUS_INPUT: + return sprintf(buf, + "PIN Overpower Warning : %d \n", (ret&0x1)); + + case PSU_STATUS_TEMPERATURE: + return sprintf(buf, + "Overtemperature Fault : %d \nOvertemperature Warning : %d \nUbdertemperature Warning : %d \nUbdertemperature Fault : %d \n", + (ret>>7)&0x1,(ret>>6)&0x1, + (ret>>5)&0x1,(ret>>4)&0x1); + + case PSU_STATUS_FANS_1_2: + return sprintf(buf, + "Fan Fault : %d \nFan Warning : %d \n", + (ret>>7)&0x1, (ret>>5)&0x1); + + case PSU_FAN_CONFIG_1_2: + debug_print((KERN_DEBUG "PSU_FAN_CONFIG_1_2: 0x%X\n",ret)); + return sprintf(buf, + "Fan is installed in Position1: %s\n" \ + "Fan1 speed Unit: %s\n" \ + "Fan1 Tachometer Pulses Per Revolution 0x%x\n" \ + "Fan install in Position2: %s\n" \ + "Fan2 speed Unit: %s\n" \ + "Fan2 Tachometer Pulses Per Revolution 0x%x\n", + (ret>>7)?"YES":"NONE", + ((ret>>6)&0x1)?"RPM":"Duty Cycle", + (ret>>4)&0x3, + (ret>>3&0x01)?"YES":"NONE", + ((ret>>2)&0x1)?"RPM":"Duty Cycle", + ret&0x3); + + /* special case for READ_VOUT */ + case PSU_VOUT: + /* save mantissa */ + mantissa = ret; + + debug_print((KERN_DEBUG "PSU_VOUT: mantissa 0x%X\n",mantissa)); + + /* read the exponent from REG_READ_VMODE */ + ret = zrh2800k2_read(dev, READ_BYTE , REG_VOUT_MODE); + if (ret < 0) { + printk(KERN_ALERT "Error: Read fail ret(%d)\n", ret); + return 0; + } + exponent = two_complement_to_int(ret & 0x1f, 5, 0x1f); + + debug_print((KERN_DEBUG "PSU_VOUT: VOUT_MODE 0x%X\n",ret)); + debug_print((KERN_DEBUG "PSU_VOUT: exponent 0x%X\n",exponent)); + + return (exponent >= 0) ? sprintf(buf, "%d\n", (mantissa << exponent)*multiplier ) : \ + sprintf(buf, "%d\n", (mantissa*multiplier / (1 << -exponent))); + + /* word data with linear format */ + case PSU_POUT: + case PSU_PIN: + multiplier = 1000000; // lm-sensor unit: uW + case PSU_VIN: + case PSU_IIN: + case PSU_IOUT: + case PSU_TEMPERATURE_1: + case PSU_FAN_SPEED_1: + case PSU_MFR_VIN_MAX: + case PSU_MFR_IOUT_MAX: + + if (attr->index == PSU_FAN_SPEED_1) + multiplier = 1; + + u16_val = ret; + exponent = two_complement_to_int(u16_val >> 11, 5, 0x1f); + mantissa = two_complement_to_int(u16_val & 0x7ff, 11, 0x7ff); + + debug_print((KERN_DEBUG "REG(%d): ret 0x%X, u16_val: 0x%x\n", attr->index, ret, u16_val)); + debug_print((KERN_DEBUG "REG(%d): exponent 0x%X\n", attr->index, exponent)); + debug_print((KERN_DEBUG "REG(%d): mantissa 0x%X\n", attr->index, mantissa)); + + return (exponent >= 0) ? sprintf(buf, "%d\n", (mantissa << exponent)*multiplier ) : \ + sprintf(buf, "%d\n", (mantissa*multiplier / (1 << -exponent))); + + case PSU_EIN: + case PSU_EOUT: { + + u16 m,b; + u8 R; + + u64 ev = buf_block[2]; + u8 rc = buf_block[3]; + u64 sc = buf_block[6]; + u32 sc_mid = buf_block[5]; + u64 average_value = 0; + + struct i2c_client *client = to_i2c_client(dev); + struct zrh2800k2_data *data = i2c_get_clientdata(client); + + if (get_coefficient(dev, &m, &b, &R) < 0) { + return sprintf(buf, "ERROR, fail to get coefficient\n"); + } + + // [ bytecount, energy_count-l, energy_count-h, ROLLOVER_count , + // sample_count-l, sample_count-mid, sample_count-h ] + // maximum_direct_format_value = (m*32767+b)*(10)^R + // energy_value = Rollover_count * maximum_direct_format_value + energy_count + + debug_print((KERN_DEBUG "[ec-l,ec-h,rc,sc-l,sc-,sc-h]: [0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x]\n", buf_block[0], buf_block[1], buf_block[2], + buf_block[3], buf_block[4], buf_block[5], buf_block[6])); + + ev = rc * (m*32767+b)*easy_pow(10,R) + ((ev<<8) + buf_block[1]); + sc = (sc<<16) + (sc_mid<<8) + buf_block[4]; + + if(attr->index == PSU_EIN) { + average_value = ((ev - data->last_energy_value_EIN)*1000) / (sc - data->last_smaple_count_EIN); + data->last_energy_value_EIN = ev; + data->last_smaple_count_EIN = sc; + } else { + average_value = ((ev - data->last_energy_value_EOUT)*1000) / (sc - data->last_smaple_count_EOUT); + data->last_energy_value_EOUT = ev; + data->last_smaple_count_EOUT = sc; + } + return sprintf(buf, "%llu.%llu\n", average_value/1000, average_value%1000); + + } + + case PSU_MFR_ID: + case PSU_MFR_MODEL: + debug_print((KERN_DEBUG "[0x%x,0x%x,0x%x,0x%x,0x%x,0x%x]\n", buf_block[0], buf_block[1], buf_block[2], + buf_block[3], buf_block[4], buf_block[5])); + + ascii = &buf_block[1]; + return sprintf(buf, "%s\n", ascii); + + + case PSU_PMBUS_REVISION: + return sprintf(buf, "Part1 Revision: 1.%d, Part2 Revision: 1.%d\n", + (ret>>5), (ret&0x7) ); + + /* not implement yet */ + default: + return sprintf(buf, "not implement yet\n"); + + } + + /* should not goto here */ + return sprintf(buf, "unknown case\n"); + +} + + +static ssize_t show_capability(struct device *dev, struct device_attribute *da, char *buf) +{ + /* todo */ + return sprintf(buf, "not implement yet\n"); +} + +static ssize_t psu_pm_query(struct device *dev, struct device_attribute *da, char *buf) +{ + /* todo */ + return sprintf(buf, "not implement yet\n"); +} + +static ssize_t psu_coefficient(struct device *dev, struct device_attribute *da, char *buf) +{ + /* todo */ + return sprintf(buf, "not implement yet\n"); +} + +static ssize_t set_fan_config(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct zrh2800k2_data *data = i2c_get_clientdata(client); + + int result; + u8 input_val; + + mutex_lock(&data->update_lock); + + input_val = simple_strtol(buf, NULL, 10); + + result = i2c_smbus_write_byte_data(client, REG_FAN_CONFIG_1_2, input_val); + + mutex_unlock(&data->update_lock); + + if (result < 0) { + printk(KERN_ALERT "ERROR: SET_FAN_CONFIG %s fail\n", buf); + } else { + debug_print((KERN_DEBUG "SET_FAN_CONFIG %s success\n", buf)); + } + + + return count; + +} + + +static const struct i2c_device_id zrh2800k2_id[] = { + { "zrh2800k2", 0 }, + {} +}; + +static struct i2c_driver zrh2800k2_driver = { + .class = I2C_CLASS_HWMON, + .driver = + { + .name = "ZRH2800K2", + }, + .probe = zrh2800k2_probe, + .remove = zrh2800k2_remove, + .id_table = zrh2800k2_id, + .address_list = normal_i2c, +}; + +static int zrh2800k2_remove(struct i2c_client *client) +{ + struct zrh2800k2_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &zrh2800k2_group); + kfree(data); + return 0; + +} + +static int zrh2800k2_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + + struct zrh2800k2_data *data; + int status; + + if(!i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_BYTE_DATA | + I2C_FUNC_SMBUS_WORD_DATA)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct zrh2800k2_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &zrh2800k2_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: psu '%s'\n", dev_name(data->hwmon_dev), + client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &zrh2800k2_group); + +exit_free: + kfree(data); + +exit: + return status; + +} + + +module_i2c_driver(zrh2800k2_driver); +MODULE_AUTHOR("Cameo Inc."); +MODULE_DESCRIPTION("Power Supply zrh-2800k2 driver"); +MODULE_LICENSE("GPL"); + diff --git a/platform/innovium/sonic-platform-modules-cameo/esc601-32q/scripts/sensors b/platform/innovium/sonic-platform-modules-cameo/esc601-32q/scripts/sensors new file mode 100755 index 0000000000..21112ed863 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc601-32q/scripts/sensors @@ -0,0 +1,8 @@ +#!/bin/bash +docker exec -i pmon sensors "$@" + +#To probe sensors not part of lm-sensors +if [ -r /usr/local/bin/cameo_esc601_sensors.py ]; then + python /usr/local/bin/cameo_esc601_sensors.py fan_status + python /usr/local/bin/cameo_esc601_sensors.py sensor_status +fi diff --git a/platform/innovium/sonic-platform-modules-cameo/esc601-32q/service/esc601-platform-init.service b/platform/innovium/sonic-platform-modules-cameo/esc601-32q/service/esc601-platform-init.service new file mode 100644 index 0000000000..583cdd7438 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc601-32q/service/esc601-platform-init.service @@ -0,0 +1,14 @@ +[Unit] +Description=Cameo Esc601-32q Platform initialization service +After=local-fs.target innovium_platform_driver.service +Before=pmon.service + + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/cameo_esc601_startup start +ExecStop=/usr/local/bin/cameo_esc601_startup stop +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/platform/innovium/sonic-platform-modules-cameo/esc601-32q/templates/cameo_esc601_util.py.j2 b/platform/innovium/sonic-platform-modules-cameo/esc601-32q/templates/cameo_esc601_util.py.j2 new file mode 100644 index 0000000000..29656a7df7 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc601-32q/templates/cameo_esc601_util.py.j2 @@ -0,0 +1,775 @@ +#!/usr/bin/env python +# +# Copyright (C) 2019 Cameo Networks, Inc. + + +""" +Usage: %(scriptName)s [options] command object + +options: + -h | --help : this help message + -d | --debug : run with debug mode + -f | --force : ignore error during installation or clean +command: + install : install drivers and generate related sysfs nodes + clean : uninstall drivers and remove related sysfs nodes + show : show all systen status + sff : dump SFP eeprom + set : change board setting with fan|led|sfp +""" + +import os +import commands +import sys, getopt +import logging +import re +import time +import json + +PROJECT_NAME = 'esc601_32q' +verbose = False +DEBUG = False +FORCE = 0 + +PLATFORM_DRIVER_VER = {{ env("PLATFORM_DRIVER_VER") }} + +PLATFORM_INSTALL_INFO_FILE="/etc/sonic/platform_install.json" + +# default is 'i2c-0', we will choose the correct one from 'i2c-0' and 'i2c-1'. +DEFAULT_BASE_BUS = 'i2c-0' +BASE_BUS = 'i2c-0' + +I2C_BASE_BUS = { + 'i2c-0':{ + 'path':'/sys/bus/i2c/devices/i2c-0', + 'status':'INSTALLED' + }, + 'i2c-1':{ + 'path':'/sys/bus/i2c/devices/i2c-1', + 'status':'INSTALLED' + } +} + +switch_install_order = [ +'PCA9548_0x73', +'PCA9548_0x74_1', +'PCA9548_0x74_2', +'PCA9548_0x74_3', +'PCA9548_0x74_4', +'PCA9548_0x77' +] + +I2C_SWITCH_LIST = { + # i2c switches + 'PCA9548_0x73': { + 'parent':'base', + 'driver':'pca9548', + 'i2caddr': '0x73', + 'path': ' ', + 'bus_map': [0,0,0,0,0,0,0,0], + 'status':'NOTINST' + }, + 'PCA9548_0x77': { + 'parent':'base', + 'driver':'pca9548', + 'i2caddr': '0x77', + 'path': ' ', + 'bus_map': [0,0,0,0,0,0,0,0], + 'status':'NOTINST' + }, + 'PCA9548_0x74_1': { + 'parent':'PCA9548_0x73', + 'parent_ch': 4, + 'driver':'pca9548', + 'i2caddr': '0x74', + 'path': ' ', + 'bus_map': [0,0,0,0,0,0,0,0], + 'status':'NOTINST' + }, + 'PCA9548_0x74_2': { + 'parent':'PCA9548_0x73', + 'parent_ch': 5, + 'driver':'pca9548', + 'i2caddr': '0x74', + 'path': ' ', + 'bus_map': [0,0,0,0,0,0,0,0], + 'status':'NOTINST' + }, + 'PCA9548_0x74_3': { + 'parent':'PCA9548_0x73', + 'parent_ch': 6, + 'driver':'pca9548', + 'i2caddr': '0x74', + 'path': ' ', + 'bus_map': [0,0,0,0,0,0,0,0], + 'status':'NOTINST' + }, + 'PCA9548_0x74_4': { + 'parent':'PCA9548_0x73', + 'parent_ch': 7, + 'driver':'pca9548', + 'i2caddr': '0x74', + 'path': ' ', + 'bus_map': [0,0,0,0,0,0,0,0], + 'status':'NOTINST' + } +} + +I2C_DEVICES = { + # sys eeprom + 'SYS_EEPROM': { + 'parent':'base', + 'driver':'24c64smbus', + 'i2caddr': '0x56', + 'path': ' ', + 'status':'NOTINST' + }, + # NCT7511Y sensor & fan control + 'NCT7511Y(U73)': { + 'parent':'PCA9548_0x77', + 'parent_ch': 0, + 'driver':'nct7511', + 'i2caddr': '0x2e', + 'path': ' ', + 'status':'NOTINST' + }, + # G781 sensors + 'G781(U94)': { + 'parent':'PCA9548_0x77', + 'parent_ch': 1, + 'driver':'g781', + 'i2caddr': '0x4c', + 'path': ' ', + 'status':'NOTINST' + }, + 'G781(U4)': { + 'parent':'PCA9548_0x77', + 'parent_ch': 2, + 'driver':'g781', + 'i2caddr': '0x4c', + 'path': ' ', + 'status':'NOTINST' + }, + 'G781(U34)': { + 'parent':'PCA9548_0x77', + 'parent_ch': 3, + 'driver':'g781', + 'i2caddr': '0x4c', + 'path': ' ', + 'status':'NOTINST' + }, + # PSU + 'PSU1': { + 'parent':'PCA9548_0x77', + 'parent_ch': 4, + 'driver':'zrh2800k2', + 'i2caddr': '0x58', + 'path': ' ', + 'status':'NOTINST' + }, + 'PSU2': { + 'parent':'PCA9548_0x77', + 'parent_ch': 4, + 'driver':'zrh2800k2', + 'i2caddr': '0x59', + 'path': ' ', + 'status':'NOTINST' + }, + 'TPS53681(0x6C)': { + 'parent':'PCA9548_0x77', + 'parent_ch': 5, + 'driver':'tps53679', + 'i2caddr': '0x6c', + 'path': ' ', + 'status':'NOTINST' + }, + 'TPS53681(0x6E)': { + 'parent':'PCA9548_0x77', + 'parent_ch': 5, + 'driver':'tps53679', + 'i2caddr': '0x6e', + 'path': ' ', + 'status':'NOTINST' + }, + 'TPS53681(0x70)': { + 'parent':'PCA9548_0x77', + 'parent_ch': 5, + 'driver':'tps53679', + 'i2caddr': '0x70', + 'path': ' ', + 'status':'NOTINST' + }, + # mcp3425 adc + 'MCP3425': { + 'parent':'PCA9548_0x77', + 'parent_ch': 6, + 'driver':'mcp3425_smbus', + 'i2caddr': '0x68', + 'path': ' ', + 'status':'NOTINST' + } +} + +SFP_GROUPS = { + 'SFP-G01' :{ + 'number': 8, + 'parent':'PCA9548_0x74_1', + 'channels':[0,1,2,3,4,5,6,7], + 'driver':'optoe1', + 'i2caddr': '0x50', + 'paths': [], + 'status':'NOTINST' + }, + 'SFP-G02' :{ + 'number': 8, + 'parent':'PCA9548_0x74_2', + 'channels':[0,1,2,3,4,5,6,7], + 'driver':'optoe1', + 'i2caddr': '0x50', + 'paths': [], + 'status':'NOTINST' + }, + 'SFP-G03' :{ + 'number': 8, + 'parent':'PCA9548_0x74_3', + 'channels':[0,1,2,3,4,5,6,7], + 'driver':'optoe1', + 'i2caddr': '0x50', + 'paths': [], + 'status':'NOTINST' + }, + 'SFP-G04' :{ + 'number': 8, + 'parent':'PCA9548_0x74_4', + 'channels':[0,1,2,3,4,5,6,7], + 'driver':'optoe1', + 'i2caddr': '0x50', + 'paths': [], + 'status':'NOTINST' + } +} + + + +if DEBUG == True: + print sys.argv[0] + print 'ARGV :', sys.argv[1:] + + +def main(): + global DEBUG + global args + global FORCE + + if len(sys.argv) < 2: + show_help() + + options, args = getopt.getopt(sys.argv[1:], 'hdf', ['help', + 'debug', + 'force', + ]) + if DEBUG == True: + print options + print args + print len(sys.argv) + + for opt, arg in options: + if opt in ('-h', '--help'): + show_help() + elif opt in ('-d', '--debug'): + DEBUG = True + logging.basicConfig(level=logging.INFO) + elif opt in ('-f', '--force'): + FORCE = 1 + else: + logging.info('no option') + for arg in args: + if arg == 'install': + do_install() + elif arg == 'clean': + do_uninstall() + elif arg == 'show': + devices_info() + elif arg == 'version': + show_version() + else: + show_help() + + return 0 + +def show_version(): + print("platform driver version: {}\n".format(PLATFORM_DRIVER_VER)) + +def show_help(): + print __doc__ % {'scriptName': sys.argv[0].split("/")[-1]} + sys.exit(0) + + +def show_set_help(): + cmd = sys.argv[0].split("/")[-1] + " " + args[0] + print cmd + " [led|sfp|fan]" + print " use \"" + cmd + " led 0-4 \" to set led color" + print " use \"" + cmd + " fan 0-100\" to set fan duty percetage" + print " use \"" + cmd + " sfp 1-54 {0|1}\" to set sfp# tx_disable" + sys.exit(0) + +def log_os_system(cmd, show): + logging.info('Run :' + cmd) + status, output = commands.getstatusoutput(cmd) + logging.info(cmd + "with result:" + str(status)) + logging.info(" output:" + output) + if status: + logging.info('Failed :' + cmd) + if show: + print('Failed ({}):'.format(status) + cmd) + return status, output + + +def driver_check(): + ret, lsmod = log_os_system("lsmod| grep cameo", 0) + logging.info('mods:' + lsmod) + if len(lsmod) == 0: + return False + return True + + +kos = [ + 'depmod -a', + 'modprobe i2c_dev', + 'modprobe x86-64-cameo-esc601-32q', + 'modprobe nct7511', + 'modprobe mcp3425_smbus', + 'modprobe at24_smbus', + 'modprobe at24', + 'modprobe zrh2800k2', + 'modprobe tps53679' +] + + +def driver_install(): + global FORCE + for i in range(0, len(kos)): + status, output = log_os_system(kos[i], 1) + if status: + if FORCE == 0: + return status + return 0 + + +def driver_uninstall(): + global FORCE + for i in range(0, len(kos)): + rm = kos[-(i + 1)].replace("modprobe", "modprobe -rq") + rm = rm.replace("insmod", "rmmod") + status, output = log_os_system(rm, 1) + if status: + if FORCE == 0: + return status + return 0 + +def check_base_bus(): + global I2C_SWITCH_LIST + global I2C_DEVICES + global SFP_GROUPS + global BASE_BUS + # we start check with the first i2c switch to install which on base bus + switch = I2C_SWITCH_LIST[switch_install_order[0]] + for bbus in I2C_BASE_BUS.keys(): + install_path = I2C_BASE_BUS[bbus]['path'] + cmd = "echo {} {} > {}/new_device".format(switch['driver'], switch['i2caddr'], install_path) + log_os_system(cmd, 1) + time.sleep(1) + cmd = "ls /sys/bus/i2c/devices/{}-00{}/channel-0".format(bbus[-1],switch['i2caddr'][-2:]) + result = log_os_system(cmd, 1)[0] + #uninstall + cmd = "echo {} > {}/delete_device".format(switch['i2caddr'], install_path) + log_os_system(cmd, 1) + if result == 0: + BASE_BUS = bbus + break + + logging.info('Base bus is {}'.format(BASE_BUS)) + + #exchange all base bus + for dev_name in I2C_SWITCH_LIST.keys(): + if I2C_SWITCH_LIST[dev_name]['parent'] == 'base': + I2C_SWITCH_LIST[dev_name]['parent'] = BASE_BUS + for dev_name in I2C_DEVICES.keys(): + if I2C_DEVICES[dev_name]['parent'] == 'base': + I2C_DEVICES[dev_name]['parent'] = BASE_BUS + for dev_name in SFP_GROUPS.keys(): + if SFP_GROUPS[dev_name]['parent'] == 'base': + SFP_GROUPS[dev_name]['parent'] = BASE_BUS + + +def get_next_bus_num(): + num_list = [] + device_list = os.listdir("/sys/bus/i2c/devices") + for x in device_list: + t = re.match(r'i2c-(\d+)', x) + if t: + num_list.append(int(t.group(1))) + logging.info('next_bus_id is {}'.format(max(num_list)+1)) + return max(num_list)+1 + +def install_i2c_switch(): + + for switch_name in switch_install_order: + next_bus_id = get_next_bus_num() + switch = I2C_SWITCH_LIST[switch_name] + if switch['parent'] in I2C_BASE_BUS: + install_path = I2C_BASE_BUS[switch['parent']]['path'] + else: + install_path = I2C_SWITCH_LIST[switch['parent']]['path'] + + if 'parent_ch' in switch: + install_path = install_path+"/channel-{}".format(switch['parent_ch']) + if I2C_SWITCH_LIST[switch['parent']]['status'] != 'INSTALLED': + continue + + cmd = "echo {} {} > {}/new_device".format(switch['driver'], switch['i2caddr'], install_path) + status, output = log_os_system(cmd, 1) + if status != 0: + switch['status'] = 'FAILED' + continue + + if switch['parent'] in I2C_BASE_BUS: + switch['path'] = "/sys/bus/i2c/devices/{}-00{}".format(switch['parent'][-1],switch['i2caddr'][-2:]) + else: + switch['path'] = "/sys/bus/i2c/devices/{}-00{}".format(I2C_SWITCH_LIST[switch['parent']]['bus_map'][switch['parent_ch']],switch['i2caddr'][-2:]) + + # add delay to make sure the root switch for sfp is installed completely, + # so we can start the installation of next switch + if switch_name == 'PCA9548_0x73': + time.sleep(1) + + #Check if bus are actually created + for busid in range(next_bus_id,next_bus_id+8): + if not os.path.exists("/sys/bus/i2c/devices/i2c-{}".format(busid)): + print("Fail to create bus when install {}".format(switch_name)) + switch['status'] = 'FAILED' + break + else: + # exit loop normally; not breakout + switch['bus_map'] = list(range(next_bus_id,next_bus_id+8)) + switch['status'] = 'INSTALLED' + +def remove_install_status(): + if os.path.exists(PLATFORM_INSTALL_INFO_FILE): + os.remove(PLATFORM_INSTALL_INFO_FILE) + +def restore_install_status(): + output = [] + output.append(I2C_SWITCH_LIST) + output.append(I2C_DEVICES) + output.append(SFP_GROUPS) + jsondata = json.dumps(output) + with open(PLATFORM_INSTALL_INFO_FILE,'w') as fd: + fd.write(jsondata) + +def update_hwmon(): + for dev_name in I2C_DEVICES.keys(): + dev = I2C_DEVICES[dev_name] + if dev['status'] == 'INSTALLED': + if os.path.exists(dev['path']+'/hwmon'): + dev['hwmon_path'] = os.path.join(dev['path']+'/hwmon', os.listdir(dev['path']+'/hwmon')[0]) + + +def install_i2c_device(): + for dev_name in I2C_DEVICES.keys(): + dev = I2C_DEVICES[dev_name] + if dev['parent'] in I2C_BASE_BUS: + install_path = I2C_BASE_BUS[dev['parent']]['path'] + else: + install_path = I2C_SWITCH_LIST[dev['parent']]['path'] + + if 'parent_ch' in dev: + install_path = install_path+"/channel-{}".format(dev['parent_ch']) + if I2C_SWITCH_LIST[dev['parent']]['status'] != 'INSTALLED': + continue + + cmd = "echo {} {} > {}/new_device".format(dev['driver'], dev['i2caddr'], install_path) + status, output = log_os_system(cmd, 1) + if status != 0: + dev['status'] = 'FAILED' + continue + + if dev['parent'] in I2C_BASE_BUS: + dev['path'] = "/sys/bus/i2c/devices/{}-00{}".format(dev['parent'][-1],dev['i2caddr'][-2:]) + else: + dev['path'] = "/sys/bus/i2c/devices/{}-00{}".format(I2C_SWITCH_LIST[dev['parent']]['bus_map'][dev['parent_ch']],dev['i2caddr'][-2:]) + + dev['status'] = 'INSTALLED' + + +def install_sfp(): + for sfp_group_name in SFP_GROUPS.keys(): + sfp_group = SFP_GROUPS[sfp_group_name] + if sfp_group['parent'] in I2C_BASE_BUS: + install_path = I2C_BASE_BUS[sfp_group['parent']]['path'] + else: + install_path = I2C_SWITCH_LIST[sfp_group['parent']]['path'] + + # parent switch is not installed, skip this sfp group + if I2C_SWITCH_LIST[sfp_group['parent']]['status'] != 'INSTALLED': + sfp_group['paths'] = ['n/a']*sfp_group['number'] + continue + + for n in range(0,sfp_group['number']): + sfp_install_path = install_path+"/channel-{}".format(sfp_group['channels'][n]) + cmd = "echo {} {} > {}/new_device".format(sfp_group['driver'], sfp_group['i2caddr'], sfp_install_path) + status, output = log_os_system(cmd, 1) + if status != 0: + sfp_group['status'] = 'FAILED' + sfp_group['paths'].append("n/a") + continue + + if sfp_group['parent'] in I2C_BASE_BUS: + sfp_group['paths'].append("/sys/bus/i2c/devices/{}-00{}".format(sfp_group['parent'][-1],sfp_group['i2caddr'][-2:])) + else: + sfp_group['paths'].append("/sys/bus/i2c/devices/{}-00{}".format(I2C_SWITCH_LIST[sfp_group['parent']]['bus_map'][sfp_group['channels'][n]],sfp_group['i2caddr'][-2:])) + + # if all sfps in a group are success + if len(sfp_group['paths']) == sfp_group['number']: + sfp_group['status'] = "INSTALLED" + +def uninstall_sfp(): + for sfp_group_name in SFP_GROUPS.keys(): + sfp_group = SFP_GROUPS[sfp_group_name] + if sfp_group['parent'] in I2C_BASE_BUS: + uninst_path = I2C_BASE_BUS[sfp_group['parent']]['path'] + else: + uninst_path = I2C_SWITCH_LIST[sfp_group['parent']]['path'] + + # sfp is not installed, skip this sfp group + if sfp_group['status'] != 'INSTALLED': + continue + + for n in range(0,sfp_group['number']): + sfp_uninst_path = uninst_path+"/channel-{}".format(sfp_group['channels'][n]) + cmd = "echo {} > {}/delete_device".format(sfp_group['i2caddr'], sfp_uninst_path) + log_os_system(cmd, 1) + +def uninstall_i2c_device(): + for dev_name in I2C_DEVICES.keys(): + dev = I2C_DEVICES[dev_name] + if dev['parent'] in I2C_BASE_BUS: + uninst_path = I2C_BASE_BUS[dev['parent']]['path'] + else: + uninst_path = I2C_SWITCH_LIST[dev['parent']]['path'] + + # device is not installed, skip this device + if dev['status'] != 'INSTALLED': + continue + + if 'parent_ch' in dev: + uninst_path = uninst_path+"/channel-{}".format(dev['parent_ch']) + + cmd = "echo {} > {}/delete_device".format(dev['i2caddr'], uninst_path) + log_os_system(cmd, 1) + +def uninstall_i2c_switch(): + for switch_name in reversed(switch_install_order): + switch = I2C_SWITCH_LIST[switch_name] + if switch['parent'] in I2C_BASE_BUS: + uninst_path = I2C_BASE_BUS[switch['parent']]['path'] + else: + uninst_path = I2C_SWITCH_LIST[switch['parent']]['path'] + + # switch is not installed, skip this switch + if switch['status'] != 'INSTALLED': + continue + + if 'parent_ch' in switch: + uninst_path = uninst_path+"/channel-{}".format(switch['parent_ch']) + + cmd = "echo {} > {}/delete_device".format(switch['i2caddr'], uninst_path) + log_os_system(cmd, 1) + +def hw_adjustment(): + global SFP_GROUPS + global I2C_DEVICES + global switch_install_order + if bmc_is_exist(): + switch_install_order.remove('PCA9548_0x77') + for device_name in I2C_DEVICES.keys(): + device = I2C_DEVICES[device_name] + if device['parent'] == 'PCA9548_0x77': + device['status'] = 'viaBMC' + + if hwver_before_0x10(): + I2C_DEVICES['SYS_EEPROM']['driver'] = '24c04' + if not bmc_is_exist(): + I2C_DEVICES['TPS53681(0x6C)']['parent'] = 'PCA9548_0x73' + I2C_DEVICES['TPS53681(0x6C)']['parent_ch'] = 3 + I2C_DEVICES['TPS53681(0x6E)']['parent'] = 'PCA9548_0x73' + I2C_DEVICES['TPS53681(0x6E)']['parent_ch'] = 3 + I2C_DEVICES['TPS53681(0x70)']['parent'] = 'PCA9548_0x73' + I2C_DEVICES['TPS53681(0x70)']['parent_ch'] = 3 + +def set_led_control(): + cmd = "echo 1 > /sys/class/hwmon/hwmon2/device/ESC601_LED/led_ctrl" + status, output = log_os_system(cmd, 1) + if status: + print output + +def device_install(): + remove_install_status() + hw_adjustment() + check_base_bus() + set_led_control() + install_i2c_switch() + # add delay to make sure all switch is installed completely, + # so we can start install other slave device safely. + time.sleep(1) + install_i2c_device() + install_sfp() + update_hwmon() + restore_install_status() + return 0 + +def device_uninstall(): + global SFP_GROUPS + global I2C_DEVICES + global I2C_SWITCH_LIST + try: + with open(PLATFORM_INSTALL_INFO_FILE) as fd: + install_info = json.load(fd) + SFP_GROUPS = install_info[2] + I2C_DEVICES = install_info[1] + I2C_SWITCH_LIST = install_info[0] + uninstall_sfp() + uninstall_i2c_device() + uninstall_i2c_switch() + remove_install_status() + return 0 + + except IOError as e: + print(e) + print("Platform install information file is not exist, please do install first") + return 1 + +i2c_prefix = '/sys/bus/i2c/devices/' + +def get_attr_value(attr_path): + retval = 'ERR' + if not os.path.isfile(attr_path): + return retval + + try: + with open(attr_path, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", attr_path, " file !") + + retval = retval.rstrip('\r\n') + fd.close() + return retval + +def bmc_is_exist(): + value = '' + bmc_filePath = '/sys/class/hwmon/hwmon2/device/ESC601_BMC/bmc_present' + if os.path.exists(bmc_filePath): + value = get_attr_value(bmc_filePath) + if value.find('not') < 0: + return True + else: + return False + else: + return False + +def hwver_before_0x10(): + value = '' + filePath = '/sys/class/hwmon/hwmon2/device/ESC601_SYS/hw_version' + if os.path.exists(filePath): + value = get_attr_value(filePath) + if int(value[-4:],16) < 0x10: + return True + else: + return False + else: + return False + +def do_install(): + print "Checking system...." + if driver_check() == False: + print "No driver, installing...." + status = driver_install() + if status: + if FORCE == 0: + return status + else: + print PROJECT_NAME.upper() + " drivers detected...." + if not device_exist(): + print "No device, installing...." + status = device_install() + if status: + if FORCE == 0: + return status + else: + print PROJECT_NAME.upper() + " devices detected...." + return + + +def do_uninstall(): + print "Checking system...." + if not device_exist(): + print PROJECT_NAME.upper() + " has no device installed...." + else: + print "Removing device...." + status = device_uninstall() + if status: + + if FORCE == 0: + return status + + if driver_check() == False: + print PROJECT_NAME.upper() + " has no driver installed...." + else: + print "Removing installed driver...." + status = driver_uninstall() + if status: + if FORCE == 0: + return status + + return + +def devices_info(): + bus_list = [] + with open(PLATFORM_INSTALL_INFO_FILE) as fd: + install_info = json.load(fd) + for i in range(0,2): + for device_name in install_info[i].keys(): + device = install_info[i][device_name] + print("{} :".format(device_name)) + if device['parent'] in I2C_BASE_BUS: + print(" On Bus: {}".format(device['parent'])) + else: + print(" On Bus: i2c-{}".format(install_info[0][device['parent']]['bus_map'][device['parent_ch']])) + print(" i2c Address: {}".format(device['i2caddr'])) + print(" status: {}".format(device['status'])) + if device['status'] == 'INSTALLED': + print(" install path: {}".format(device['path'])) + if device.get('hwmon_path'): + print(" hwmon_path: {}".format(device['hwmon_path'])) + print(' ') + + for sfp_group_name in install_info[2].keys(): + bus_list = [] + sfp_group = install_info[2][sfp_group_name] + print("{} :".format(sfp_group_name)) + print(" sfp number: {}".format(sfp_group['number'])) + for n in range(0,sfp_group['number']): + bus_list.append("i2c-{}".format(install_info[0][sfp_group['parent']]['bus_map'][sfp_group['channels'][n]])) + print(" On Bus: {}".format(bus_list)) + print(" status: {}".format(sfp_group['status'])) + print(" install path: {}".format(', '.join(sfp_group['paths']))) + print(' ') + +def device_exist(): + ret1, log = log_os_system("ls " + i2c_prefix + "*0056", 0) + return not ret1 + + +if __name__ == "__main__": + main() diff --git a/platform/innovium/sonic-platform-modules-cameo/esc601-32q/utils/README b/platform/innovium/sonic-platform-modules-cameo/esc601-32q/utils/README new file mode 100755 index 0000000000..70b8653bc9 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc601-32q/utils/README @@ -0,0 +1,2 @@ +Copyright (C) 2019 Cameo Networks, Inc. + diff --git a/platform/innovium/sonic-platform-modules-cameo/esc601-32q/utils/cameo_esc601_platform.sh b/platform/innovium/sonic-platform-modules-cameo/esc601-32q/utils/cameo_esc601_platform.sh new file mode 100755 index 0000000000..732a1e3018 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc601-32q/utils/cameo_esc601_platform.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# Install esc601-32q python package +DEVICE="/usr/share/sonic/device" +PLATFORM=$(/usr/local/bin/sonic-cfggen -H -v DEVICE_METADATA.localhost.platform) + +if [ -e $DEVICE/$PLATFORM/sonic_platform-1.0-py2-none-any.whl ]; then + pip install $DEVICE/$PLATFORM/sonic_platform-1.0-py2-none-any.whl +fi + diff --git a/platform/innovium/sonic-platform-modules-cameo/esc601-32q/utils/cameo_esc601_sensors.py b/platform/innovium/sonic-platform-modules-cameo/esc601-32q/utils/cameo_esc601_sensors.py new file mode 100755 index 0000000000..2604b5fd8e --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc601-32q/utils/cameo_esc601_sensors.py @@ -0,0 +1,325 @@ +#!/usr/bin/python + +from __future__ import print_function +import os +import sys +import logging +import json + + +FAN_NUM = 5 +MAX_PSU_NUM = 2 +PSU_LIST = ['PSU1','PSU2'] #0x58, 0x59 + +PLATFORM_INSTALL_INFO_FILE = '/etc/sonic/platform_install.json' +BMC_SYSFILE_PATH = '/sys/class/hwmon/hwmon2/device/ESC601_BMC/' +FAN_SYSFILE_PATH = '/sys/class/hwmon/hwmon2/device/ESC601_FAN/' +PSU_SYSFILE_PATH = '/sys/class/hwmon/hwmon2/device/ESC601_PSU/' + +def get_mac_sensor_path(): + mac_sensor_path = [] + try: + with open(PLATFORM_INSTALL_INFO_FILE) as fd: + install_info = json.load(fd) + mac_sensor_path = install_info[1]['MCP3425']['path'] + except Exception: + print("Fail to get mac sensor sysfsfile path") + + return mac_sensor_path + +def get_psu_path(): + """ + get psu path when without BMC control + """ + psu_path = [] + try: + with open(PLATFORM_INSTALL_INFO_FILE) as fd: + install_info = json.load(fd) + for psu_name in PSU_LIST: + psu = install_info[1][psu_name] + psu_path.append(psu['path']+'/') + return psu_path + except Exception: + print("Fail to get psu sysfsfile path") + + return psu_path + +# Get sysfs attribute +def get_attr_value(attr_path): + retval = 'ERR' + if not os.path.isfile(attr_path): + return retval + + try: + with open(attr_path, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", attr_path, " file !") + + retval = retval.rstrip('\r\n') + fd.close() + return retval + +def bmc_is_exist(): + value = '' + bmc_filePath = BMC_SYSFILE_PATH+'bmc_present' + if os.path.exists(bmc_filePath): + value = get_attr_value(bmc_filePath) + if value.find('not') < 0: + return True + else: + return False + else: + return False + +def is_fan_speed_supported(): + value = '' + filePath = '/sys/class/hwmon/hwmon2/device/ESC601_SYS/cpld4_version' + if os.path.exists(filePath): + value = get_attr_value(filePath) + if value == 'ERR': + return False + if int(value,16) >= 0x02: + return True + + return False + +def calc_mac_temp(): + value = '' + try: + if bmc_is_exist(): + value = get_attr_value(BMC_SYSFILE_PATH+'bmc_mac_sensor') + mac_sensor= int(value,16)/1000.0 + else: + path = get_mac_sensor_path() + raw = get_attr_value(path+'/iio:device0/in_voltage0_raw') + scale = get_attr_value(path+'/iio:device0/in_voltage0_scale') + mac_sensor= int(raw,10)*float(scale) + except Exception: + return 'N/A' + + temp1 = -124.28 * mac_sensor * mac_sensor + temp2 = -422.03 * mac_sensor + temp_sensor = 384.62 + temp1 + temp2 + return "%.2f" %(round(temp_sensor,2)) + +def print_attr_value_lines(sys_path): + retval = 'ERR' + if not os.path.isfile(sys_path): + return retval + try: + fo = open(sys_path, "r") + except Exception as error: + logging.error("Unable to open ", sys_path, " file !") + for line in fo.readlines(): + line = line.strip() + print (" %s" % line) + fo.close() + return retval + +def get_fan_alert(number): + return + +def get_fan_inner_rpm(number): + return + +def get_fan_outer_rpm(number): + return + +def sensors_status(): + if not bmc_is_exist(): + return + sys_path = BMC_SYSFILE_PATH + 'bmc_sersor_1' + print_attr_value_lines(sys_path) + sys_path = BMC_SYSFILE_PATH + 'bmc_sersor_2' + print_attr_value_lines(sys_path) + sys_path = BMC_SYSFILE_PATH + 'bmc_sersor_3' + print_attr_value_lines(sys_path) + sys_path = BMC_SYSFILE_PATH + 'bmc_sersor_4' + print_attr_value_lines(sys_path) + return + +def mac_sensors_temp(): + print ('MAC SENSORS TEMP: %s degrees (C)\n'% calc_mac_temp()) + return + +def get_voltage(): + return + +def fan_status(): + sys_path = FAN_SYSFILE_PATH + 'fan_status' + print ('FAN STATUS:') + print_attr_value_lines(sys_path) + return + +def fan_present(): + sys_path = FAN_SYSFILE_PATH + 'fan_present' + print ('FAN PRESENT:') + print_attr_value_lines(sys_path) + return + +def fan_power(): + sys_path = FAN_SYSFILE_PATH + 'fan_power' + print ('FAN POWER:') + print_attr_value_lines(sys_path) + return + +def fan_speed(): + sys_path = FAN_SYSFILE_PATH + 'fan_speed_rpm' + print ('FAN SPEED:') + print_attr_value_lines(sys_path) + return + +def is_psu_present(psu_number): + sys_path = PSU_SYSFILE_PATH + 'psu_present' + search_str = "PSU {} is present".format(psu_number) + if os.path.exists(sys_path): + value = get_attr_value(sys_path) + if search_str in value: + return True + else: + return False + + return False + +def show_psu_status(path): + # [model, vin, vout, fan_speed, temperature, pin, pout, iin, iout, max_iout] + output_format = [ + (' model: ', '{}', '\n'), + (' Input Voltage: ', '{:+3.2f} V' , '\n'), + (' Output Voltage: ', '{:+3.2f} V' , '\n'), + (' Fan Speed: ', '{:3d} RPM' , '\n'), + (' Temperature ', '{:+3.1f} C' , '\n'), + (' Input Power: ', '{:3.2f} W' , '\n'), + (' Output Power: ', '{:3.2f} W' , '\n'), + (' Input Current: ', '{:+3.2f} A' , '\n'), + (' Output Current: ', '{:+3.2f} A' , ' '), + ('(max = ' , '{:+3.2f} A)', '\n') + ] + + result_list = [0]*10 + if bmc_is_exist(): + try: + reg_file = open(path, 'r') + except IOError as e: + print( "Error: unable to open file: %s" % str(e)) + return False + + text_lines = reg_file.readlines() + reg_file.close() + + for line in text_lines: + spline = line.split(' ') + if "MFR_MODEL" in spline: + result_list[0] = spline[-1] + if "VIN" in spline: + result_list[1] = spline[-1] + if "VOUT" in spline: + result_list[2] = spline[-1] + if "FAN_SPEED" in spline: + result_list[3] = spline[-1] + if "TEMP_1" in spline: + result_list[4] = spline[-1] + if "PIN" in spline: + result_list[5] = spline[-1] + if "POUT" in spline: + result_list[6] = spline[-1] + if "IIN" in spline: + result_list[7] = spline[-1] + if "IOUT" in spline: + result_list[8] = spline[-1] + if "MFR_IOUT_MAX" in spline: + result_list[9] = spline[-1] + + else: + result_list[0] = get_attr_value(path+"psu_mfr_model") + result_list[1] = get_attr_value(path+"psu_vin") + result_list[2] = get_attr_value(path+"psu_vout") + result_list[3] = get_attr_value(path+"psu_fan_speed_1") + result_list[4] = get_attr_value(path+"psu_temp_1") + result_list[5] = get_attr_value(path+"psu_pin") + result_list[6] = get_attr_value(path+"psu_pout") + result_list[7] = get_attr_value(path+"psu_iin") + result_list[8] = get_attr_value(path+"psu_iout") + result_list[9] = get_attr_value(path+"psu_iout_max") + + if result_list[1] != 'ERR': + result_list[1] = int(result_list[1])/1000.0 + + if result_list[2] != 'ERR': + result_list[2] = int(result_list[2])/1000.0 + + if result_list[3] != 'ERR': + result_list[3] = int(result_list[3]) + + if result_list[4] != 'ERR': + result_list[4] = int(result_list[4])/1000.0 + + if result_list[5] != 'ERR': + result_list[5] = int(result_list[5])/1000000.0 + + if result_list[6] != 'ERR': + result_list[6] = int(result_list[6])/1000000.0 + + if result_list[7] != 'ERR': + result_list[7] = int(result_list[7])/1000.0 + + if result_list[8] != 'ERR': + result_list[8] = int(result_list[8])/1000.0 + + if result_list[9] != 'ERR': + result_list[9] = int(result_list[9])/1000.0 + + for i in range(len(output_format)): + print(output_format[i][0], end='') + if result_list[i] != 'ERR': + print(output_format[i][1].format(result_list[i]), end=output_format[i][2]) + else: + print('error') + + print('') + return + + +def psu_status(): + + for x in range(0,MAX_PSU_NUM): + if is_psu_present(x+1): + print("PSU{} present".format(x+1)) + if bmc_is_exist(): + show_psu_status(PSU_SYSFILE_PATH + 'psu_module_{}'.format(x+1)) + else: + psu_path = get_psu_path() + show_psu_status(psu_path[x]) + + return + + +def main(): + """ + Usage: %(scriptName)s command object + + command: + fan_status : display fans status(present/power good) + """ + + if len(sys.argv)<2: + print (main.__doc__) + + for arg in sys.argv[1:]: + if arg == 'fan_status': + fan_status() + fan_present() + fan_power() + if is_fan_speed_supported(): + fan_speed() + elif arg == 'sensor_status': + sensors_status() + mac_sensors_temp() + psu_status() + + else: + print (main.__doc__) + +if __name__ == "__main__": + main() diff --git a/platform/innovium/sonic-platform-modules-cameo/esc601-32q/utils/cameo_esc601_startup b/platform/innovium/sonic-platform-modules-cameo/esc601-32q/utils/cameo_esc601_startup new file mode 100755 index 0000000000..ebae880957 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc601-32q/utils/cameo_esc601_startup @@ -0,0 +1,17 @@ +#!/bin/bash + + +start() { + # load platform driver, native drivers + /usr/local/bin/cameo_esc601_util.py install +} + +stop() { + /usr/local/bin/cameo_esc601_util.py clean +} + + +case $1 in + start|stop) "$1" ;; +esac + diff --git a/platform/innovium/sonic-platform-modules-cameo/esc601-32q/utils/halt b/platform/innovium/sonic-platform-modules-cameo/esc601-32q/utils/halt new file mode 100755 index 0000000000..f8472e29ce --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc601-32q/utils/halt @@ -0,0 +1,18 @@ +#!/bin/sh + +mr_reboot() { + + sudo rmmod x86-64-cameo-esc601-32q + sudo i2cset -y 0 0x30 0xa4 0 + +} + +if [ $# -eq 0 ] || [ $@ = "--halt" ] || [ $@ = "-f" ] || [ $@ = "--force" ]; then + sudo /sbin/halt +elif [ $@ = "-p" ] || [ $@ = "--reboot" ] || [ $@ = "--poweroff" ]; then + sync;sync + mr_reboot +else + echo "unsupported option" +fi + diff --git a/platform/innovium/sonic-platform-modules-cameo/esc601-32q/utils/poweroff b/platform/innovium/sonic-platform-modules-cameo/esc601-32q/utils/poweroff new file mode 100755 index 0000000000..5675fc491a --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc601-32q/utils/poweroff @@ -0,0 +1,18 @@ +#!/bin/sh + +mr_reboot() { + + sudo rmmod x86-64-cameo-esc601-32q + sudo i2cset -y 0 0x30 0xa4 0 + +} + +if [ $# -eq 0 ] || [ $@ = "-p" ] || [ $@ = "--reboot" ] || [ $@ = "--poweroff" ] || [ $@ = "-f" ] || [ $@ = "--force" ]; then + sync;sync + mr_reboot +elif [ $@ = "--halt" ]; then + sudo halt +else + echo "unsupported option" +fi + diff --git a/platform/innovium/sonic-platform-modules-cameo/esc601-32q/utils/shutdown b/platform/innovium/sonic-platform-modules-cameo/esc601-32q/utils/shutdown new file mode 100755 index 0000000000..1a9cdd7506 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc601-32q/utils/shutdown @@ -0,0 +1,18 @@ +#!/bin/sh + +mr_reboot() { + + sudo rmmod x86-64-cameo-esc601-32q + sudo i2cset -y 0 0x30 0xa4 0 + +} + +if [ $# -eq 0 ] || [ $@ = "-r" ] || [ $@ = "--reboot" ] || [ $@ = "-h" ] || [ $@ = "-P" ] || [ $@ = "--poweroff" ]; then + sync;sync + mr_reboot +elif [ $@ = "-H" ] || [ $@ = "--halt" ]; then + sudo halt +else + echo "unsupported option" +fi + diff --git a/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/Makefile b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/Makefile new file mode 100644 index 0000000000..a33c748182 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/Makefile @@ -0,0 +1,5 @@ +obj-m := nct7511.o at24_smbus.o zrh2800k2.o +obj-m += x86-64-cameo-esc602-32q.o +x86-64-cameo-esc602-32q-objs := x86-64-cameo-esc602-32q-common.o x86-64-cameo-esc602-32q-sys.o \ +x86-64-cameo-esc602-32q-led.o x86-64-cameo-esc602-32q-fan.o x86-64-cameo-esc602-32q-power.o \ +x86-64-cameo-esc602-32q-thermal.o x86-64-cameo-esc602-32q-qsfp.o \ No newline at end of file diff --git a/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/at24_smbus.c b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/at24_smbus.c new file mode 100644 index 0000000000..16d6594746 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/at24_smbus.c @@ -0,0 +1,847 @@ +/* + * at24.c - handle most I2C EEPROMs + * + * Copyright (C) 2005-2007 David Brownell + * Copyright (C) 2008 Wolfram Sang, Pengutronix + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * I2C EEPROMs from most vendors are inexpensive and mostly interchangeable. + * Differences between different vendor product lines (like Atmel AT24C or + * MicroChip 24LC, etc) won't much matter for typical read/write access. + * There are also I2C RAM chips, likewise interchangeable. One example + * would be the PCF8570, which acts like a 24c02 EEPROM (256 bytes). + * + * However, misconfiguration can lose data. "Set 16-bit memory address" + * to a part with 8-bit addressing will overwrite data. Writing with too + * big a page size also loses data. And it's not safe to assume that the + * conventional addresses 0x50..0x57 only hold eeproms; a PCF8563 RTC + * uses 0x51, for just one example. + * + * Accordingly, explicit board-specific configuration data should be used + * in almost all cases. (One partial exception is an SMBus used to access + * "SPD" data for DRAM sticks. Those only use 24c02 EEPROMs.) + * + * So this driver uses "new style" I2C driver binding, expecting to be + * told what devices exist. That may be in arch/X/mach-Y/board-Z.c or + * similar kernel-resident tables; or, configuration data coming from + * a bootloader. + * + * Other than binding model, current differences from "eeprom" driver are + * that this one handles write access and isn't restricted to 24c02 devices. + * It also handles larger devices (32 kbit and up) with two-byte addresses, + * which won't work on pure SMBus systems. + */ + +struct at24_data { + struct at24_platform_data chip; + int use_smbus; + int use_smbus_write; + + ssize_t (*read_func)(struct at24_data *, char *, unsigned int, size_t); + ssize_t (*write_func)(struct at24_data *, + const char *, unsigned int, size_t); + + /* + * Lock protects against activities from other Linux tasks, + * but not from changes by other I2C masters. + */ + struct mutex lock; + + u8 *writebuf; + unsigned write_max; + unsigned num_addresses; + + struct nvmem_config nvmem_config; + struct nvmem_device *nvmem; + + /* + * Some chips tie up multiple I2C addresses; dummy devices reserve + * them for us, and we'll use them with SMBus calls. + */ + struct i2c_client *client[]; +}; + +/* + * This parameter is to help this driver avoid blocking other drivers out + * of I2C for potentially troublesome amounts of time. With a 100 kHz I2C + * clock, one 256 byte read takes about 1/43 second which is excessive; + * but the 1/170 second it takes at 400 kHz may be quite reasonable; and + * at 1 MHz (Fm+) a 1/430 second delay could easily be invisible. + * + * This value is forced to be a power of two so that writes align on pages. + */ +static unsigned io_limit = 128; +module_param(io_limit, uint, 0); +MODULE_PARM_DESC(io_limit, "Maximum bytes per I/O (default 128)"); + +/* + * Specs often allow 5 msec for a page write, sometimes 20 msec; + * it's important to recover from write timeouts. + */ +static unsigned write_timeout = 25; +module_param(write_timeout, uint, 0); +MODULE_PARM_DESC(write_timeout, "Time (in ms) to try writes (default 25)"); + +#define AT24_SIZE_BYTELEN 5 +#define AT24_SIZE_FLAGS 8 + +#define AT24_BITMASK(x) (BIT(x) - 1) + +/* create non-zero magic value for given eeprom parameters */ +#define AT24_DEVICE_MAGIC(_len, _flags) \ + ((1 << AT24_SIZE_FLAGS | (_flags)) \ + << AT24_SIZE_BYTELEN | ilog2(_len)) + +/* + * Both reads and writes fail if the previous write didn't complete yet. This + * macro loops a few times waiting at least long enough for one entire page + * write to work while making sure that at least one iteration is run before + * checking the break condition. + * + * It takes two parameters: a variable in which the future timeout in jiffies + * will be stored and a temporary variable holding the time of the last + * iteration of processing the request. Both should be unsigned integers + * holding at least 32 bits. + */ +#define loop_until_timeout(tout, op_time) \ + for (tout = jiffies + msecs_to_jiffies(write_timeout), op_time = 0; \ + op_time ? time_before(op_time, tout) : true; \ + usleep_range(1000, 1500), op_time = jiffies) + +static const struct i2c_device_id at24_ids[] = { + { "24c64smbus", AT24_DEVICE_MAGIC(65536 / 8, AT24_FLAG_ADDR16) }, + { /* END OF LIST */ } +}; +MODULE_DEVICE_TABLE(i2c, at24_ids); + +static const struct acpi_device_id at24_acpi_ids[] = { + { "INT3499", AT24_DEVICE_MAGIC(8192 / 8, 0) }, + { } +}; +MODULE_DEVICE_TABLE(acpi, at24_acpi_ids); + +/*-------------------------------------------------------------------------*/ + +/* + * This routine supports chips which consume multiple I2C addresses. It + * computes the addressing information to be used for a given r/w request. + * Assumes that sanity checks for offset happened at sysfs-layer. + * + * Slave address and byte offset derive from the offset. Always + * set the byte address; on a multi-master board, another master + * may have changed the chip's "current" address pointer. + * + * REVISIT some multi-address chips don't rollover page reads to + * the next slave address, so we may need to truncate the count. + * Those chips might need another quirk flag. + * + * If the real hardware used four adjacent 24c02 chips and that + * were misconfigured as one 24c08, that would be a similar effect: + * one "eeprom" file not four, but larger reads would fail when + * they crossed certain pages. + */ +static struct i2c_client *at24_translate_offset(struct at24_data *at24, + unsigned int *offset) +{ + unsigned i; + + if (at24->chip.flags & AT24_FLAG_ADDR16) { + i = *offset >> 16; + *offset &= 0xffff; + } else { + i = *offset >> 8; + *offset &= 0xff; + } + + return at24->client[i]; +} + +static ssize_t at24_eeprom_read_smbus(struct at24_data *at24, char *buf, + unsigned int offset, size_t count) +{ + unsigned long timeout, read_time; + struct i2c_client *client; + int status,i,j; + + client = at24_translate_offset(at24, &offset); + + if (count > io_limit) + count = io_limit; + /* Smaller eeproms can work given some SMBus extension calls */ + if (count > I2C_SMBUS_BLOCK_MAX) + count = I2C_SMBUS_BLOCK_MAX; + + if(at24->chip.flags & AT24_FLAG_ADDR16){ + + + status = i2c_smbus_write_byte_data(client, offset>>8, + offset&0xff); + if(status < 0) + return status; + + mdelay(7); + for (i = 0; i < count; i++) { + j = i2c_smbus_read_byte(client); + if (j < 0) { + return j; + } + buf[i] = j; + } + return count; + + }else{ + + loop_until_timeout(timeout, read_time) { + status = i2c_smbus_read_i2c_block_data_or_emulated(client, + offset, + count, buf); + + dev_dbg(&client->dev, "read %zu@%d --> %d (%ld)\n", + count, offset, status, jiffies); + + if (status == count) + return count; + } + } + return -ETIMEDOUT; +} + +static ssize_t at24_eeprom_read_i2c(struct at24_data *at24, char *buf, + unsigned int offset, size_t count) +{ + unsigned long timeout, read_time; + struct i2c_client *client; + struct i2c_msg msg[2]; + int status, i; + u8 msgbuf[2]; + + memset(msg, 0, sizeof(msg)); + client = at24_translate_offset(at24, &offset); + + if (count > io_limit) + count = io_limit; + + /* + * When we have a better choice than SMBus calls, use a combined I2C + * message. Write address; then read up to io_limit data bytes. Note + * that read page rollover helps us here (unlike writes). msgbuf is + * u8 and will cast to our needs. + */ + i = 0; + if (at24->chip.flags & AT24_FLAG_ADDR16) + msgbuf[i++] = offset >> 8; + msgbuf[i++] = offset; + + msg[0].addr = client->addr; + msg[0].buf = msgbuf; + msg[0].len = i; + + msg[1].addr = client->addr; + msg[1].flags = I2C_M_RD; + msg[1].buf = buf; + msg[1].len = count; + + loop_until_timeout(timeout, read_time) { + status = i2c_transfer(client->adapter, msg, 2); + if (status == 2) + status = count; + + dev_dbg(&client->dev, "read %zu@%d --> %d (%ld)\n", + count, offset, status, jiffies); + + if (status == count) + return count; + } + + return -ETIMEDOUT; +} + +static ssize_t at24_eeprom_read_serial(struct at24_data *at24, char *buf, + unsigned int offset, size_t count) +{ + unsigned long timeout, read_time; + struct i2c_client *client; + struct i2c_msg msg[2]; + u8 addrbuf[2]; + int status; + + client = at24_translate_offset(at24, &offset); + + memset(msg, 0, sizeof(msg)); + msg[0].addr = client->addr; + msg[0].buf = addrbuf; + + /* + * The address pointer of the device is shared between the regular + * EEPROM array and the serial number block. The dummy write (part of + * the sequential read protocol) ensures the address pointer is reset + * to the desired position. + */ + if (at24->chip.flags & AT24_FLAG_ADDR16) { + /* + * For 16 bit address pointers, the word address must contain + * a '10' sequence in bits 11 and 10 regardless of the + * intended position of the address pointer. + */ + addrbuf[0] = 0x08; + addrbuf[1] = offset; + msg[0].len = 2; + } else { + /* + * Otherwise the word address must begin with a '10' sequence, + * regardless of the intended address. + */ + addrbuf[0] = 0x80 + offset; + msg[0].len = 1; + } + + msg[1].addr = client->addr; + msg[1].flags = I2C_M_RD; + msg[1].buf = buf; + msg[1].len = count; + + loop_until_timeout(timeout, read_time) { + status = i2c_transfer(client->adapter, msg, 2); + if (status == 2) + return count; + } + + return -ETIMEDOUT; +} + +static ssize_t at24_eeprom_read_mac(struct at24_data *at24, char *buf, + unsigned int offset, size_t count) +{ + unsigned long timeout, read_time; + struct i2c_client *client; + struct i2c_msg msg[2]; + u8 addrbuf[2]; + int status; + + client = at24_translate_offset(at24, &offset); + + memset(msg, 0, sizeof(msg)); + msg[0].addr = client->addr; + msg[0].buf = addrbuf; + /* EUI-48 starts from 0x9a, EUI-64 from 0x98 */ + addrbuf[0] = 0xa0 - at24->chip.byte_len + offset; + msg[0].len = 1; + msg[1].addr = client->addr; + msg[1].flags = I2C_M_RD; + msg[1].buf = buf; + msg[1].len = count; + + loop_until_timeout(timeout, read_time) { + status = i2c_transfer(client->adapter, msg, 2); + if (status == 2) + return count; + } + + return -ETIMEDOUT; +} + +/* + * Note that if the hardware write-protect pin is pulled high, the whole + * chip is normally write protected. But there are plenty of product + * variants here, including OTP fuses and partial chip protect. + * + * We only use page mode writes; the alternative is sloooow. These routines + * write at most one page. + */ + +static size_t at24_adjust_write_count(struct at24_data *at24, + unsigned int offset, size_t count) +{ + unsigned next_page; + + /* write_max is at most a page */ + if (count > at24->write_max) + count = at24->write_max; + + /* Never roll over backwards, to the start of this page */ + next_page = roundup(offset + 1, at24->chip.page_size); + if (offset + count > next_page) + count = next_page - offset; + + return count; +} + +static ssize_t at24_eeprom_write_smbus_block(struct at24_data *at24, + const char *buf, + unsigned int offset, size_t count) +{ + unsigned long timeout, write_time; + struct i2c_client *client; + ssize_t status = 0; + + client = at24_translate_offset(at24, &offset); + count = at24_adjust_write_count(at24, offset, count); + + loop_until_timeout(timeout, write_time) { + status = i2c_smbus_write_i2c_block_data(client, + offset, count, buf); + if (status == 0) + status = count; + + dev_dbg(&client->dev, "write %zu@%d --> %zd (%ld)\n", + count, offset, status, jiffies); + + if (status == count) + return count; + } + + return -ETIMEDOUT; +} + +static ssize_t at24_eeprom_write_smbus_byte(struct at24_data *at24, + const char *buf, + unsigned int offset, size_t count) +{ + unsigned long timeout, write_time; + struct i2c_client *client; + ssize_t status = 0; + + client = at24_translate_offset(at24, &offset); + + loop_until_timeout(timeout, write_time) { + status = i2c_smbus_write_byte_data(client, offset, buf[0]); + if (status == 0) + status = count; + + dev_dbg(&client->dev, "write %zu@%d --> %zd (%ld)\n", + count, offset, status, jiffies); + + if (status == count) + return count; + } + + return -ETIMEDOUT; +} + +static ssize_t at24_eeprom_write_i2c(struct at24_data *at24, const char *buf, + unsigned int offset, size_t count) +{ + unsigned long timeout, write_time; + struct i2c_client *client; + struct i2c_msg msg; + ssize_t status = 0; + int i = 0; + + client = at24_translate_offset(at24, &offset); + count = at24_adjust_write_count(at24, offset, count); + + msg.addr = client->addr; + msg.flags = 0; + + /* msg.buf is u8 and casts will mask the values */ + msg.buf = at24->writebuf; + if (at24->chip.flags & AT24_FLAG_ADDR16) + msg.buf[i++] = offset >> 8; + + msg.buf[i++] = offset; + memcpy(&msg.buf[i], buf, count); + msg.len = i + count; + + loop_until_timeout(timeout, write_time) { + status = i2c_transfer(client->adapter, &msg, 1); + if (status == 1) + status = count; + + dev_dbg(&client->dev, "write %zu@%d --> %zd (%ld)\n", + count, offset, status, jiffies); + + if (status == count) + return count; + } + + return -ETIMEDOUT; +} + +static int at24_read(void *priv, unsigned int off, void *val, size_t count) +{ + struct at24_data *at24 = priv; + char *buf = val; + + if (unlikely(!count)) + return count; + + if (off + count > at24->chip.byte_len) + return -EINVAL; + + /* + * Read data from chip, protecting against concurrent updates + * from this host, but not from other I2C masters. + */ + mutex_lock(&at24->lock); + + while (count) { + int status; + + status = at24->read_func(at24, buf, off, count); + if (status < 0) { + mutex_unlock(&at24->lock); + return status; + } + buf += status; + off += status; + count -= status; + } + + mutex_unlock(&at24->lock); + + return 0; +} + +static int at24_write(void *priv, unsigned int off, void *val, size_t count) +{ + struct at24_data *at24 = priv; + char *buf = val; + + if (unlikely(!count)) + return -EINVAL; + + if (off + count > at24->chip.byte_len) + return -EINVAL; + + /* + * Write data to chip, protecting against concurrent updates + * from this host, but not from other I2C masters. + */ + mutex_lock(&at24->lock); + + while (count) { + int status; + + status = at24->write_func(at24, buf, off, count); + if (status < 0) { + mutex_unlock(&at24->lock); + return status; + } + buf += status; + off += status; + count -= status; + } + + mutex_unlock(&at24->lock); + + return 0; +} + +#ifdef CONFIG_OF +static void at24_get_ofdata(struct i2c_client *client, + struct at24_platform_data *chip) +{ + const __be32 *val; + struct device_node *node = client->dev.of_node; + + if (node) { + if (of_get_property(node, "read-only", NULL)) + chip->flags |= AT24_FLAG_READONLY; + val = of_get_property(node, "pagesize", NULL); + if (val) + chip->page_size = be32_to_cpup(val); + } +} +#else +static void at24_get_ofdata(struct i2c_client *client, + struct at24_platform_data *chip) +{ } +#endif /* CONFIG_OF */ + +static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id) +{ + struct at24_platform_data chip; + kernel_ulong_t magic = 0; + bool writable; + int use_smbus = 0; + int use_smbus_write = 0; + struct at24_data *at24; + int err; + unsigned i, num_addresses; + u8 test_byte; + + if (client->dev.platform_data) { + chip = *(struct at24_platform_data *)client->dev.platform_data; + } else { + if (id) { + magic = id->driver_data; + } else { + const struct acpi_device_id *aid; + + aid = acpi_match_device(at24_acpi_ids, &client->dev); + if (aid) + magic = aid->driver_data; + } + if (!magic) + return -ENODEV; + + chip.byte_len = BIT(magic & AT24_BITMASK(AT24_SIZE_BYTELEN)); + magic >>= AT24_SIZE_BYTELEN; + chip.flags = magic & AT24_BITMASK(AT24_SIZE_FLAGS); + /* + * This is slow, but we can't know all eeproms, so we better + * play safe. Specifying custom eeprom-types via platform_data + * is recommended anyhow. + */ + chip.page_size = 1; + + /* update chipdata if OF is present */ + at24_get_ofdata(client, &chip); + + chip.setup = NULL; + chip.context = NULL; + } + + if (!is_power_of_2(chip.byte_len)) + dev_warn(&client->dev, + "byte_len looks suspicious (no power of 2)!\n"); + if (!chip.page_size) { + dev_err(&client->dev, "page_size must not be 0!\n"); + return -EINVAL; + } + if (!is_power_of_2(chip.page_size)) + dev_warn(&client->dev, + "page_size looks suspicious (no power of 2)!\n"); + + /* + * REVISIT: the size of the EUI-48 byte array is 6 in at24mac402, while + * the call to ilog2() in AT24_DEVICE_MAGIC() rounds it down to 4. + * + * Eventually we'll get rid of the magic values altoghether in favor of + * real structs, but for now just manually set the right size. + */ + if (chip.flags & AT24_FLAG_MAC && chip.byte_len == 4) + chip.byte_len = 6; + + /* Use I2C operations unless we're stuck with SMBus extensions. */ + if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { + //if (chip.flags & AT24_FLAG_ADDR16) + // return -EPFNOSUPPORT; + + if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { + use_smbus = I2C_SMBUS_I2C_BLOCK_DATA; + } else if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_READ_WORD_DATA)) { + use_smbus = I2C_SMBUS_WORD_DATA; + } else if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_READ_BYTE_DATA)) { + use_smbus = I2C_SMBUS_BYTE_DATA; + } else { + return -EPFNOSUPPORT; + } + + if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_WRITE_I2C_BLOCK)) { + use_smbus_write = I2C_SMBUS_I2C_BLOCK_DATA; + } else if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) { + use_smbus_write = I2C_SMBUS_BYTE_DATA; + chip.page_size = 1; + } + } + + if (chip.flags & AT24_FLAG_TAKE8ADDR) + num_addresses = 8; + else + num_addresses = DIV_ROUND_UP(chip.byte_len, + (chip.flags & AT24_FLAG_ADDR16) ? 65536 : 256); + + at24 = devm_kzalloc(&client->dev, sizeof(struct at24_data) + + num_addresses * sizeof(struct i2c_client *), GFP_KERNEL); + if (!at24) + return -ENOMEM; + + mutex_init(&at24->lock); + at24->use_smbus = use_smbus; + at24->use_smbus_write = use_smbus_write; + at24->chip = chip; + at24->num_addresses = num_addresses; + + if ((chip.flags & AT24_FLAG_SERIAL) && (chip.flags & AT24_FLAG_MAC)) { + dev_err(&client->dev, + "invalid device data - cannot have both AT24_FLAG_SERIAL & AT24_FLAG_MAC."); + return -EINVAL; + } + + if (chip.flags & AT24_FLAG_SERIAL) { + at24->read_func = at24_eeprom_read_serial; + } else if (chip.flags & AT24_FLAG_MAC) { + at24->read_func = at24_eeprom_read_mac; + } else { + at24->read_func = at24->use_smbus ? at24_eeprom_read_smbus + : at24_eeprom_read_i2c; + } + + if (at24->use_smbus) { + if (at24->use_smbus_write == I2C_SMBUS_I2C_BLOCK_DATA) + at24->write_func = at24_eeprom_write_smbus_block; + else + at24->write_func = at24_eeprom_write_smbus_byte; + } else { + at24->write_func = at24_eeprom_write_i2c; + } + + writable = !(chip.flags & AT24_FLAG_READONLY); + if (writable) { + if (!use_smbus || use_smbus_write) { + + unsigned write_max = chip.page_size; + + if (write_max > io_limit) + write_max = io_limit; + if (use_smbus && write_max > I2C_SMBUS_BLOCK_MAX) + write_max = I2C_SMBUS_BLOCK_MAX; + at24->write_max = write_max; + + /* buffer (data + address at the beginning) */ + at24->writebuf = devm_kzalloc(&client->dev, + write_max + 2, GFP_KERNEL); + if (!at24->writebuf) + return -ENOMEM; + } else { + dev_warn(&client->dev, + "cannot write due to controller restrictions."); + } + } + + at24->client[0] = client; + + /* use dummy devices for multiple-address chips */ + for (i = 1; i < num_addresses; i++) { + at24->client[i] = i2c_new_dummy(client->adapter, + client->addr + i); + if (!at24->client[i]) { + dev_err(&client->dev, "address 0x%02x unavailable\n", + client->addr + i); + err = -EADDRINUSE; + goto err_clients; + } + } + + i2c_set_clientdata(client, at24); + + /* + * Perform a one-byte test read to verify that the + * chip is functional. + */ + err = at24_read(at24, 0, &test_byte, 1); + if (err) { + err = -ENODEV; + goto err_clients; + } + + at24->nvmem_config.name = dev_name(&client->dev); + at24->nvmem_config.dev = &client->dev; + at24->nvmem_config.read_only = !writable; + at24->nvmem_config.root_only = true; + at24->nvmem_config.owner = THIS_MODULE; + at24->nvmem_config.compat = true; + at24->nvmem_config.base_dev = &client->dev; + at24->nvmem_config.reg_read = at24_read; + at24->nvmem_config.reg_write = at24_write; + at24->nvmem_config.priv = at24; + at24->nvmem_config.stride = 1; + at24->nvmem_config.word_size = 1; + at24->nvmem_config.size = chip.byte_len; + + at24->nvmem = nvmem_register(&at24->nvmem_config); + + if (IS_ERR(at24->nvmem)) { + err = PTR_ERR(at24->nvmem); + goto err_clients; + } + + dev_info(&client->dev, "%u byte %s EEPROM, %s, %u bytes/write\n", + chip.byte_len, client->name, + writable ? "writable" : "read-only", at24->write_max); + if (use_smbus == I2C_SMBUS_WORD_DATA || + use_smbus == I2C_SMBUS_BYTE_DATA) { + dev_notice(&client->dev, "Falling back to %s reads, " + "performance will suffer\n", use_smbus == + I2C_SMBUS_WORD_DATA ? "word" : "byte"); + } + + /* export data to kernel code */ + if (chip.setup) + chip.setup(at24->nvmem, chip.context); + + return 0; + +err_clients: + for (i = 1; i < num_addresses; i++) + if (at24->client[i]) + i2c_unregister_device(at24->client[i]); + + return err; +} + +static int at24_remove(struct i2c_client *client) +{ + struct at24_data *at24; + int i; + + at24 = i2c_get_clientdata(client); + + nvmem_unregister(at24->nvmem); + + for (i = 1; i < at24->num_addresses; i++) + i2c_unregister_device(at24->client[i]); + + return 0; +} + +/*-------------------------------------------------------------------------*/ + +static struct i2c_driver at24_driver = { + .driver = { + .name = "at24_smbus", + .acpi_match_table = ACPI_PTR(at24_acpi_ids), + }, + .probe = at24_probe, + .remove = at24_remove, + .id_table = at24_ids, +}; + +static int __init at24_init(void) +{ + if (!io_limit) { + pr_err("at24: io_limit must not be 0!\n"); + return -EINVAL; + } + + io_limit = rounddown_pow_of_two(io_limit); + return i2c_add_driver(&at24_driver); +} +module_init(at24_init); + +static void __exit at24_exit(void) +{ + i2c_del_driver(&at24_driver); +} +module_exit(at24_exit); + +MODULE_DESCRIPTION("Driver for most I2C EEPROMs"); +MODULE_AUTHOR("David Brownell and Wolfram Sang"); +MODULE_LICENSE("GPL"); diff --git a/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/nct7511.c b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/nct7511.c new file mode 100644 index 0000000000..8ddf1919f5 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/nct7511.c @@ -0,0 +1,765 @@ +/* + + */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRVNAME "nct7511" + + +#define REG_BANK 0x00 +#define REG_TEMP_LSB 0x05 +#define REG_FANCOUNT_LOW 0x13 +#define REG_START 0x21 +#define REG_MODE 0x22 /* 7.2.32 Mode Selection Register */ +#define REG_FAN_ENABLE 0x24 +#define REG_PWM(x) (0x60 + (x)) +#define REG_SMARTFAN_EN(x) (0x64 + (x) / 2) +#define SMARTFAN_EN_SHIFT(x) ((x) % 2 * 4) +#define REG_VENDOR_ID 0xfd +#define REG_CHIP_ID 0xfe +#define REG_VERSION_ID 0xff + +/* + * Data structures and manipulation thereof + */ + +struct nct7511_data { + struct regmap *regmap; + struct mutex access_lock; /* for multi-byte read and write operations */ +}; + +static ssize_t show_temp_type(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct nct7511_data *data = dev_get_drvdata(dev); + struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr); + unsigned int mode; + int ret; + + ret = regmap_read(data->regmap, REG_MODE, &mode); + if (ret < 0) + return ret; + + return sprintf(buf, "%u\n", (mode >> (2 * sattr->index) & 3) + 2); +} + +static ssize_t store_temp_type(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct nct7511_data *data = dev_get_drvdata(dev); + struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr); + unsigned int type; + int err; + + err = kstrtouint(buf, 0, &type); + if (err < 0) + return err; + if (sattr->index == 2 && type != 4) /* RD3 */ + return -EINVAL; + if (type < 3 || type > 4) + return -EINVAL; + err = regmap_update_bits(data->regmap, REG_MODE, + 3 << 2 * sattr->index, (type - 2) << 2 * sattr->index); + return err ? : count; +} + +static ssize_t show_pwm_mode(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr); + struct nct7511_data *data = dev_get_drvdata(dev); + unsigned int regval; + int ret; + + if (sattr->index > 1) + return sprintf(buf, "1\n"); + + ret = regmap_read(data->regmap, 0x5E, ®val); + if (ret < 0) + return ret; + + return sprintf(buf, "%u\n", !(regval & (1 << sattr->index))); +} + +static ssize_t show_pwm(struct device *dev, struct device_attribute *devattr, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct nct7511_data *data = dev_get_drvdata(dev); + unsigned int val; + int ret; + + if (!attr->index) + return sprintf(buf, "255\n"); + + ret = regmap_read(data->regmap, attr->index, &val); + if (ret < 0) + return ret; + + return sprintf(buf, "%d\n", val); +} + +static ssize_t store_pwm(struct device *dev, struct device_attribute *devattr, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct nct7511_data *data = dev_get_drvdata(dev); + int err; + u8 val; + + err = kstrtou8(buf, 0, &val); + if (err < 0) + return err; + + err = regmap_write(data->regmap, attr->index, val); + return err ? : count; +} + +static ssize_t show_pwm_enable(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct nct7511_data *data = dev_get_drvdata(dev); + struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr); + unsigned int reg, enabled; + int ret; + + ret = regmap_read(data->regmap, REG_SMARTFAN_EN(sattr->index), ®); + if (ret < 0) + return ret; + enabled = reg >> SMARTFAN_EN_SHIFT(sattr->index) & 1; + return sprintf(buf, "%u\n", enabled + 1); +} + +static ssize_t store_pwm_enable(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct nct7511_data *data = dev_get_drvdata(dev); + struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr); + u8 val; + int ret; + + ret = kstrtou8(buf, 0, &val); + if (ret < 0) + return ret; + if (val < 1 || val > 2) + return -EINVAL; + ret = regmap_update_bits(data->regmap, REG_SMARTFAN_EN(sattr->index), + 1 << SMARTFAN_EN_SHIFT(sattr->index), + (val - 1) << SMARTFAN_EN_SHIFT(sattr->index)); + return ret ? : count; +} + +static int nct7511_read_temp(struct nct7511_data *data, + u8 reg_temp, u8 reg_temp_low, int *temp) +{ + unsigned int t1, t2 = 0; + int err; + + *temp = 0; + + mutex_lock(&data->access_lock); + err = regmap_read(data->regmap, reg_temp, &t1); + if (err < 0) + goto abort; + t1 <<= 8; + if (reg_temp_low) { /* 11 bit data */ + err = regmap_read(data->regmap, reg_temp_low, &t2); + if (err < 0) + goto abort; + } + t1 |= t2 & 0xe0; + *temp = (s16)t1 / 32 * 125; +abort: + mutex_unlock(&data->access_lock); + return err; +} + +static int nct7511_read_fan(struct nct7511_data *data, u8 reg_fan) +{ + unsigned int f1, f2; + int ret; + + mutex_lock(&data->access_lock); + ret = regmap_read(data->regmap, reg_fan, &f1); + if (ret < 0) + goto abort; + ret = regmap_read(data->regmap, REG_FANCOUNT_LOW, &f2); + if (ret < 0) + goto abort; + ret = (f1 << 5) | (f2 >> 3); + /* convert fan count to rpm */ + if (ret == 0x1fff) /* maximum value, assume fan is stopped */ + ret = 0; + else if (ret) + ret = DIV_ROUND_CLOSEST(1350000U, ret); +abort: + mutex_unlock(&data->access_lock); + return ret; +} + +static int nct7511_read_fan_min(struct nct7511_data *data, u8 reg_fan_low, + u8 reg_fan_high) +{ + unsigned int f1, f2; + int ret; + + mutex_lock(&data->access_lock); + ret = regmap_read(data->regmap, reg_fan_low, &f1); + if (ret < 0) + goto abort; + ret = regmap_read(data->regmap, reg_fan_high, &f2); + if (ret < 0) + goto abort; + ret = f1 | ((f2 & 0xf8) << 5); + /* convert fan count to rpm */ + if (ret == 0x1fff) /* maximum value, assume no limit */ + ret = 0; + else if (ret) + ret = DIV_ROUND_CLOSEST(1350000U, ret); + else + ret = 1350000U; +abort: + mutex_unlock(&data->access_lock); + return ret; +} + +static int nct7511_write_fan_min(struct nct7511_data *data, u8 reg_fan_low, + u8 reg_fan_high, unsigned long limit) +{ + int err; + + if (limit) + limit = DIV_ROUND_CLOSEST(1350000U, limit); + else + limit = 0x1fff; + limit = clamp_val(limit, 0, 0x1fff); + + mutex_lock(&data->access_lock); + err = regmap_write(data->regmap, reg_fan_low, limit & 0xff); + if (err < 0) + goto abort; + + err = regmap_write(data->regmap, reg_fan_high, (limit & 0x1f00) >> 5); +abort: + mutex_unlock(&data->access_lock); + return err; +} + +static ssize_t show_temp(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct nct7511_data *data = dev_get_drvdata(dev); + struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); + int err, temp; + + err = nct7511_read_temp(data, sattr->nr, sattr->index, &temp); + if (err < 0) + return err; + + return sprintf(buf, "%d\n", temp); +} + +static ssize_t store_temp(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); + struct nct7511_data *data = dev_get_drvdata(dev); + int nr = sattr->nr; + long val; + int err; + + err = kstrtol(buf, 10, &val); + if (err < 0) + return err; + + val = DIV_ROUND_CLOSEST(clamp_val(val, -128000, 127000), 1000); + + err = regmap_write(data->regmap, nr, val & 0xff); + return err ? : count; +} + +static ssize_t show_fan(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr); + struct nct7511_data *data = dev_get_drvdata(dev); + int speed; + + speed = nct7511_read_fan(data, sattr->index); + if (speed < 0) + return speed; + + return sprintf(buf, "%d\n", speed); +} + +static ssize_t show_fan_min(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); + struct nct7511_data *data = dev_get_drvdata(dev); + int speed; + + speed = nct7511_read_fan_min(data, sattr->nr, sattr->index); + if (speed < 0) + return speed; + + return sprintf(buf, "%d\n", speed); +} + +static ssize_t store_fan_min(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); + struct nct7511_data *data = dev_get_drvdata(dev); + unsigned long val; + int err; + + err = kstrtoul(buf, 10, &val); + if (err < 0) + return err; + + err = nct7511_write_fan_min(data, sattr->nr, sattr->index, val); + return err ? : count; +} + +static ssize_t show_alarm(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct nct7511_data *data = dev_get_drvdata(dev); + struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); + int bit = sattr->index; + unsigned int val; + int ret; + + ret = regmap_read(data->regmap, sattr->nr, &val); + if (ret < 0) + return ret; + + return sprintf(buf, "%u\n", !!(val & (1 << bit))); +} + +static ssize_t +show_beep(struct device *dev, struct device_attribute *attr, char *buf) +{ + struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); + struct nct7511_data *data = dev_get_drvdata(dev); + unsigned int regval; + int err; + + err = regmap_read(data->regmap, sattr->nr, ®val); + if (err) + return err; + + return sprintf(buf, "%u\n", !!(regval & (1 << sattr->index))); +} + +static ssize_t +store_beep(struct device *dev, struct device_attribute *attr, const char *buf, + size_t count) +{ + struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); + struct nct7511_data *data = dev_get_drvdata(dev); + unsigned long val; + int err; + + err = kstrtoul(buf, 10, &val); + if (err < 0) + return err; + if (val > 1) + return -EINVAL; + + err = regmap_update_bits(data->regmap, sattr->nr, 1 << sattr->index, + val ? 1 << sattr->index : 0); + return err ? : count; +} + +static SENSOR_DEVICE_ATTR(temp1_type, S_IRUGO | S_IWUSR, + show_temp_type, store_temp_type, 0); +static SENSOR_DEVICE_ATTR_2(temp1_input, S_IRUGO, show_temp, NULL, 0x01, + REG_TEMP_LSB); +static SENSOR_DEVICE_ATTR_2(temp1_min, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x31, 0); +static SENSOR_DEVICE_ATTR_2(temp1_max, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x30, 0); +static SENSOR_DEVICE_ATTR_2(temp1_crit, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x3a, 0); + +static SENSOR_DEVICE_ATTR(temp2_type, S_IRUGO | S_IWUSR, + show_temp_type, store_temp_type, 1); +static SENSOR_DEVICE_ATTR_2(temp2_input, S_IRUGO, show_temp, NULL, 0x02, + REG_TEMP_LSB); +static SENSOR_DEVICE_ATTR_2(temp2_min, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x33, 0); +static SENSOR_DEVICE_ATTR_2(temp2_max, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x32, 0); +static SENSOR_DEVICE_ATTR_2(temp2_crit, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x3b, 0); + +static SENSOR_DEVICE_ATTR(temp3_type, S_IRUGO | S_IWUSR, + show_temp_type, store_temp_type, 2); +static SENSOR_DEVICE_ATTR_2(temp3_input, S_IRUGO, show_temp, NULL, 0x03, + REG_TEMP_LSB); +static SENSOR_DEVICE_ATTR_2(temp3_min, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x35, 0); +static SENSOR_DEVICE_ATTR_2(temp3_max, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x34, 0); +static SENSOR_DEVICE_ATTR_2(temp3_crit, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x3c, 0); + +static SENSOR_DEVICE_ATTR_2(temp4_input, S_IRUGO, show_temp, NULL, 0x04, 0); +static SENSOR_DEVICE_ATTR_2(temp4_min, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x37, 0); +static SENSOR_DEVICE_ATTR_2(temp4_max, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x36, 0); +static SENSOR_DEVICE_ATTR_2(temp4_crit, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x3d, 0); + + +static SENSOR_DEVICE_ATTR_2(temp1_min_alarm, S_IRUGO, show_alarm, NULL, + 0x18, 0); +static SENSOR_DEVICE_ATTR_2(temp2_min_alarm, S_IRUGO, show_alarm, NULL, + 0x18, 1); +static SENSOR_DEVICE_ATTR_2(temp3_min_alarm, S_IRUGO, show_alarm, NULL, + 0x18, 2); +static SENSOR_DEVICE_ATTR_2(temp4_min_alarm, S_IRUGO, show_alarm, NULL, + 0x18, 3); + +static SENSOR_DEVICE_ATTR_2(temp1_max_alarm, S_IRUGO, show_alarm, NULL, + 0x19, 0); +static SENSOR_DEVICE_ATTR_2(temp2_max_alarm, S_IRUGO, show_alarm, NULL, + 0x19, 1); +static SENSOR_DEVICE_ATTR_2(temp3_max_alarm, S_IRUGO, show_alarm, NULL, + 0x19, 2); +static SENSOR_DEVICE_ATTR_2(temp4_max_alarm, S_IRUGO, show_alarm, NULL, + 0x19, 3); + + +static SENSOR_DEVICE_ATTR_2(temp1_crit_alarm, S_IRUGO, show_alarm, NULL, + 0x1b, 0); +static SENSOR_DEVICE_ATTR_2(temp2_crit_alarm, S_IRUGO, show_alarm, NULL, + 0x1b, 1); +static SENSOR_DEVICE_ATTR_2(temp3_crit_alarm, S_IRUGO, show_alarm, NULL, + 0x1b, 2); +static SENSOR_DEVICE_ATTR_2(temp4_crit_alarm, S_IRUGO, show_alarm, NULL, + 0x1b, 3); + +static SENSOR_DEVICE_ATTR_2(temp1_fault, S_IRUGO, show_alarm, NULL, 0x17, 0); +static SENSOR_DEVICE_ATTR_2(temp2_fault, S_IRUGO, show_alarm, NULL, 0x17, 1); +static SENSOR_DEVICE_ATTR_2(temp3_fault, S_IRUGO, show_alarm, NULL, 0x17, 2); + +static SENSOR_DEVICE_ATTR_2(temp1_beep, S_IRUGO | S_IWUSR, show_beep, + store_beep, 0x5c, 0); +static SENSOR_DEVICE_ATTR_2(temp2_beep, S_IRUGO | S_IWUSR, show_beep, + store_beep, 0x5c, 1); +static SENSOR_DEVICE_ATTR_2(temp3_beep, S_IRUGO | S_IWUSR, show_beep, + store_beep, 0x5c, 2); +static SENSOR_DEVICE_ATTR_2(temp4_beep, S_IRUGO | S_IWUSR, show_beep, + store_beep, 0x5c, 3); + +static struct attribute *nct7511_temp_attrs[] = { + &sensor_dev_attr_temp1_type.dev_attr.attr, + &sensor_dev_attr_temp1_input.dev_attr.attr, + &sensor_dev_attr_temp1_min.dev_attr.attr, + &sensor_dev_attr_temp1_max.dev_attr.attr, + &sensor_dev_attr_temp1_crit.dev_attr.attr, + &sensor_dev_attr_temp1_min_alarm.dev_attr.attr, + &sensor_dev_attr_temp1_max_alarm.dev_attr.attr, + &sensor_dev_attr_temp1_crit_alarm.dev_attr.attr, + &sensor_dev_attr_temp1_fault.dev_attr.attr, + &sensor_dev_attr_temp1_beep.dev_attr.attr, + + &sensor_dev_attr_temp2_type.dev_attr.attr, /* 10 */ + &sensor_dev_attr_temp2_input.dev_attr.attr, + &sensor_dev_attr_temp2_min.dev_attr.attr, + &sensor_dev_attr_temp2_max.dev_attr.attr, + &sensor_dev_attr_temp2_crit.dev_attr.attr, + &sensor_dev_attr_temp2_min_alarm.dev_attr.attr, + &sensor_dev_attr_temp2_max_alarm.dev_attr.attr, + &sensor_dev_attr_temp2_crit_alarm.dev_attr.attr, + &sensor_dev_attr_temp2_fault.dev_attr.attr, + &sensor_dev_attr_temp2_beep.dev_attr.attr, + + &sensor_dev_attr_temp3_type.dev_attr.attr, /* 20 */ + &sensor_dev_attr_temp3_input.dev_attr.attr, + &sensor_dev_attr_temp3_min.dev_attr.attr, + &sensor_dev_attr_temp3_max.dev_attr.attr, + &sensor_dev_attr_temp3_crit.dev_attr.attr, + &sensor_dev_attr_temp3_min_alarm.dev_attr.attr, + &sensor_dev_attr_temp3_max_alarm.dev_attr.attr, + &sensor_dev_attr_temp3_crit_alarm.dev_attr.attr, + &sensor_dev_attr_temp3_fault.dev_attr.attr, + &sensor_dev_attr_temp3_beep.dev_attr.attr, + + &sensor_dev_attr_temp4_input.dev_attr.attr, /* 30 */ + &sensor_dev_attr_temp4_min.dev_attr.attr, + &sensor_dev_attr_temp4_max.dev_attr.attr, + &sensor_dev_attr_temp4_crit.dev_attr.attr, + &sensor_dev_attr_temp4_min_alarm.dev_attr.attr, + &sensor_dev_attr_temp4_max_alarm.dev_attr.attr, + &sensor_dev_attr_temp4_crit_alarm.dev_attr.attr, + &sensor_dev_attr_temp4_beep.dev_attr.attr, + + NULL +}; + +static umode_t nct7511_temp_is_visible(struct kobject *kobj, + struct attribute *attr, int index) +{ + struct device *dev = container_of(kobj, struct device, kobj); + struct nct7511_data *data = dev_get_drvdata(dev); + unsigned int reg; + int err; + + err = regmap_read(data->regmap, REG_MODE, ®); + if (err < 0) + return 0; + + if (index < 10 && + (reg & 03) != 0x01 && (reg & 0x03) != 0x02) /* RD1 */ + return 0; + + if (index >= 10 && index < 20 && + (reg & 0x0c) != 0x04 && (reg & 0x0c) != 0x08) /* RD2 */ + return 0; + if (index >= 20 && index < 30 && (reg & 0x30) != 0x20) /* RD3 */ + return 0; + + if (index >= 30 && index < 38) /* local */ + return attr->mode; + + return attr->mode; +} + +static struct attribute_group nct7511_temp_group = { + .attrs = nct7511_temp_attrs, + .is_visible = nct7511_temp_is_visible, +}; + + +static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_fan, NULL, 0x10); +static SENSOR_DEVICE_ATTR_2(fan1_min, S_IRUGO | S_IWUSR, show_fan_min, + store_fan_min, 0x49, 0x4c); +static SENSOR_DEVICE_ATTR_2(fan1_alarm, S_IRUGO, show_alarm, NULL, 0x1a, 0); +static SENSOR_DEVICE_ATTR_2(fan1_beep, S_IRUGO | S_IWUSR, show_beep, store_beep, + 0x5b, 0); + +/* 7.2.89 Fan Control Output Type */ +static SENSOR_DEVICE_ATTR(pwm1_mode, S_IRUGO, show_pwm_mode, NULL, 0); + +/* 7.2.91... Fan Control Output Value */ +static SENSOR_DEVICE_ATTR(pwm1, S_IRUGO | S_IWUSR, show_pwm, store_pwm, + REG_PWM(0)); + + +/* 7.2.95... Temperature to Fan mapping Relationships Register */ +static SENSOR_DEVICE_ATTR(pwm1_enable, S_IRUGO | S_IWUSR, show_pwm_enable, + store_pwm_enable, 0); + + +static struct attribute *nct7511_fan_attrs[] = { + &sensor_dev_attr_fan1_input.dev_attr.attr, + &sensor_dev_attr_fan1_min.dev_attr.attr, + &sensor_dev_attr_fan1_alarm.dev_attr.attr, + &sensor_dev_attr_fan1_beep.dev_attr.attr, + NULL +}; + +static umode_t nct7511_fan_is_visible(struct kobject *kobj, + struct attribute *attr, int index) +{ + struct device *dev = container_of(kobj, struct device, kobj); + struct nct7511_data *data = dev_get_drvdata(dev); + int fan = index / 4; /* 4 attributes per fan */ + unsigned int reg; + int err; + + err = regmap_read(data->regmap, REG_FAN_ENABLE, ®); + if (err < 0 || !(reg & (1 << fan))) + return 0; + + return attr->mode; +} + +static struct attribute_group nct7511_fan_group = { + .attrs = nct7511_fan_attrs, + .is_visible = nct7511_fan_is_visible, +}; + +static struct attribute *nct7511_pwm_attrs[] = { + &sensor_dev_attr_pwm1_enable.dev_attr.attr, + &sensor_dev_attr_pwm1_mode.dev_attr.attr, + &sensor_dev_attr_pwm1.dev_attr.attr, + NULL +}; + +static struct attribute_group nct7511_pwm_group = { + .attrs = nct7511_pwm_attrs, +}; + +/* 7.2.115... 0x80-0x83, 0x84 Temperature (X-axis) transition */ +static SENSOR_DEVICE_ATTR_2(pwm1_auto_point1_temp, S_IRUGO | S_IWUSR, + show_temp, store_temp, 0x80, 0); +static SENSOR_DEVICE_ATTR_2(pwm1_auto_point2_temp, S_IRUGO | S_IWUSR, + show_temp, store_temp, 0x81, 0); +static SENSOR_DEVICE_ATTR_2(pwm1_auto_point3_temp, S_IRUGO | S_IWUSR, + show_temp, store_temp, 0x82, 0); +static SENSOR_DEVICE_ATTR_2(pwm1_auto_point4_temp, S_IRUGO | S_IWUSR, + show_temp, store_temp, 0x83, 0); +static SENSOR_DEVICE_ATTR_2(pwm1_auto_point5_temp, S_IRUGO | S_IWUSR, + show_temp, store_temp, 0x84, 0); + +/* 7.2.120... 0x85-0x88 PWM (Y-axis) transition */ +static SENSOR_DEVICE_ATTR(pwm1_auto_point1_pwm, S_IRUGO | S_IWUSR, + show_pwm, store_pwm, 0x85); +static SENSOR_DEVICE_ATTR(pwm1_auto_point2_pwm, S_IRUGO | S_IWUSR, + show_pwm, store_pwm, 0x86); +static SENSOR_DEVICE_ATTR(pwm1_auto_point3_pwm, S_IRUGO | S_IWUSR, + show_pwm, store_pwm, 0x87); +static SENSOR_DEVICE_ATTR(pwm1_auto_point4_pwm, S_IRUGO | S_IWUSR, + show_pwm, store_pwm, 0x88); +static SENSOR_DEVICE_ATTR(pwm1_auto_point5_pwm, S_IRUGO, show_pwm, NULL, 0); + + +static struct attribute *nct7511_auto_point_attrs[] = { + &sensor_dev_attr_pwm1_auto_point1_temp.dev_attr.attr, + &sensor_dev_attr_pwm1_auto_point2_temp.dev_attr.attr, + &sensor_dev_attr_pwm1_auto_point3_temp.dev_attr.attr, + &sensor_dev_attr_pwm1_auto_point4_temp.dev_attr.attr, + &sensor_dev_attr_pwm1_auto_point5_temp.dev_attr.attr, + + &sensor_dev_attr_pwm1_auto_point1_pwm.dev_attr.attr, + &sensor_dev_attr_pwm1_auto_point2_pwm.dev_attr.attr, + &sensor_dev_attr_pwm1_auto_point3_pwm.dev_attr.attr, + &sensor_dev_attr_pwm1_auto_point4_pwm.dev_attr.attr, + &sensor_dev_attr_pwm1_auto_point5_pwm.dev_attr.attr, + + NULL +}; + +static struct attribute_group nct7511_auto_point_group = { + .attrs = nct7511_auto_point_attrs, +}; + +static const struct attribute_group *nct7511_groups[] = { + &nct7511_temp_group, + &nct7511_fan_group, + &nct7511_pwm_group, + &nct7511_auto_point_group, + NULL +}; + +static int nct7511_detect(struct i2c_client *client, + struct i2c_board_info *info) +{ + int reg; + + reg = i2c_smbus_read_byte_data(client, REG_VENDOR_ID); + if (reg != 0x50) + return -ENODEV; + + reg = i2c_smbus_read_byte_data(client, REG_CHIP_ID); + if (reg != 0xc3) + return -ENODEV; + + reg = i2c_smbus_read_byte_data(client, REG_VERSION_ID); + if (reg < 0 || (reg & 0xf0) != 0x20) + return -ENODEV; + + /* Also validate lower bits of voltage and temperature registers */ + reg = i2c_smbus_read_byte_data(client, REG_TEMP_LSB); + if (reg < 0 || (reg & 0x1f)) + return -ENODEV; + + strlcpy(info->type, "nct7511", I2C_NAME_SIZE); + return 0; +} + +static bool nct7511_regmap_is_volatile(struct device *dev, unsigned int reg) +{ + return (reg != REG_BANK && reg <= 0x20) || + (reg >= REG_PWM(0) && reg <= REG_PWM(2)); +} + +static const struct regmap_config nct7511_regmap_config = { + .reg_bits = 8, + .val_bits = 8, + .cache_type = REGCACHE_RBTREE, + .volatile_reg = nct7511_regmap_is_volatile, +}; + +static int nct7511_init_chip(struct nct7511_data *data) +{ + int err; + + /* Enable ADC */ + err = regmap_update_bits(data->regmap, REG_START, 0x01, 0x01); + if (err) + return err; + /* Enable local temperature sensor */ + return regmap_update_bits(data->regmap, REG_MODE, 0x40, 0x40); +} + +static int nct7511_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct device *dev = &client->dev; + struct nct7511_data *data; + struct device *hwmon_dev; + int ret; + + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + if (data == NULL) + return -ENOMEM; + + data->regmap = devm_regmap_init_i2c(client, &nct7511_regmap_config); + if (IS_ERR(data->regmap)) + return PTR_ERR(data->regmap); + + mutex_init(&data->access_lock); + + ret = nct7511_init_chip(data); + if (ret < 0) + return ret; + + hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name, + data, + nct7511_groups); + return PTR_ERR_OR_ZERO(hwmon_dev); +} + + +static const struct i2c_device_id nct7511_idtable[] = { + { "nct7511", 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, nct7511_idtable); + +static struct i2c_driver nct7511_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = DRVNAME, + }, + .detect = nct7511_detect, + .probe = nct7511_probe, + .id_table = nct7511_idtable, +}; + +module_i2c_driver(nct7511_driver); + +MODULE_AUTHOR("Cameo "); +MODULE_DESCRIPTION("NCT7511Y Hardware Monitoring Driver"); +MODULE_LICENSE("GPL v2"); diff --git a/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q-common.c b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q-common.c new file mode 100644 index 0000000000..ab3b33100b --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q-common.c @@ -0,0 +1,368 @@ +/* An hwmon driver for Cameo ESC602-32Q Innovium i2c Module */ +#pragma GCC diagnostic ignored "-Wformat-zero-length" +#include "x86-64-cameo-esc602-32q.h" +#include "x86-64-cameo-esc602-32q-common.h" + +/* Addresses scanned */ +static const unsigned short normal_i2c[] = { 0x30, 0x31, 0x32, I2C_CLIENT_END }; +static int debug = 0; + + +/* i2c_client Declaration */ +struct i2c_client *Cameo_CPLD_30_client; //0x30 for SYS CPLD +struct i2c_client *Cameo_CPLD_31_client; //0x31 for Port 01-16 +struct i2c_client *Cameo_CPLD_32_client; //0x32 for Port 17-32 +struct i2c_client *Cameo_CPLD_23_client; //0x23 for Fan CPLD +struct i2c_client *Cameo_CPLD_35_client; //0x35 for Power CPLD +struct i2c_client *Cameo_BMC_14_client; //0x14 for BMC slave +/* end of i2c_client Declaration */ + +/* register offset define */ +#define BMC_EN_REG 0xA4 +/* end of register offset define */ + +/* common function */ +int bmc_enable(void) +{ + if ((i2c_smbus_read_byte_data(Cameo_CPLD_30_client, BMC_EN_REG) & BIT_0_MASK) == 0x01) + { + return ENABLE; + } + else + { + return DISABLE; + } +} + +int read_8bit_temp(u8 sign,u8 value) +{ + int result = 0; + if(sign) + { + //printf("read_8bit_temp UP %d\n", value & 0x80); + value = ~(value)+1; + result = value; + return result; + } + else + { + //printf("read_8bit_temp DOWN %d\n", value & 0x80); + result = value; + return result; + } +} + +/* end of common function*/ + +static int Cameo_i2c_probe(struct i2c_client *client, const struct i2c_device_id *dev_id) +{ + struct Cameo_i2c_data *Cameo_CPLD_30_data; + struct Cameo_i2c_data *Cameo_CPLD_31_data; + struct Cameo_i2c_data *Cameo_CPLD_32_data; + struct Cameo_i2c_data *Cameo_CPLD_23_data; + struct Cameo_i2c_data *Cameo_CPLD_35_data; + struct Cameo_i2c_data *Cameo_BMC_14_data; + int status; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA)) + { + status = -EIO; + goto exit; + } + Cameo_CPLD_30_data = kzalloc(sizeof(struct Cameo_i2c_data), GFP_KERNEL); + if (!Cameo_CPLD_30_data) + { + printk(KERN_ALERT "kzalloc fail\n"); + status = -ENOMEM; + goto exit; + } + + Cameo_CPLD_31_data = kzalloc(sizeof(struct Cameo_i2c_data), GFP_KERNEL); + if (!Cameo_CPLD_31_data) + { + printk(KERN_ALERT "kzalloc fail\n"); + status = -ENOMEM; + goto exit; + } + + Cameo_CPLD_32_data = kzalloc(sizeof(struct Cameo_i2c_data), GFP_KERNEL); + if (!Cameo_CPLD_32_data) + { + printk(KERN_ALERT "kzalloc fail\n"); + status = -ENOMEM; + goto exit; + } + + Cameo_CPLD_23_data = kzalloc(sizeof(struct Cameo_i2c_data), GFP_KERNEL); + if (!Cameo_CPLD_23_data) + { + printk(KERN_ALERT "kzalloc fail\n"); + status = -ENOMEM; + goto exit; + } + + Cameo_CPLD_35_data = kzalloc(sizeof(struct Cameo_i2c_data), GFP_KERNEL); + if (!Cameo_CPLD_35_data) + { + printk(KERN_ALERT "kzalloc fail\n"); + status = -ENOMEM; + goto exit; + } + + Cameo_BMC_14_data = kzalloc(sizeof(struct Cameo_i2c_data), GFP_KERNEL); + if (!Cameo_BMC_14_data) + { + printk(KERN_ALERT "kzalloc fail\n"); + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(Cameo_CPLD_30_client, Cameo_CPLD_30_data); + i2c_set_clientdata(Cameo_CPLD_31_client, Cameo_CPLD_31_data); + i2c_set_clientdata(Cameo_CPLD_32_client, Cameo_CPLD_32_data); + i2c_set_clientdata(Cameo_CPLD_23_client, Cameo_CPLD_23_data); + i2c_set_clientdata(Cameo_CPLD_35_client, Cameo_CPLD_35_data); + i2c_set_clientdata(Cameo_BMC_14_client , Cameo_BMC_14_data); + + mutex_init(&Cameo_CPLD_30_data->update_lock); + mutex_init(&Cameo_CPLD_31_data->update_lock); + mutex_init(&Cameo_CPLD_32_data->update_lock); + mutex_init(&Cameo_CPLD_23_data->update_lock); + mutex_init(&Cameo_CPLD_35_data->update_lock); + mutex_init(&Cameo_BMC_14_data->update_lock); + + Cameo_CPLD_30_data->valid = 0; + mutex_init(&Cameo_CPLD_30_data->update_lock); + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &ESC602_SYS_group); + if (status) + { + goto exit_free; + } + + status = sysfs_create_group(&client->dev.kobj, &ESC602_LED_group); + if (status) + { + goto exit_free; + } + + status = sysfs_create_group(&client->dev.kobj, &ESC602_FAN_group); + if (status) + { + goto exit_free; + } + + status = sysfs_create_group(&client->dev.kobj, &ESC602_THERMAL_group); + if (status) + { + goto exit_free; + } + + status = sysfs_create_group(&client->dev.kobj, &ESC602_POWER_group); + if (status) + { + goto exit_free; + } + + status = sysfs_create_group(&client->dev.kobj, &ESC602_QSFP_group); + if (status) + { + goto exit_free; + } + + Cameo_CPLD_30_data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(Cameo_CPLD_30_data->hwmon_dev)) + { + status = PTR_ERR(Cameo_CPLD_30_data->hwmon_dev); + goto exit_remove; + } + dev_info(&client->dev, "%s: '%s'\n", dev_name(Cameo_CPLD_30_data->hwmon_dev), client->name); + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &ESC602_SYS_group); + sysfs_remove_group(&client->dev.kobj, &ESC602_LED_group); + sysfs_remove_group(&client->dev.kobj, &ESC602_FAN_group); + sysfs_remove_group(&client->dev.kobj, &ESC602_THERMAL_group); + sysfs_remove_group(&client->dev.kobj, &ESC602_POWER_group); + sysfs_remove_group(&client->dev.kobj, &ESC602_QSFP_group); + +exit_free: + kfree(Cameo_CPLD_30_data); + +exit: + return status; +} + +static int Cameo_i2c_remove(struct i2c_client *client) +{ + struct Cameo_i2c_data *data = i2c_get_clientdata(client); + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &ESC602_SYS_group); + sysfs_remove_group(&client->dev.kobj, &ESC602_LED_group); + sysfs_remove_group(&client->dev.kobj, &ESC602_FAN_group); + sysfs_remove_group(&client->dev.kobj, &ESC602_THERMAL_group); + sysfs_remove_group(&client->dev.kobj, &ESC602_POWER_group); + sysfs_remove_group(&client->dev.kobj, &ESC602_QSFP_group); + + kfree(data); + return 0; +} + +static const struct i2c_device_id Cameo_i2c_id[] = +{ + { "Cameo_CPLD_30", 0 }, + {}, +}; +MODULE_DEVICE_TABLE(i2c, Cameo_i2c_id); + +static struct i2c_driver Cameo_i2c_driver = +{ + .class = I2C_CLASS_HWMON, + .driver = + { + .name = "ESC_602_i2c", + }, + .probe = Cameo_i2c_probe, + .remove = Cameo_i2c_remove, + .id_table = Cameo_i2c_id, + .address_list = normal_i2c, +}; + +/*For main Switch board*/ +static struct i2c_board_info Cameo_CPLD_30_info[] __initdata = +{ + { + I2C_BOARD_INFO("Cameo_CPLD_30", 0x30), + .platform_data = NULL, + }, +}; + +/*For QSFP Port 01 - 16*/ +static struct i2c_board_info Cameo_CPLD_31_info[] __initdata = +{ + { + I2C_BOARD_INFO("Cameo_CPLD_31", 0x31), + .platform_data = NULL, + }, +}; +/*For QSFP Port 17 - 32*/ +static struct i2c_board_info Cameo_CPLD_32_info[] __initdata = +{ + { + I2C_BOARD_INFO("Cameo_CPLD_32", 0x32), + .platform_data = NULL, + }, +}; +/*For Fan status*/ +static struct i2c_board_info Cameo_CPLD_23_info[] __initdata = +{ + { + I2C_BOARD_INFO("Cameo_CPLD_23", 0x23), + .platform_data = NULL, + }, +}; +/*For Power status*/ +static struct i2c_board_info Cameo_CPLD_35_info[] __initdata = +{ + { + I2C_BOARD_INFO("Cameo_CPLD_35", 0x35), + .platform_data = NULL, + }, +}; +/*For BMC Slave*/ +static struct i2c_board_info Cameo_BMC_14_info[] __initdata = +{ + { + I2C_BOARD_INFO("Cameo_BMC_14", 0x14), + .platform_data = NULL, + }, +}; + +static int __init Cameo_i2c_init(void) +{ + int ret; + int cmp; + char keyword[] = "SMBus I801"; + char buf1[128]; + struct i2c_adapter *i2c_adap; + struct file *fp; + mm_segment_t fs; + loff_t pos; + + printk("Open file...\n"); + fp = filp_open("/sys/class/i2c-dev/i2c-0/name", O_RDONLY , 0644); + if (IS_ERR(fp)) { + printk("Open file FAILED\n"); + return -1; + } + + fs = get_fs(); + set_fs(KERNEL_DS); + pos = 0; + vfs_read(fp, buf1, sizeof(buf1), &pos); + printk("Detect %s\n", buf1); + cmp = strncmp(keyword, buf1, sizeof(keyword)-1); + set_fs(fs); + + filp_close(fp, NULL); + + if(cmp == 0) + { + i2c_adap = i2c_get_adapter(0); + printk("SMBus I801 is at bus 0\n"); + } + else + { + i2c_adap = i2c_get_adapter(1); + printk("SMBus I801 is at bus 1\n"); + } + + if (i2c_adap == NULL) + { + printk("ERROR: i2c_get_adapter FAILED!\n"); + return -1; + } + Cameo_CPLD_30_client = i2c_new_device(i2c_adap, &Cameo_CPLD_30_info[0]); + Cameo_CPLD_31_client = i2c_new_device(i2c_adap, &Cameo_CPLD_31_info[0]); + Cameo_CPLD_32_client = i2c_new_device(i2c_adap, &Cameo_CPLD_32_info[0]); + Cameo_CPLD_23_client = i2c_new_device(i2c_adap, &Cameo_CPLD_23_info[0]); + Cameo_CPLD_35_client = i2c_new_device(i2c_adap, &Cameo_CPLD_35_info[0]); + Cameo_BMC_14_client = i2c_new_device(i2c_adap, &Cameo_BMC_14_info[0]); + + if (Cameo_CPLD_30_info == NULL || Cameo_CPLD_31_info == NULL || Cameo_CPLD_32_info == NULL + || Cameo_CPLD_23_info == NULL || Cameo_CPLD_35_info == NULL || Cameo_BMC_14_info == NULL) + { + printk("ERROR: i2c_new_device FAILED!\n"); + return -1; + } + + i2c_put_adapter(i2c_adap); + ret = i2c_add_driver(&Cameo_i2c_driver); + printk(KERN_ALERT "ESC602-32Q i2c Driver Version: %s\n", DRIVER_VERSION); + printk(KERN_ALERT "ESC602-32Q i2c Driver INSTALL SUCCESS\n"); + return ret; +} + +static void __exit Cameo_i2c_exit(void) +{ + i2c_unregister_device(Cameo_CPLD_30_client); + i2c_unregister_device(Cameo_CPLD_31_client); + i2c_unregister_device(Cameo_CPLD_32_client); + i2c_unregister_device(Cameo_CPLD_23_client); + i2c_unregister_device(Cameo_CPLD_35_client); + i2c_unregister_device(Cameo_BMC_14_client); + i2c_del_driver(&Cameo_i2c_driver); + printk(KERN_ALERT "ESC602-32Q i2c Driver UNINSTALL SUCCESS\n"); +} + +MODULE_AUTHOR("Cameo Inc."); +MODULE_DESCRIPTION("Cameo ESC602-32Q i2c Driver"); +MODULE_LICENSE("GPL"); +module_param(debug, int, 0); +MODULE_PARM_DESC(debug, "Enable debugging (0-1)"); + +module_init(Cameo_i2c_init); +module_exit(Cameo_i2c_exit); diff --git a/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q-common.h b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q-common.h new file mode 100644 index 0000000000..39e5ab15e9 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q-common.h @@ -0,0 +1,25 @@ +/* register offset define */ +#define ENABLE 1 +#define DISABLE 0 + +#define PASSED 1 +#define FAILED 0 + +#define TRUE 1 +#define FALSE 0 + +#define ABNORMAL 1 +#define NORMAL 0 + +#define BIT_0_MASK 0x01 +#define BIT_1_MASK 0x02 +#define BIT_2_MASK 0x04 +#define BIT_3_MASK 0x08 +#define BIT_4_MASK 0x10 +#define BIT_5_MASK 0x20 +#define BIT_6_MASK 0x40 +#define BIT_7_MASK 0x80 +/* end of register offset define */ + +int bmc_enable(void); +int read_8bit_temp(u8 sign,u8 value); \ No newline at end of file diff --git a/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q-fan.c b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q-fan.c new file mode 100644 index 0000000000..739165e1af --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q-fan.c @@ -0,0 +1,365 @@ +/* An hwmon driver for Cameo esc602-32Q Innovium i2c Module */ +#pragma GCC diagnostic ignored "-Wformat-zero-length" +#include "x86-64-cameo-esc602-32q.h" +#include "x86-64-cameo-esc602-32q-common.h" +#include "x86-64-cameo-esc602-32q-fan.h" + +/* extern i2c_client */ +extern struct i2c_client *Cameo_CPLD_23_client; //0x23 for Fan CPLD +extern struct i2c_client *Cameo_BMC_14_client; //0x14 for BMC slave +/* end of extern i2c_client */ + +/* implement i2c_function */ +ssize_t fan_ctrl_mode_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *data = i2c_get_clientdata(Cameo_BMC_14_client); + + mutex_lock(&data->update_lock); + sprintf(buf, ""); + if (attr->index == FANCTRL_MODE) + { + if( bmc_enable() == ENABLE) + { + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, FANCTRL_MODE_REG); + if(status == 0xff || status < 0) + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + else + { + sprintf(buf, "%s0x%x\n", buf, status); + } + } + else + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + } + mutex_unlock(&data->update_lock); + return sprintf(buf, "%s\n", buf); +} + +ssize_t fan_ctrl_rpm_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *data = i2c_get_clientdata(Cameo_BMC_14_client); + + mutex_lock(&data->update_lock); + sprintf(buf, ""); + if (attr->index == FANCTRL_RPM) + { + if( bmc_enable() == ENABLE) + { + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, FANCTRL_RPM_REG); + if(status == 0xff || status < 0) + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + else + { + sprintf(buf, "%s0x%x\n", buf, status); + } + } + else + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + } + mutex_unlock(&data->update_lock); + return sprintf(buf, "%s\n", buf); +} + +ssize_t fan_status_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + int result = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *Cameo_CPLD_23_data = i2c_get_clientdata(Cameo_CPLD_23_client); + struct Cameo_i2c_data *Cameo_BMC_14_data = i2c_get_clientdata(Cameo_BMC_14_client); + + sprintf(buf, ""); + if( bmc_enable() == ENABLE) + { + mutex_lock(&Cameo_BMC_14_data->update_lock); + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, BMC_FAN_STAT_REG); + mutex_unlock(&Cameo_BMC_14_data->update_lock); + } + else + { + mutex_lock(&Cameo_CPLD_23_data->update_lock); + status = i2c_smbus_read_byte_data(Cameo_CPLD_23_client, FAN_STAT_REG); + mutex_unlock(&Cameo_CPLD_23_data->update_lock); + } + + result = FAILED; + switch (attr->index) + { + case 1: + if(status & BIT_0_MASK) + { + result = PASSED; + } + break; + case 2: + if(status & BIT_1_MASK) + { + result = PASSED; + } + break; + case 3: + if(status & BIT_2_MASK) + { + result = PASSED; + } + break; + case 4: + if(status & BIT_3_MASK) + { + result = PASSED; + } + break; + case 5: + if(status & BIT_4_MASK) + { + result = PASSED; + } + break; + } + if(result != PASSED) + { + return sprintf(buf, "%s%d\n", buf, FAILED); + } + return sprintf(buf, "%s%d\n", buf, PASSED); +} + +ssize_t fan_present_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + int result = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *Cameo_CPLD_23_data = i2c_get_clientdata(Cameo_CPLD_23_client); + struct Cameo_i2c_data *Cameo_BMC_14_data = i2c_get_clientdata(Cameo_BMC_14_client); + + sprintf(buf, ""); + if( bmc_enable() == ENABLE) + { + mutex_lock(&Cameo_BMC_14_data->update_lock); + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, BMC_FAN_PRESENT_REG); + mutex_unlock(&Cameo_BMC_14_data->update_lock); + } + else + { + mutex_lock(&Cameo_CPLD_23_data->update_lock); + status = i2c_smbus_read_byte_data(Cameo_CPLD_23_client, FAN_PRESENT_REG); + mutex_unlock(&Cameo_CPLD_23_data->update_lock); + } + + result = FAILED; + switch (attr->index) + { + case 1: + if(status & BIT_0_MASK) + { + result = PASSED; + } + break; + case 2: + if(status & BIT_1_MASK) + { + result = PASSED; + } + break; + case 3: + if(status & BIT_2_MASK) + { + result = PASSED; + } + break; + case 4: + if(status & BIT_3_MASK) + { + result = PASSED; + } + break; + case 5: + if(status & BIT_4_MASK) + { + result = PASSED; + } + break; + } + if(result != PASSED) + { + return sprintf(buf, "%s%d\n", buf, FAILED); + } + return sprintf(buf, "%s%d\n", buf, PASSED); +} + +ssize_t fan_power_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + int result = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *Cameo_CPLD_23_data = i2c_get_clientdata(Cameo_CPLD_23_client); + struct Cameo_i2c_data *Cameo_BMC_14_data = i2c_get_clientdata(Cameo_BMC_14_client); + + sprintf(buf, ""); + if( bmc_enable() == ENABLE) + { + mutex_lock(&Cameo_BMC_14_data->update_lock); + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, BMC_FAN_POWER_REG); + mutex_unlock(&Cameo_BMC_14_data->update_lock); + } + else + { + mutex_lock(&Cameo_CPLD_23_data->update_lock); + status = i2c_smbus_read_byte_data(Cameo_CPLD_23_client, FAN_POWER_REG); + mutex_unlock(&Cameo_CPLD_23_data->update_lock); + } + + result = FAILED; + switch (attr->index) + { + case 1: + if(status & BIT_0_MASK) + { + result = PASSED; + } + break; + case 2: + if(status & BIT_1_MASK) + { + result = PASSED; + } + break; + case 3: + if(status & BIT_2_MASK) + { + result = PASSED; + } + break; + case 4: + if(status & BIT_3_MASK) + { + result = PASSED; + } + break; + case 5: + if(status & BIT_4_MASK) + { + result = PASSED; + } + break; + } + if(result != PASSED) + { + return sprintf(buf, "%s%d\n", buf, FAILED); + } + return sprintf(buf, "%s%d\n", buf, PASSED); +} + +ssize_t fan_rpm_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + int fan_location = 0; + int fan_offset = 0; + u16 fan_speed = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *target_client = NULL; + + sprintf(buf, ""); + if( bmc_enable() == ENABLE) + { + target_client = Cameo_BMC_14_client; + } + else + { + target_client = Cameo_CPLD_23_client; + } + + switch (attr->index) + { + case FAN1_FRONT_RPM: + fan_location = 0; + fan_offset = 0; + break; + case FAN2_FRONT_RPM: + fan_location = 0; + fan_offset = 1; + break; + case FAN3_FRONT_RPM: + fan_location = 0; + fan_offset = 2; + break; + case FAN4_FRONT_RPM: + fan_location = 0; + fan_offset = 3; + break; + case FAN5_FRONT_RPM: + fan_location = 0; + fan_offset = 4; + break; + case FAN1_REAR_RPM: + fan_location = 1; + fan_offset = 0; + break; + case FAN2_REAR_RPM: + fan_location = 1; + fan_offset = 1; + break; + case FAN3_REAR_RPM: + fan_location = 1; + fan_offset = 2; + break; + case FAN4_REAR_RPM: + fan_location = 1; + fan_offset = 3; + break; + case FAN5_REAR_RPM: + fan_location = 1; + fan_offset = 4; + break; + } + if(fan_location == 0) + { + // front fan of couple + // read high byte + status = i2c_smbus_read_byte_data(target_client, FAN_F_RPM_REG+(fan_offset*2)+1); + fan_speed = status; + if(status < 0 || status == 0xff) + { + fan_speed = 0; + } + // read low byte + status = i2c_smbus_read_byte_data(target_client, FAN_F_RPM_REG+(fan_offset*2)); + fan_speed = ((fan_speed<<8) + status)*30; + if(status < 0 || status == 0xff) + { + fan_speed = 0; + } + } + else + { + // rear fan of couple + // read high byte + status = i2c_smbus_read_byte_data(target_client, FAN_R_RPM_REG+(fan_offset*2)+1); + fan_speed = status; + if(status < 0 || status == 0xff) + { + fan_speed = 0; + } + // read low byte + status = i2c_smbus_read_byte_data(target_client, FAN_R_RPM_REG+(fan_offset*2)); + fan_speed = ((fan_speed<<8) + status)*30; + if(status < 0 || status == 0xff) + { + fan_speed = 0; + } + } + sprintf(buf, "%s%d\n", buf, fan_speed); + return sprintf(buf, "%s\n",buf); +} +/* end of implement i2c_function */ \ No newline at end of file diff --git a/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q-fan.h b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q-fan.h new file mode 100644 index 0000000000..66ffc93393 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q-fan.h @@ -0,0 +1,12 @@ +/* register offset define */ +#define FANCTRL_RPM_REG 0x1a +#define FANCTRL_MODE_REG 0x1b +#define FAN_STAT_REG 0x00 +#define FAN_POWER_REG 0x01 +#define FAN_PRESENT_REG 0x02 +#define BMC_FAN_STAT_REG 0x80 +#define BMC_FAN_POWER_REG 0x81 +#define BMC_FAN_PRESENT_REG 0x82 +#define FAN_F_RPM_REG 0xa0 +#define FAN_R_RPM_REG 0xb0 +/* end of register offset define */ \ No newline at end of file diff --git a/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q-led.c b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q-led.c new file mode 100644 index 0000000000..64e8537f54 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q-led.c @@ -0,0 +1,220 @@ +/* An hwmon driver for Cameo esc602-32Q Innovium i2c Module */ +#pragma GCC diagnostic ignored "-Wformat-zero-length" +#include "x86-64-cameo-esc602-32q.h" +#include "x86-64-cameo-esc602-32q-common.h" +#include "x86-64-cameo-esc602-32q-led.h" + +/* i2c_client Declaration */ +extern struct i2c_client *Cameo_CPLD_30_client; //0x30 for SYS CPLD +/* end of i2c_client Declaration */ + +/* implement i2c_function */ +ssize_t led_ctrl_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + int res = 0x1; + int i; + int led_a_status = 0; + int led_g_status = 0; + int led_b_status = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + status = i2c_smbus_read_byte_data(Cameo_CPLD_30_client, LED_CTRL_REG); + sprintf(buf, ""); + + for (i = 1; i <= 4; i++) + { + if ( i == attr->index) + { + if (status & res) + { + led_a_status = ENABLE; + } + else + { + led_a_status = DISABLE; + } + } + res = res << 1; + if( i == (attr->index + 1) ) + { + if (status & res) + { + led_g_status = ENABLE; + } + else + { + led_g_status = DISABLE; + } + } + res = res << 1; + } + res = 0x1; + + status = i2c_smbus_read_byte_data(Cameo_CPLD_30_client, LED_BLINK_REG); + for (i = 1; i <= 4; i++) + { + if ( i == attr->index) + { + if (status & res) + { + led_b_status = ENABLE; + } + else + { + led_b_status = DISABLE; + } + } + res = res << 1; + } + if(led_a_status == ENABLE && led_b_status == ENABLE) + { + sprintf(buf, "%s2\n", buf); + } + else if(led_a_status == ENABLE && led_b_status == DISABLE) + { + sprintf(buf, "%s1\n", buf); + } + else if(led_g_status == ENABLE && led_b_status == ENABLE) + { + sprintf(buf, "%s4\n", buf); + } + else if(led_g_status == ENABLE && led_b_status == DISABLE) + { + sprintf(buf, "%s3\n", buf); + } + else + { + sprintf(buf, "%s0\n", buf); + } + + return sprintf(buf, "%s", buf); +} + +ssize_t led_ctrl_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + int led_value = -EPERM; + int blk_value = -EPERM; + int result = -EPERM; + int offset = 0; + u16 i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *data = i2c_get_clientdata(Cameo_CPLD_30_client); + + mutex_lock(&data->update_lock); + led_value = i2c_smbus_read_byte_data(Cameo_CPLD_30_client, LED_CTRL_REG); + blk_value = i2c_smbus_read_byte_data(Cameo_CPLD_30_client, LED_BLINK_REG); + if (attr->index != 0) + { + i = simple_strtol(buf, NULL, 10); + if(attr->index == 1) + { + offset = 0; + } + else + { + offset = 2*((attr->index)-1); + } + switch(i) + { + case SWITCH_LED_OFF: //i=0 + led_value &= ~(0x03 << offset); + blk_value &= ~(1 << ((attr->index)-1)); + break; + case SWITCH_LED_A_N: //i=1 + led_value &= ~(0x03 << offset); + led_value |= (0x01 << offset); + blk_value &= ~(1 << ((attr->index)-1)); + break; + case SWITCH_LED_A_B: //i=2 + led_value &= ~(0x03 << offset); + led_value |= (0x01 << offset); + blk_value |= (1 << ((attr->index)-1)); + break; + case SWITCH_LED_G_N: //i=3 + led_value &= ~(0x03 << offset); + led_value |= (0x02 << offset); + blk_value &= ~(1 << ((attr->index)-1)); + break; + case SWITCH_LED_G_B: //i=4 + led_value &= ~(0x03 << offset); + led_value |= (0x02 << offset); + blk_value |= (1 << ((attr->index)-1)); + break; + default: + printk(KERN_ALERT "led_ctrl_set wrong Value\n"); + return count; + } + result = i2c_smbus_write_byte_data(Cameo_CPLD_30_client, LED_CTRL_REG, led_value); + result |= i2c_smbus_write_byte_data(Cameo_CPLD_30_client, LED_BLINK_REG, blk_value); + if (result < 0) + { + printk(KERN_ALERT "ERROR: led_ctrl_set FAILED!\n"); + } + } + mutex_unlock(&data->update_lock); + return count; +} + +ssize_t led_fiber_get(struct device *dev, struct device_attribute *da, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *data = i2c_get_clientdata(Cameo_CPLD_30_client); + + mutex_lock(&data->update_lock); + sprintf(buf, ""); + if (attr->index == LED_FIBER) + { + if (i2c_smbus_read_byte_data(Cameo_CPLD_30_client, LED_FIBER_REG) & BIT_0_MASK) + { + sprintf(buf, "%s%d\n", buf, ENABLE); + } + else + { + sprintf(buf, "%s%d\n", buf, DISABLE); + } + } + mutex_unlock(&data->update_lock); + return sprintf(buf, "%s\n", buf); +} +ssize_t led_fiber_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + int status = -EPERM; + int value = -EPERM; + int result = -EPERM; + int input; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *data = i2c_get_clientdata(Cameo_CPLD_30_client); + + mutex_lock(&data->update_lock); + status = i2c_smbus_read_byte_data(Cameo_CPLD_30_client, LED_CTRL_REG); + if (attr->index == LED_FIBER) + { + input = simple_strtol(buf, NULL, 10); + if (input == ENABLE) + { + value = status | LED_FIBER_ENABLE; + result = i2c_smbus_write_byte_data(Cameo_CPLD_30_client, LED_FIBER_REG, value); + if (result < 0) + { + printk(KERN_ALERT "ERROR: led_ctrl_set FAILED!\n"); + } + } + else if (input == DISABLE) + { + value = status & LED_FIBER_DISABLE; + result = i2c_smbus_write_byte_data(Cameo_CPLD_30_client, LED_FIBER_REG, value); + if (result < 0) + { + printk(KERN_ALERT "ERROR: led_ctrl_set FAILED!\n"); + } + } + else + { + printk(KERN_ALERT "led_ctrl_set wrong Value\n"); + } + } + mutex_unlock(&data->update_lock); + return count; +} +/* end of implement i2c_function */ \ No newline at end of file diff --git a/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q-led.h b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q-led.h new file mode 100644 index 0000000000..c07a246447 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q-led.h @@ -0,0 +1,12 @@ +/* register offset define */ +#define LED_CTRL_REG 0xa2 +#define LED_BLINK_REG 0xa3 +#define LED_FIBER_REG 0xa0 +#define LED_FIBER_ENABLE 0x01 +#define LED_FIBER_DISABLE 0xfe +#define SWITCH_LED_OFF 0 +#define SWITCH_LED_A_N 1 +#define SWITCH_LED_A_B 2 +#define SWITCH_LED_G_N 3 +#define SWITCH_LED_G_B 4 +/* end of register offset define */ \ No newline at end of file diff --git a/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q-power.c b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q-power.c new file mode 100644 index 0000000000..ae830e33fc --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q-power.c @@ -0,0 +1,650 @@ +/* An hwmon driver for Cameo esc602-32Q Innovium i2c Module */ +#pragma GCC diagnostic ignored "-Wformat-zero-length" +#include "x86-64-cameo-esc602-32q.h" +#include "x86-64-cameo-esc602-32q-common.h" +#include "x86-64-cameo-esc602-32q-power.h" + +/* extern i2c_client */ +extern struct i2c_client *Cameo_CPLD_35_client; //0x35 for Power CPLD +extern struct i2c_client *Cameo_BMC_14_client; //0x14 for BMC slave +/* end of extern i2c_client */ + +/* convert function */ +static int two_complement_to_int(u16 data, u8 valid_bit, int mask) +{ + u16 valid_data = data & mask; + bool is_negative = valid_data >> (valid_bit - 1); + + return is_negative ? (-(((~valid_data) & mask) + 1)) : valid_data; +} +/* end of convert function */ + +/* implement i2c_function */ +ssize_t psu_status_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + u32 result = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *Cameo_CPLD_35_data = i2c_get_clientdata(Cameo_CPLD_35_client); + struct Cameo_i2c_data *Cameo_BMC_14_data = i2c_get_clientdata(Cameo_BMC_14_client); + + sprintf(buf, ""); + if( bmc_enable() == ENABLE) + { + mutex_lock(&Cameo_BMC_14_data->update_lock); + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, BMC_PSU_STAT_REG); + mutex_unlock(&Cameo_BMC_14_data->update_lock); + } + else + { + mutex_lock(&Cameo_CPLD_35_data->update_lock); + status = i2c_smbus_read_byte_data(Cameo_CPLD_35_client, PSU_STAT_REG); + mutex_unlock(&Cameo_CPLD_35_data->update_lock); + } + + result = TRUE; + switch (attr->index) + { + case 1: + if(status & BIT_2_MASK) + { + result = FALSE; + } + break; + case 2: + if(status & BIT_3_MASK) + { + result = FALSE; + } + break; + } + if(result != TRUE) + { + return sprintf(buf, "%s%d\n", buf, FALSE); + } + return sprintf(buf, "%s%d\n", buf, TRUE); +} +ssize_t psu_present_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + u32 result = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *Cameo_CPLD_35_data = i2c_get_clientdata(Cameo_CPLD_35_client); + struct Cameo_i2c_data *Cameo_BMC_14_data = i2c_get_clientdata(Cameo_BMC_14_client); + + sprintf(buf, ""); + if( bmc_enable() == ENABLE) + { + mutex_lock(&Cameo_BMC_14_data->update_lock); + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, BMC_PSU_STAT_REG); + mutex_unlock(&Cameo_BMC_14_data->update_lock); + } + else + { + mutex_lock(&Cameo_CPLD_35_data->update_lock); + status = i2c_smbus_read_byte_data(Cameo_CPLD_35_client, PSU_STAT_REG); + mutex_unlock(&Cameo_CPLD_35_data->update_lock); + } + + result = FALSE; + switch (attr->index) + { + case 1: + if(status & BIT_0_MASK) + { + result = TRUE; + } + break; + case 2: + if(status & BIT_1_MASK) + { + result = TRUE; + } + break; + } + if(result != TRUE) + { + return sprintf(buf, "%s%d\n", buf, FALSE); + } + return sprintf(buf, "%s%d\n", buf, TRUE); +} +ssize_t psu_vin_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u32 result = -EPERM; + int exponent = 0, mantissa = 0; + int multiplier = 1000; + u16 u16_val = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + sprintf(buf, ""); + if( bmc_enable() == ENABLE) + { + switch(attr->index) + { + case PSU1_VIN: + u16_val = i2c_smbus_read_word_data(Cameo_BMC_14_client, PSU_1_VIN_REG); + break; + case PSU2_VIN: + u16_val = i2c_smbus_read_word_data(Cameo_BMC_14_client, PSU_2_VIN_REG); + break; + } + if(u16_val == 0xffff || u16_val == -1) + { + return sprintf(buf, "%s0\n", buf); + } + exponent = two_complement_to_int(u16_val >> 11, 5, 0x1f); + mantissa = two_complement_to_int(u16_val & 0x7ff, 11, 0x7ff); + multiplier = 1000; + result = (exponent >= 0) ? ((mantissa << exponent)*multiplier) : \ + (mantissa*multiplier / (1 << -exponent)); + sprintf(buf, "%s%d\n", buf, result); + } + else + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + return sprintf(buf, "%s\n", buf); +} +ssize_t psu_iin_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u32 result = -EPERM; + int exponent = 0, mantissa = 0; + int multiplier = 1000; + u16 u16_val = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + sprintf(buf, ""); + if( bmc_enable() == ENABLE) + { + switch(attr->index) + { + case PSU1_IIN: + u16_val = i2c_smbus_read_word_data(Cameo_BMC_14_client, PSU_1_IIN_REG); + break; + case PSU2_IIN: + u16_val = i2c_smbus_read_word_data(Cameo_BMC_14_client, PSU_2_IIN_REG); + break; + } + if(u16_val == 0xffff || u16_val == -1) + { + return sprintf(buf, "%s0\n", buf); + } + exponent = two_complement_to_int(u16_val >> 11, 5, 0x1f); + mantissa = two_complement_to_int(u16_val & 0x7ff, 11, 0x7ff); + multiplier = 1000; + result = (exponent >= 0) ? ((mantissa << exponent)*multiplier) : \ + (mantissa*multiplier / (1 << -exponent)); + sprintf(buf, "%s%d\n", buf, result); + } + else + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + return sprintf(buf, "%s\n", buf); +} +ssize_t psu_vout_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u32 result = -EPERM; + int exponent = 0; + int multiplier = 1000; + u16 u16_vmode = 0; + u16 u16_vout = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + sprintf(buf, ""); + if( bmc_enable() == ENABLE) + { + switch(attr->index) + { + case PSU1_VOUT: + u16_vmode = i2c_smbus_read_byte_data(Cameo_BMC_14_client, PSU_1_VOMDE_REG); + u16_vout = i2c_smbus_read_word_data(Cameo_BMC_14_client, PSU_1_VOUT_REG); + break; + case PSU2_VOUT: + u16_vmode = i2c_smbus_read_byte_data(Cameo_BMC_14_client, PSU_2_VOMDE_REG); + u16_vout = i2c_smbus_read_word_data(Cameo_BMC_14_client, PSU_2_VOUT_REG); + break; + } + if(u16_vout == 0xffff || u16_vout == -1) + { + return sprintf(buf, "%s0\n", buf); + } + /* vout mode */ + multiplier = 1000; + exponent = two_complement_to_int(u16_vmode & 0x1f, 5, 0x1f); + /* vout */ + result = (exponent >= 0) ? ((u16_vout << exponent)*multiplier) : \ + (u16_vout*multiplier / (1 << -exponent)); + sprintf(buf, "%s%d\n", buf, result); + } + else + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + return sprintf(buf, "%s\n", buf); +} + +ssize_t psu_iout_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u32 result = -EPERM; + int exponent = 0, mantissa = 0; + int multiplier = 1000; + u16 u16_val = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + sprintf(buf, ""); + if( bmc_enable() == ENABLE) + { + switch(attr->index) + { + case PSU1_IOUT: + u16_val = i2c_smbus_read_word_data(Cameo_BMC_14_client, PSU_1_IOUT_REG); + break; + case PSU2_IOUT: + u16_val = i2c_smbus_read_word_data(Cameo_BMC_14_client, PSU_2_IOUT_REG); + break; + } + if(u16_val == 0xffff || u16_val == -1) + { + return sprintf(buf, "%s0\n", buf); + } + exponent = two_complement_to_int(u16_val >> 11, 5, 0x1f); + mantissa = two_complement_to_int(u16_val & 0x7ff, 11, 0x7ff); + multiplier = 1000; + result = (exponent >= 0) ? ((mantissa << exponent)*multiplier) : \ + (mantissa*multiplier / (1 << -exponent)); + sprintf(buf, "%s%d\n", buf, result); + } + else + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + return sprintf(buf, "%s\n", buf); +} + +ssize_t psu_temp_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u16 result = -EPERM; + int exponent = 0, mantissa = 0; + int multiplier = 1000; + u16 u16_val = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + sprintf(buf, ""); + if( bmc_enable() == ENABLE) + { + switch(attr->index) + { + case PSU1_TEMP: + u16_val = i2c_smbus_read_word_data(Cameo_BMC_14_client, PSU_1_TEMP_1_REG); + break; + case PSU2_TEMP: + u16_val = i2c_smbus_read_word_data(Cameo_BMC_14_client, PSU_2_TEMP_1_REG); + break; + } + if(u16_val == 0xffff || u16_val == -1) + { + return sprintf(buf, "%s0\n", buf); + } + exponent = two_complement_to_int(u16_val >> 11, 5, 0x1f); + mantissa = two_complement_to_int(u16_val & 0x7ff, 11, 0x7ff); + multiplier = 1000; + result = (exponent >= 0) ? ((mantissa << exponent)*multiplier) : \ + (mantissa*multiplier / (1 << -exponent)); + sprintf(buf, "%s%d\n", buf, result); + } + else + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + return sprintf(buf, "%s\n", buf); +} + +ssize_t psu_fan_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u16 result = -EPERM; + int exponent = 0, mantissa = 0; + int multiplier = 1000; + u16 u16_val = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + sprintf(buf, ""); + if( bmc_enable() == ENABLE) + { + switch(attr->index) + { + case PSU1_FAN_SPEED: + u16_val = i2c_smbus_read_word_data(Cameo_BMC_14_client, PSU_1_FAN_SPEED_REG); + break; + case PSU2_FAN_SPEED: + u16_val = i2c_smbus_read_word_data(Cameo_BMC_14_client, PSU_2_FAN_SPEED_REG); + break; + } + if(u16_val == 0xffff || u16_val == -1) + { + return sprintf(buf, "%s0\n", buf); + } + exponent = two_complement_to_int(u16_val >> 11, 5, 0x1f); + mantissa = two_complement_to_int(u16_val & 0x7ff, 11, 0x7ff); + multiplier = 1; + result = (exponent >= 0) ? ((mantissa << exponent)*multiplier) : \ + (mantissa*multiplier / (1 << -exponent)); + sprintf(buf, "%s%d\n", buf, result); + } + else + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + return sprintf(buf, "%s\n", buf); +} + +ssize_t psu_pout_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u32 result = -EPERM; + int exponent = 0, mantissa = 0; + int multiplier = 1000; + u16 u16_val = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + sprintf(buf, ""); + if( bmc_enable() == ENABLE) + { + switch(attr->index) + { + case PSU1_POUT: + u16_val = i2c_smbus_read_word_data(Cameo_BMC_14_client, PSU_1_POUT_REG); + break; + case PSU2_POUT: + u16_val = i2c_smbus_read_word_data(Cameo_BMC_14_client, PSU_2_POUT_REG); + break; + } + if(u16_val == 0xffff || u16_val == -1) + { + return sprintf(buf, "%s0\n", buf); + } + exponent = two_complement_to_int(u16_val >> 11, 5, 0x1f); + mantissa = two_complement_to_int(u16_val & 0x7ff, 11, 0x7ff); + multiplier = 1000000; // lm-sensor unit: uW + result = (exponent >= 0) ? ((mantissa << exponent)*multiplier) : \ + (mantissa*multiplier / (1 << -exponent)); + sprintf(buf, "%s%d\n", buf, result); + } + else + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + return sprintf(buf, "%s\n", buf); +} + +ssize_t psu_pin_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u32 result = -EPERM; + int exponent = 0, mantissa = 0; + int multiplier = 1000; + u16 u16_val = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + sprintf(buf, ""); + if( bmc_enable() == ENABLE) + { + switch(attr->index) + { + case PSU1_PIN: + u16_val = i2c_smbus_read_word_data(Cameo_BMC_14_client, PSU_1_PIN_REG); + break; + case PSU2_PIN: + u16_val = i2c_smbus_read_word_data(Cameo_BMC_14_client, PSU_2_PIN_REG); + break; + } + if(u16_val == 0xffff || u16_val == -1) + { + return sprintf(buf, "%s0\n", buf); + } + exponent = two_complement_to_int(u16_val >> 11, 5, 0x1f); + mantissa = two_complement_to_int(u16_val & 0x7ff, 11, 0x7ff); + multiplier = 1000000; // lm-sensor unit: uW + result = (exponent >= 0) ? ((mantissa << exponent)*multiplier) : \ + (mantissa*multiplier / (1 << -exponent)); + sprintf(buf, "%s%d\n", buf, result); + } + else + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + return sprintf(buf, "%s\n", buf); +} + +ssize_t psu_mfr_model_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u16 u16_val = 0; + char model[2]; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + sprintf(buf, ""); + if( bmc_enable() == ENABLE) + { + switch(attr->index) + { + case PSU1_MFR_MODEL: + u16_val = i2c_smbus_read_word_data(Cameo_BMC_14_client, PSU_1_MFR_MODEL_REG); + break; + case PSU2_MFR_MODEL: + u16_val = i2c_smbus_read_word_data(Cameo_BMC_14_client, PSU_2_MFR_MODEL_REG); + break; + } + if(u16_val == 0xffff || u16_val == -1) + { + return sprintf(buf, "%s0\n", buf); + } + model[0] = u16_val >> 8; + model[1] = u16_val; + sprintf(buf, "%s%c%c\n", buf, model[0], model[1]); + } + else + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + return sprintf(buf, "%s\n", buf); +} + +ssize_t psu_iout_max_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u32 result = -EPERM; + int exponent = 0, mantissa = 0; + int multiplier = 1000; + u16 u16_val = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + sprintf(buf, ""); + if( bmc_enable() == ENABLE) + { + switch(attr->index) + { + case PSU1_MFR_IOUT_MAX: + u16_val = i2c_smbus_read_word_data(Cameo_BMC_14_client, PSU_1_MFR_IOUT_MAX_REG); + break; + case PSU2_MFR_IOUT_MAX: + u16_val = i2c_smbus_read_word_data(Cameo_BMC_14_client, PSU_2_MFR_IOUT_MAX_REG); + break; + } + if(u16_val == 0xffff || u16_val == -1) + { + return sprintf(buf, "%s0\n", buf); + } + exponent = two_complement_to_int(u16_val >> 11, 5, 0x1f); + mantissa = two_complement_to_int(u16_val & 0x7ff, 11, 0x7ff); + multiplier = 1000; // lm-sensor unit: uW + result = (exponent >= 0) ? ((mantissa << exponent)*multiplier) : \ + (mantissa*multiplier / (1 << -exponent)); + sprintf(buf, "%s%d\n", buf, result); + } + else + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + return sprintf(buf, "%s\n", buf); +} + +ssize_t psu_vmode_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u16 u16_vmode = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + sprintf(buf, ""); + if( bmc_enable() == ENABLE) + { + switch(attr->index) + { + case PSU1_VOMDE: + u16_vmode = i2c_smbus_read_byte_data(Cameo_BMC_14_client, PSU_1_VOMDE_REG); + break; + case PSU2_VOMDE: + u16_vmode = i2c_smbus_read_byte_data(Cameo_BMC_14_client, PSU_2_VOMDE_REG); + break; + } + if(u16_vmode == 0xffff || u16_vmode == -1) + { + return sprintf(buf, "%s0\n", buf); + } + /* vout mode */ + sprintf(buf, "%s%d\n", buf, u16_vmode); + } + else + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + return sprintf(buf, "%s\n", buf); +} + +ssize_t dc_vout_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u16 result = -EPERM; + int exponent = 0, mantissa = 0; + int multiplier = 1000; + u16 u16_val = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + sprintf(buf, ""); + if( bmc_enable() == ENABLE) + { + switch(attr->index) + { + case DC6E_P0_VOUT: + u16_val = i2c_smbus_read_word_data(Cameo_BMC_14_client, DC_CHIP_6E_P0_VOUT_REG); + break; + case DC6E_P1_VOUT: + u16_val = i2c_smbus_read_word_data(Cameo_BMC_14_client, DC_CHIP_6E_P1_VOUT_REG); + break; + case DC70_P0_VOUT: + u16_val = i2c_smbus_read_word_data(Cameo_BMC_14_client, DC_CHIP_70_P0_VOUT_REG); + break; + case DC70_P1_VOUT: + u16_val = i2c_smbus_read_word_data(Cameo_BMC_14_client, DC_CHIP_70_P1_VOUT_REG); + break; + } + if(u16_val == 0xffff || u16_val == -1) + { + return sprintf(buf, "%s0\n", buf); + } + exponent = two_complement_to_int(u16_val >> 11, 5, 0x1f); + mantissa = two_complement_to_int(u16_val & 0x7ff, 11, 0x7ff); + multiplier = 1000; + result = (exponent >= 0) ? ((mantissa << exponent)*multiplier) : \ + (mantissa*multiplier / (1 << -exponent)); + sprintf(buf, "%s%d\n", buf, result); + } + else + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + return sprintf(buf, "%s\n", buf); +} + +ssize_t dc_iout_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u16 result = -EPERM; + int exponent = 0, mantissa = 0; + int multiplier = 1000; + u16 u16_val = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + sprintf(buf, ""); + if( bmc_enable() == ENABLE) + { + switch(attr->index) + { + case DC6E_P0_IOUT: + u16_val = i2c_smbus_read_word_data(Cameo_BMC_14_client, DC_CHIP_6E_P0_IOUT_REG); + break; + case DC6E_P1_IOUT: + u16_val = i2c_smbus_read_word_data(Cameo_BMC_14_client, DC_CHIP_6E_P1_IOUT_REG); + break; + case DC70_P0_IOUT: + u16_val = i2c_smbus_read_word_data(Cameo_BMC_14_client, DC_CHIP_70_P0_IOUT_REG); + break; + case DC70_P1_IOUT: + u16_val = i2c_smbus_read_word_data(Cameo_BMC_14_client, DC_CHIP_70_P1_IOUT_REG); + break; + } + if(u16_val == 0xffff || u16_val == -1) + { + return sprintf(buf, "%s0\n", buf); + } + exponent = two_complement_to_int(u16_val >> 11, 5, 0x1f); + mantissa = two_complement_to_int(u16_val & 0x7ff, 11, 0x7ff); + multiplier = 1000; + result = (exponent >= 0) ? ((mantissa << exponent)*multiplier) : \ + (mantissa*multiplier / (1 << -exponent)); + sprintf(buf, "%s%d\n", buf, result); + } + else + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + return sprintf(buf, "%s\n", buf); +} + +ssize_t dc_pout_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u16 result = -EPERM; + int exponent = 0, mantissa = 0; + int multiplier = 1000; + u16 u16_val = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + sprintf(buf, ""); + if( bmc_enable() == ENABLE) + { + switch(attr->index) + { + case DC6E_P0_POUT: + u16_val = i2c_smbus_read_word_data(Cameo_BMC_14_client, DC_CHIP_6E_P0_POUT_REG); + break; + case DC6E_P1_POUT: + u16_val = i2c_smbus_read_word_data(Cameo_BMC_14_client, DC_CHIP_6E_P1_POUT_REG); + break; + case DC70_P0_POUT: + u16_val = i2c_smbus_read_word_data(Cameo_BMC_14_client, DC_CHIP_70_P0_POUT_REG); + break; + case DC70_P1_POUT: + u16_val = i2c_smbus_read_word_data(Cameo_BMC_14_client, DC_CHIP_70_P1_POUT_REG); + break; + } + if(u16_val == 0xffff || u16_val == -1) + { + return sprintf(buf, "%s0\n", buf); + } + exponent = two_complement_to_int(u16_val >> 11, 5, 0x1f); + mantissa = two_complement_to_int(u16_val & 0x7ff, 11, 0x7ff); + multiplier = 1000000; + result = (exponent >= 0) ? ((mantissa << exponent)*multiplier) : \ + (mantissa*multiplier / (1 << -exponent)); + sprintf(buf, "%s%d\n", buf, result); + } + else + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + return sprintf(buf, "%s\n", buf); +} +/* end of implement i2c_function */ \ No newline at end of file diff --git a/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q-power.h b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q-power.h new file mode 100644 index 0000000000..6164179b2a --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q-power.h @@ -0,0 +1,38 @@ +/* register offset define */ +#define PSU_STAT_REG 0xa0 +#define BMC_PSU_STAT_REG 0xc0 +#define PSU_1_VIN_REG 0x50 +#define PSU_1_IIN_REG 0x51 +#define PSU_1_VOUT_REG 0x52 +#define PSU_1_IOUT_REG 0x53 +#define PSU_1_TEMP_1_REG 0x54 +#define PSU_1_FAN_SPEED_REG 0x55 +#define PSU_1_POUT_REG 0x56 +#define PSU_1_PIN_REG 0x57 +#define PSU_1_MFR_MODEL_REG 0x58 +#define PSU_1_MFR_IOUT_MAX_REG 0x59 +#define PSU_1_VOMDE_REG 0x5a +#define PSU_2_VIN_REG 0x60 +#define PSU_2_IIN_REG 0x61 +#define PSU_2_VOUT_REG 0x62 +#define PSU_2_IOUT_REG 0x63 +#define PSU_2_TEMP_1_REG 0x64 +#define PSU_2_FAN_SPEED_REG 0x65 +#define PSU_2_POUT_REG 0x66 +#define PSU_2_PIN_REG 0x67 +#define PSU_2_MFR_MODEL_REG 0x68 +#define PSU_2_MFR_IOUT_MAX_REG 0x69 +#define PSU_2_VOMDE_REG 0x6a +#define DC_CHIP_6E_P0_VOUT_REG 0x90 +#define DC_CHIP_6E_P0_IOUT_REG 0x91 +#define DC_CHIP_6E_P0_POUT_REG 0x92 +#define DC_CHIP_6E_P1_VOUT_REG 0x94 +#define DC_CHIP_6E_P1_IOUT_REG 0x95 +#define DC_CHIP_6E_P1_POUT_REG 0x96 +#define DC_CHIP_70_P0_VOUT_REG 0x98 +#define DC_CHIP_70_P0_IOUT_REG 0x99 +#define DC_CHIP_70_P0_POUT_REG 0x9a +#define DC_CHIP_70_P1_VOUT_REG 0x9c +#define DC_CHIP_70_P1_IOUT_REG 0x9d +#define DC_CHIP_70_P1_POUT_REG 0x9e +/* end of register offset define */ \ No newline at end of file diff --git a/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q-qsfp.c b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q-qsfp.c new file mode 100644 index 0000000000..e09d3357eb --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q-qsfp.c @@ -0,0 +1,584 @@ +/* An hwmon driver for Cameo esc602-32Q Innovium i2c Module */ +#pragma GCC diagnostic ignored "-Wformat-zero-length" +#include "x86-64-cameo-esc602-32q.h" +#include "x86-64-cameo-esc602-32q-common.h" +#include "x86-64-cameo-esc602-32q-qsfp.h" + +/* i2c_client Declaration */ +extern struct i2c_client *Cameo_CPLD_31_client; //0x31 for Port 01-16 +extern struct i2c_client *Cameo_CPLD_32_client; //0x32 for Port 17-32 +/* end of i2c_client Declaration */ + +/* extern i2c_function */ +/* end of extern i2c_function */ + +/* implement i2c_function */ +ssize_t qsfp_low_power_all_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u32 result = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + if (attr->index == QSFP_LOW_POWER_ALL) + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_32_client, QSFP_REAR_LOW_POWER_REG); //25-32 + result = status; + status = i2c_smbus_read_byte_data(Cameo_CPLD_32_client, QSFP_FRONT_LOW_POWER_REG); //17-24 + result = (result << 8) | status; + status = i2c_smbus_read_byte_data(Cameo_CPLD_31_client, QSFP_REAR_LOW_POWER_REG); //9-16 + result = (result << 8) | status; + status = i2c_smbus_read_byte_data(Cameo_CPLD_31_client, QSFP_FRONT_LOW_POWER_REG); //1-8 + result = (result << 8) | status; + sprintf(buf, "%s0x%x\n", buf, result); + } + return sprintf(buf, "%s\n", buf); +} + +ssize_t qsfp_low_power_all_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + int value = 0x0; + int result = 0; + int input = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *Cameo_CPLD_31_data = i2c_get_clientdata(Cameo_CPLD_31_client); + struct Cameo_i2c_data *Cameo_CPLD_32_data = i2c_get_clientdata(Cameo_CPLD_32_client); + + mutex_lock(&Cameo_CPLD_31_data->update_lock); + mutex_lock(&Cameo_CPLD_32_data->update_lock); + if (attr->index == QSFP_LOW_POWER_ALL) + { + input = simple_strtol(buf, NULL, 10); + if (input == ENABLE) + { + value = 0xff; + } + else if(input == DISABLE) + { + value = 0x00; + } + else + { + printk(KERN_ALERT "qsfp_low_power_all_set wrong value\n"); + return count; + } + result += i2c_smbus_write_byte_data(Cameo_CPLD_31_client, QSFP_FRONT_LOW_POWER_REG, value); + result += i2c_smbus_write_byte_data(Cameo_CPLD_31_client, QSFP_REAR_LOW_POWER_REG, value); + result += i2c_smbus_write_byte_data(Cameo_CPLD_32_client, QSFP_FRONT_LOW_POWER_REG, value); + result += i2c_smbus_write_byte_data(Cameo_CPLD_32_client, QSFP_REAR_LOW_POWER_REG, value); + + if(result != 0) + { + printk(KERN_ALERT "qsfp_low_power_all_set FAILED\n"); + return count; + } + } + mutex_unlock(&Cameo_CPLD_31_data->update_lock); + mutex_unlock(&Cameo_CPLD_32_data->update_lock); + return count; +} + +ssize_t qsfp_low_power_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + int port_index = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + port_index = attr->index; + sprintf(buf, ""); + + if (port_index >= 1 && port_index <= 16) + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_31_client, qsfp_low_power_regs[port_index][0]); + } + else if (port_index >= 17 && port_index <= 32) + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_32_client, qsfp_low_power_regs[port_index][0]); + } + + if (status & qsfp_low_power_regs[port_index][1]) + { + sprintf(buf, "%s%d\n", buf, ENABLE); + } + else + { + sprintf(buf, "%s%d\n", buf, DISABLE); + } + + return sprintf(buf, "%s\n", buf); +} + +ssize_t qsfp_low_power_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + int status = -EPERM; + int result = 0; + int input = 0; + int port_index = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *Cameo_CPLD_31_data = i2c_get_clientdata(Cameo_CPLD_31_client); + struct Cameo_i2c_data *Cameo_CPLD_32_data = i2c_get_clientdata(Cameo_CPLD_32_client); + struct i2c_client *target_client = NULL; + + port_index = attr->index; + input = simple_strtol(buf, NULL, 10); + mutex_lock(&Cameo_CPLD_31_data->update_lock); + mutex_lock(&Cameo_CPLD_32_data->update_lock); + + if (port_index >= 1 && port_index <= 16) + { + target_client = Cameo_CPLD_31_client; + + } + else if (port_index >= 17 && port_index <= 32) + { + target_client = Cameo_CPLD_32_client; + } + + status = i2c_smbus_read_byte_data(target_client, qsfp_low_power_regs[port_index][0]); + if( input == ENABLE) + { + status |= qsfp_low_power_regs[port_index][1]; + result = i2c_smbus_write_byte_data(target_client, qsfp_low_power_regs[port_index][0], status); + if (result < 0) + { + printk(KERN_ALERT "ERROR: qsfp_low_power_set ON FAILED!\n"); + } + } + else if( input == DISABLE) + { + status &= ~(qsfp_low_power_regs[port_index][1]); + result = i2c_smbus_write_byte_data(target_client, qsfp_low_power_regs[port_index][0], status); + if (result < 0) + { + printk(KERN_ALERT "ERROR: qsfp_low_power_set OFF FAILED!\n"); + } + } + else + { + printk(KERN_ALERT "ERROR: qsfp_low_power_set WRONG VALUE\n"); + } + + mutex_unlock(&Cameo_CPLD_31_data->update_lock); + mutex_unlock(&Cameo_CPLD_32_data->update_lock); + + return count; +} + +ssize_t qsfp_reset_all_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + int value = 0x0; + int result = 0; + int input = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *Cameo_CPLD_31_data = i2c_get_clientdata(Cameo_CPLD_31_client); + struct Cameo_i2c_data *Cameo_CPLD_32_data = i2c_get_clientdata(Cameo_CPLD_32_client); + + mutex_lock(&Cameo_CPLD_31_data->update_lock); + mutex_lock(&Cameo_CPLD_32_data->update_lock); + if (attr->index == QSFP_RESET_ALL) + { + input = simple_strtol(buf, NULL, 10); + if (input == QSFP_RESET) + { + value = 0x00; + } + else + { + printk(KERN_ALERT "qsfp_reset_all_set wrong value\n"); + return count; + } + result += i2c_smbus_write_byte_data(Cameo_CPLD_31_client, QSFP_FRONT_RESET_REG, value); + result += i2c_smbus_write_byte_data(Cameo_CPLD_31_client, QSFP_REAR_RESET_REG, value); + result += i2c_smbus_write_byte_data(Cameo_CPLD_32_client, QSFP_FRONT_RESET_REG, value); + result += i2c_smbus_write_byte_data(Cameo_CPLD_32_client, QSFP_REAR_RESET_REG, value); + + if(result != 0) + { + printk(KERN_ALERT "qsfp_reset_all_set FAILED\n"); + return count; + } + } + mutex_unlock(&Cameo_CPLD_31_data->update_lock); + mutex_unlock(&Cameo_CPLD_32_data->update_lock); + return count; +} + +ssize_t qsfp_reset_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + int status = -EPERM; + int result = 0; + int input = 0; + int port_index = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *Cameo_CPLD_31_data = i2c_get_clientdata(Cameo_CPLD_31_client); + struct Cameo_i2c_data *Cameo_CPLD_32_data = i2c_get_clientdata(Cameo_CPLD_32_client); + struct i2c_client *target_client = NULL; + + port_index = attr->index; + input = simple_strtol(buf, NULL, 10); + mutex_lock(&Cameo_CPLD_31_data->update_lock); + mutex_lock(&Cameo_CPLD_32_data->update_lock); + + if (port_index >= 1 && port_index <= 16) + { + target_client = Cameo_CPLD_31_client; + + } + else if (port_index >= 17 && port_index <= 32) + { + target_client = Cameo_CPLD_32_client; + } + + status = i2c_smbus_read_byte_data(target_client, qsfp_reset_regs[port_index][0]); + if( input == QSFP_RESET) + { + status |= qsfp_reset_regs[port_index][1]; + result = i2c_smbus_write_byte_data(target_client, qsfp_reset_regs[port_index][0], status); + if (result < 0) + { + printk(KERN_ALERT "ERROR: qsfp_reset_set FAILED!\n"); + } + } + else + { + printk(KERN_ALERT "ERROR: qsfp_reset_set WRONG VALUE\n"); + } + + mutex_unlock(&Cameo_CPLD_31_data->update_lock); + mutex_unlock(&Cameo_CPLD_32_data->update_lock); + + return count; +} + +ssize_t qsfp_present_all_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u32 result = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + if (attr->index == QSFP_PRESENT_ALL) + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_32_client, QSFP_REAR_PRESENT_REG); //25-32 + result = status; + status = i2c_smbus_read_byte_data(Cameo_CPLD_32_client, QSFP_FRONT_PRESENT_REG); //17-24 + result = (result << 8) | status; + status = i2c_smbus_read_byte_data(Cameo_CPLD_31_client, QSFP_REAR_PRESENT_REG); //9-16 + result = (result << 8) | status; + status = i2c_smbus_read_byte_data(Cameo_CPLD_31_client, QSFP_FRONT_PRESENT_REG); //1-8 + result = (result << 8) | status; + result = ~(result); + sprintf(buf, "%s0x%x\n", buf, result); + } + return sprintf(buf, "%s\n", buf); +} + +ssize_t qsfp_present_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + int port_index = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + port_index = attr->index; + sprintf(buf, ""); + + if (port_index >= 1 && port_index <= 16) + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_31_client, qsfp_present_regs[port_index][0]); + } + else if (port_index >= 17 && port_index <= 32) + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_32_client, qsfp_present_regs[port_index][0]); + } + + if (status & qsfp_present_regs[port_index][1]) + { + sprintf(buf, "%s%d\n", buf, DISABLE); + } + else + { + sprintf(buf, "%s%d\n", buf, ENABLE); + } + + return sprintf(buf, "%s\n", buf); +} +ssize_t qsfp_int_all_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u32 result = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + if (attr->index == QSFP_INT_ALL) + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_32_client, QSFP_REAR_INT_REG); //25-32 + result = status; + status = i2c_smbus_read_byte_data(Cameo_CPLD_32_client, QSFP_FRONT_INT_REG); //17-24 + result = (result << 8) | status; + status = i2c_smbus_read_byte_data(Cameo_CPLD_31_client, QSFP_REAR_INT_REG); //9-16 + result = (result << 8) | status; + status = i2c_smbus_read_byte_data(Cameo_CPLD_31_client, QSFP_FRONT_INT_REG); //1-8 + result = (result << 8) | status; + sprintf(buf, "%s0x%x\n", buf, result); + } + return sprintf(buf, "%s\n", buf); +} +ssize_t qsfp_int_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + int port_index = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + port_index = attr->index; + sprintf(buf, ""); + + if (port_index >= 1 && port_index <= 16) + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_31_client, qsfp_int_regs[port_index][0]); + } + else if (port_index >= 17 && port_index <= 32) + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_32_client, qsfp_int_regs[port_index][0]); + } + + if (status & qsfp_int_regs[port_index][1]) + { + sprintf(buf, "%s%d\n", buf, ENABLE); + } + else + { + sprintf(buf, "%s%d\n", buf, DISABLE); + } + + return sprintf(buf, "%s\n", buf); +} + +ssize_t qsfp_quter_int_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + int quter_index = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + quter_index = attr->index; + sprintf(buf, ""); + + if (quter_index >= 1 && quter_index <= 2) + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_31_client, qsfp_quter_int_regs[quter_index][0]); + } + else if (quter_index >= 3 && quter_index <= 4) + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_32_client, qsfp_quter_int_regs[quter_index][0]); + } + + if (status & qsfp_quter_int_regs[quter_index][1]) + { + sprintf(buf, "%s%d\n", buf, NORMAL); + } + else + { + sprintf(buf, "%s%d\n", buf, ABNORMAL); + } + + return sprintf(buf, "%s\n", buf); +} + +ssize_t qsfp_quter_int_mask_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + int quter_index = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + quter_index = attr->index; + sprintf(buf, ""); + + if (quter_index >= 1 && quter_index <= 2) + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_31_client, qsfp_quter_int_mask_regs[quter_index][0]); + } + else if (quter_index >= 3 && quter_index <= 4) + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_32_client, qsfp_quter_int_mask_regs[quter_index][0]); + } + + if (status & qsfp_quter_int_mask_regs[quter_index][1]) + { + sprintf(buf, "%s%d\n", buf, DISABLE); + } + else + { + sprintf(buf, "%s%d\n", buf, ENABLE); + } + + return sprintf(buf, "%s\n", buf); +} + +ssize_t qsfp_quter_int_mask_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + int status = -EPERM; + int result = 0; + int input = 0; + int quter_index = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *Cameo_CPLD_31_data = i2c_get_clientdata(Cameo_CPLD_31_client); + struct Cameo_i2c_data *Cameo_CPLD_32_data = i2c_get_clientdata(Cameo_CPLD_32_client); + struct i2c_client *target_client = NULL; + + quter_index = attr->index; + input = simple_strtol(buf, NULL, 10); + mutex_lock(&Cameo_CPLD_31_data->update_lock); + mutex_lock(&Cameo_CPLD_32_data->update_lock); + + if (quter_index >= 1 && quter_index <= 2) + { + target_client = Cameo_CPLD_31_client; + + } + else if (quter_index >= 3 && quter_index <= 4) + { + target_client = Cameo_CPLD_32_client; + } + + status = i2c_smbus_read_byte_data(target_client, qsfp_quter_int_mask_regs[quter_index][0]); + if( input == DISABLE) + { + status |= qsfp_quter_int_mask_regs[quter_index][1]; + result = i2c_smbus_write_byte_data(target_client, qsfp_quter_int_mask_regs[quter_index][0], status); + if (result < 0) + { + printk(KERN_ALERT "ERROR: qsfp_quter_int_mask_set ON FAILED!\n"); + } + } + else if( input == ENABLE) + { + status &= ~(qsfp_quter_int_mask_regs[quter_index][1]); + result = i2c_smbus_write_byte_data(target_client, qsfp_quter_int_mask_regs[quter_index][0], status); + if (result < 0) + { + printk(KERN_ALERT "ERROR: qsfp_quter_int_mask_set OFF FAILED!\n"); + } + } + else + { + printk(KERN_ALERT "ERROR: qsfp_quter_int_mask_set WRONG VALUE\n"); + } + + mutex_unlock(&Cameo_CPLD_31_data->update_lock); + mutex_unlock(&Cameo_CPLD_32_data->update_lock); + + return count; +} + +ssize_t qsfp_modprs_int_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + int quter_index = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + quter_index = attr->index; + sprintf(buf, ""); + + if (quter_index >= 1 && quter_index <= 2) + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_31_client, qsfp_modprs_int_regs[quter_index][0]); + } + else if (quter_index >= 3 && quter_index <= 4) + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_32_client, qsfp_modprs_int_regs[quter_index][0]); + } + + if (status & qsfp_modprs_int_regs[quter_index][1]) + { + sprintf(buf, "%s%d\n", buf, NORMAL); + } + else + { + sprintf(buf, "%s%d\n", buf, ABNORMAL); + } + + return sprintf(buf, "%s\n", buf); +} + +ssize_t qsfp_modprs_int_mask_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + int quter_index = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + quter_index = attr->index; + sprintf(buf, ""); + + if (quter_index >= 1 && quter_index <= 2) + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_31_client, qsfp_modprs_int_mask_regs[quter_index][0]); + } + else if (quter_index >= 3 && quter_index <= 4) + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_32_client, qsfp_modprs_int_mask_regs[quter_index][0]); + } + + if (status & qsfp_modprs_int_mask_regs[quter_index][1]) + { + sprintf(buf, "%s%d\n", buf, DISABLE); + } + else + { + sprintf(buf, "%s%d\n", buf, ENABLE); + } + + return sprintf(buf, "%s\n", buf); +} + +ssize_t qsfp_modprs_int_mask_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + int status = -EPERM; + int result = 0; + int input = 0; + int quter_index = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *Cameo_CPLD_31_data = i2c_get_clientdata(Cameo_CPLD_31_client); + struct Cameo_i2c_data *Cameo_CPLD_32_data = i2c_get_clientdata(Cameo_CPLD_32_client); + struct i2c_client *target_client = NULL; + + quter_index = attr->index; + input = simple_strtol(buf, NULL, 10); + mutex_lock(&Cameo_CPLD_31_data->update_lock); + mutex_lock(&Cameo_CPLD_32_data->update_lock); + + if (quter_index >= 1 && quter_index <= 2) + { + target_client = Cameo_CPLD_31_client; + + } + else if (quter_index >= 3 && quter_index <= 4) + { + target_client = Cameo_CPLD_32_client; + } + + status = i2c_smbus_read_byte_data(target_client, qsfp_modprs_int_mask_regs[quter_index][0]); + if( input == DISABLE) + { + status |= qsfp_modprs_int_mask_regs[quter_index][1]; + result = i2c_smbus_write_byte_data(target_client, qsfp_modprs_int_mask_regs[quter_index][0], status); + if (result < 0) + { + printk(KERN_ALERT "ERROR: qsfp_modprs_int_mask_set ON FAILED!\n"); + } + } + else if( input == ENABLE) + { + status &= ~(qsfp_modprs_int_mask_regs[quter_index][1]); + result = i2c_smbus_write_byte_data(target_client, qsfp_modprs_int_mask_regs[quter_index][0], status); + if (result < 0) + { + printk(KERN_ALERT "ERROR: qsfp_modprs_int_mask_set OFF FAILED!\n"); + } + } + else + { + printk(KERN_ALERT "ERROR: qsfp_modprs_int_mask_set WRONG VALUE\n"); + } + + mutex_unlock(&Cameo_CPLD_31_data->update_lock); + mutex_unlock(&Cameo_CPLD_32_data->update_lock); + + return count; +} +/* end of implement i2c_function */ \ No newline at end of file diff --git a/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q-qsfp.h b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q-qsfp.h new file mode 100644 index 0000000000..a1deb8f3d7 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q-qsfp.h @@ -0,0 +1,187 @@ +/* register offset define */ +#define QSFP_FRONT_LOW_POWER_REG 0x60 +#define QSFP_REAR_LOW_POWER_REG 0x61 +#define QSFP_FRONT_RESET_REG 0x70 +#define QSFP_REAR_RESET_REG 0x71 +#define QSFP_FRONT_PRESENT_REG 0x80 +#define QSFP_REAR_PRESENT_REG 0x81 +#define QSFP_FRONT_INT_REG 0x90 +#define QSFP_REAR_INT_REG 0x91 +#define QSFP_RESET 1 + +unsigned char qsfp_low_power_regs[33][2] = { + {0x00, 0x00}, //cpld offset, bit mask + {0x60, 0x01}, + {0x60, 0x02}, + {0x60, 0x04}, + {0x60, 0x08}, + {0x60, 0x10}, + {0x60, 0x20}, + {0x60, 0x40}, + {0x60, 0x80}, + {0x61, 0x01}, + {0x61, 0x02}, + {0x61, 0x04}, + {0x61, 0x08}, + {0x61, 0x10}, + {0x61, 0x20}, + {0x61, 0x40}, + {0x61, 0x80}, + {0x60, 0x01}, + {0x60, 0x02}, + {0x60, 0x04}, + {0x60, 0x08}, + {0x60, 0x10}, + {0x60, 0x20}, + {0x60, 0x40}, + {0x60, 0x80}, + {0x61, 0x01}, + {0x61, 0x02}, + {0x61, 0x04}, + {0x61, 0x08}, + {0x61, 0x10}, + {0x61, 0x20}, + {0x61, 0x40}, + {0x61, 0x80} +}; + +unsigned char qsfp_reset_regs[33][2] = { + {0x00, 0x00}, //cpld offset, bit mask + {0x70, 0x01}, + {0x70, 0x02}, + {0x70, 0x04}, + {0x70, 0x08}, + {0x70, 0x10}, + {0x70, 0x20}, + {0x70, 0x40}, + {0x70, 0x80}, + {0x71, 0x01}, + {0x71, 0x02}, + {0x71, 0x04}, + {0x71, 0x08}, + {0x71, 0x10}, + {0x71, 0x20}, + {0x71, 0x40}, + {0x71, 0x80}, + {0x70, 0x01}, + {0x70, 0x02}, + {0x70, 0x04}, + {0x70, 0x08}, + {0x70, 0x10}, + {0x70, 0x20}, + {0x70, 0x40}, + {0x70, 0x80}, + {0x71, 0x01}, + {0x71, 0x02}, + {0x71, 0x04}, + {0x71, 0x08}, + {0x71, 0x10}, + {0x71, 0x20}, + {0x71, 0x40}, + {0x71, 0x80} +}; + +unsigned char qsfp_present_regs[33][2] = { + {0x00, 0x00}, //cpld offset, bit mask + {0x80, 0x01}, + {0x80, 0x02}, + {0x80, 0x04}, + {0x80, 0x08}, + {0x80, 0x10}, + {0x80, 0x20}, + {0x80, 0x40}, + {0x80, 0x80}, + {0x81, 0x01}, + {0x81, 0x02}, + {0x81, 0x04}, + {0x81, 0x08}, + {0x81, 0x10}, + {0x81, 0x20}, + {0x81, 0x40}, + {0x81, 0x80}, + {0x80, 0x01}, + {0x80, 0x02}, + {0x80, 0x04}, + {0x80, 0x08}, + {0x80, 0x10}, + {0x80, 0x20}, + {0x80, 0x40}, + {0x80, 0x80}, + {0x81, 0x01}, + {0x81, 0x02}, + {0x81, 0x04}, + {0x81, 0x08}, + {0x81, 0x10}, + {0x81, 0x20}, + {0x81, 0x40}, + {0x81, 0x80} +}; + +unsigned char qsfp_int_regs[33][2] = { + {0x00, 0x00}, //cpld offset, bit mask + {0x90, 0x01}, + {0x90, 0x02}, + {0x90, 0x04}, + {0x90, 0x08}, + {0x90, 0x10}, + {0x90, 0x20}, + {0x90, 0x40}, + {0x90, 0x80}, + {0x91, 0x01}, + {0x91, 0x02}, + {0x91, 0x04}, + {0x91, 0x08}, + {0x91, 0x10}, + {0x91, 0x20}, + {0x91, 0x40}, + {0x91, 0x80}, + {0x90, 0x01}, + {0x90, 0x02}, + {0x90, 0x04}, + {0x90, 0x08}, + {0x90, 0x10}, + {0x90, 0x20}, + {0x90, 0x40}, + {0x90, 0x80}, + {0x91, 0x01}, + {0x91, 0x02}, + {0x91, 0x04}, + {0x91, 0x08}, + {0x91, 0x10}, + {0x91, 0x20}, + {0x91, 0x40}, + {0x91, 0x80} +}; + +unsigned char qsfp_quter_int_regs[5][2] = { + {0x00, 0x00}, //cpld offset, bit mask + {0xd0, 0x04}, + {0xd0, 0x08}, + {0xd0, 0x04}, + {0xd0, 0x08} +}; + +unsigned char qsfp_quter_int_mask_regs[5][2] = { + {0x00, 0x00}, //cpld offset, bit mask + {0xd1, 0x04}, + {0xd1, 0x08}, + {0xd1, 0x04}, + {0xd1, 0x08} +}; + +unsigned char qsfp_modprs_int_regs[5][2] = { + {0x00, 0x00}, //cpld offset, bit mask + {0xd0, 0x01}, + {0xd0, 0x02}, + {0xd0, 0x01}, + {0xd0, 0x02} +}; + +unsigned char qsfp_modprs_int_mask_regs[5][2] = { + {0x00, 0x00}, //cpld offset, bit mask + {0xd1, 0x01}, + {0xd1, 0x02}, + {0xd1, 0x01}, + {0xd1, 0x02} +}; +/* end of register offset define */ \ No newline at end of file diff --git a/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q-sys.c b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q-sys.c new file mode 100644 index 0000000000..0556a5377b --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q-sys.c @@ -0,0 +1,785 @@ +/* An hwmon driver for Cameo esc602-32Q Innovium i2c Module */ +#pragma GCC diagnostic ignored "-Wformat-zero-length" +#include "x86-64-cameo-esc602-32q.h" +#include "x86-64-cameo-esc602-32q-common.h" +#include "x86-64-cameo-esc602-32q-sys.h" + +/* extern i2c_client */ +extern struct i2c_client *Cameo_CPLD_30_client; //0x30 for SYS CPLD +extern struct i2c_client *Cameo_CPLD_31_client; //0x31 for Port 01-16 +extern struct i2c_client *Cameo_CPLD_32_client; //0x32 for Port 17-32 +extern struct i2c_client *Cameo_CPLD_23_client; //0x23 for Fan CPLD +extern struct i2c_client *Cameo_BMC_14_client; //0x14 for BMC slave +/* end of extern i2c_client */ + +/* implement i2c_function */ +ssize_t cpld_hw_ver_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *data = i2c_get_clientdata(Cameo_CPLD_30_client); + + mutex_lock(&data->update_lock); + sprintf(buf, ""); + switch (attr->index) + { + case 23: + if( bmc_enable() == ENABLE) + { + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, 0xff); + } + else + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_23_client, CPLD_VER_REG); + } + case 30: + status = i2c_smbus_read_byte_data(Cameo_CPLD_30_client, CPLD_VER_REG); + case 31: + status = i2c_smbus_read_byte_data(Cameo_CPLD_31_client, CPLD_VER_REG); + case 32: + status = i2c_smbus_read_byte_data(Cameo_CPLD_32_client, CPLD_VER_REG); + } + if(status < 0) + { + mutex_unlock(&data->update_lock); + return status; + } + else + { + mutex_unlock(&data->update_lock); + sprintf(buf, "%s0x%x\n", buf, status); + } + return sprintf(buf, "%s\n", buf); +} + +ssize_t wdt_enable_get(struct device *dev, struct device_attribute *da, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *data = i2c_get_clientdata(Cameo_CPLD_30_client); + + mutex_lock(&data->update_lock); + sprintf(buf, ""); + if (attr->index == WDT_EN) + { + if (i2c_smbus_read_byte_data(Cameo_CPLD_30_client, WDT_EN_REG) & BIT_4_MASK) + { + sprintf(buf, "%s%d\n", buf, ENABLE); + } + else + { + sprintf(buf, "%s%d\n", buf, DISABLE); + } + } + mutex_unlock(&data->update_lock); + return sprintf(buf, "%s\n", buf); +} + +ssize_t wdt_enable_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + int status = -EPERM; + int value = -EPERM; + int result = -EPERM; + int input; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *data = i2c_get_clientdata(Cameo_CPLD_30_client); + + mutex_lock(&data->update_lock); + status = i2c_smbus_read_byte_data(Cameo_CPLD_30_client, WDT_EN_REG); + if (attr->index == WDT_EN) + { + input = simple_strtol(buf, NULL, 10); + if (input == ENABLE) + { + value = status | WDT_EN_ENABLE; + result = i2c_smbus_write_byte_data(Cameo_CPLD_30_client, WDT_EN_REG, value); + if (result < 0) + { + printk(KERN_ALERT "ERROR: wdt_enable_set FAILED!\n"); + } + } + else if (input == DISABLE) + { + value = status & WDT_EN_DISABLE; + result = i2c_smbus_write_byte_data(Cameo_CPLD_30_client, WDT_EN_REG, value); + if (result < 0) + { + printk(KERN_ALERT "ERROR: wdt_enable_set FAILED!\n"); + } + } + else + { + printk(KERN_ALERT "wdt_enable_set wrong Value\n"); + } + } + mutex_unlock(&data->update_lock); + return count; +} + +ssize_t eeprom_wp_get(struct device *dev, struct device_attribute *da, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *data = i2c_get_clientdata(Cameo_CPLD_30_client); + + mutex_lock(&data->update_lock); + sprintf(buf, ""); + if (attr->index == EEPROM_WP) + { + if (i2c_smbus_read_byte_data(Cameo_CPLD_30_client, EEPROM_WP_REG) & BIT_2_MASK) + { + sprintf(buf, "%s%d\n", buf, ENABLE); + } + else + { + sprintf(buf, "%s%d\n", buf, DISABLE); + } + } + mutex_unlock(&data->update_lock); + return sprintf(buf, "%s\n", buf); +} + +ssize_t eeprom_wp_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + int status = -EPERM; + int value = -EPERM; + int result = -EPERM; + int input; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *data = i2c_get_clientdata(Cameo_CPLD_30_client); + + mutex_lock(&data->update_lock); + status = i2c_smbus_read_byte_data(Cameo_CPLD_30_client, EEPROM_WP_REG); + if (attr->index == EEPROM_WP) + { + input = simple_strtol(buf, NULL, 10); + if (input == ENABLE) + { + value = status | EEPROM_WP_ENABLE; + result = i2c_smbus_write_byte_data(Cameo_CPLD_30_client, EEPROM_WP_REG, value); + if (result < 0) + { + printk(KERN_ALERT "ERROR: eeprom_wp_set FAILED!\n"); + } + } + else if (input == DISABLE) + { + value = status & EEPROM_WP_DISABLE; + result = i2c_smbus_write_byte_data(Cameo_CPLD_30_client, EEPROM_WP_REG, value); + if (result < 0) + { + printk(KERN_ALERT "ERROR: eeprom_wp_set FAILED!\n"); + } + } + else + { + printk(KERN_ALERT "eeprom_wp_set wrong Value\n"); + } + } + mutex_unlock(&data->update_lock); + return count; +} + +ssize_t usb_enable_get(struct device *dev, struct device_attribute *da, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *data = i2c_get_clientdata(Cameo_CPLD_30_client); + + mutex_lock(&data->update_lock); + sprintf(buf, ""); + if (attr->index == USB_EN) + { + if (i2c_smbus_read_byte_data(Cameo_CPLD_30_client, USB_EN_REG) & BIT_2_MASK) + { + sprintf(buf, "%s%d\n", buf, ENABLE); + } + else + { + sprintf(buf, "%s%d\n", buf, DISABLE); + } + } + mutex_unlock(&data->update_lock); + return sprintf(buf, "%s\n", buf); +} + +ssize_t usb_enable_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + int status = -EPERM; + int value = -EPERM; + int result = -EPERM; + int input; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *data = i2c_get_clientdata(Cameo_CPLD_30_client); + + mutex_lock(&data->update_lock); + status = i2c_smbus_read_byte_data(Cameo_CPLD_30_client, USB_EN_REG); + if (attr->index == USB_EN) + { + input = simple_strtol(buf, NULL, 10); + if (input == ENABLE) + { + value = status | USB_EN_ENABLE; + result = i2c_smbus_write_byte_data(Cameo_CPLD_30_client, USB_EN_REG, value); + if (result < 0) + { + printk(KERN_ALERT "ERROR: usb_enable_set FAILED!\n"); + } + } + else if (input == DISABLE) + { + value = status & USB_EN_DISABLE; + result = i2c_smbus_write_byte_data(Cameo_CPLD_30_client, USB_EN_REG, value); + if (result < 0) + { + printk(KERN_ALERT "ERROR: usb_enable_set FAILED!\n"); + } + } + else + { + printk(KERN_ALERT "usb_enable_set wrong Value\n"); + } + } + mutex_unlock(&data->update_lock); + return count; +} + +ssize_t reset_mac_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + int status = -EPERM; + int value = -EPERM; + int result = -EPERM; + int input; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *data = i2c_get_clientdata(Cameo_CPLD_30_client); + + mutex_lock(&data->update_lock); + status = i2c_smbus_read_byte_data(Cameo_CPLD_30_client, MAC_RESET_REG); + if (attr->index == RESET) + { + input = simple_strtol(buf, NULL, 10); + if (input == MAC_RESET) + { + value = MAC_RESET; + result = i2c_smbus_write_byte_data(Cameo_CPLD_30_client, MAC_RESET_REG, value); + if (result < 0) + { + printk(KERN_ALERT "ERROR: reset_mac_set FAILED!\n"); + } + } + else + { + printk(KERN_ALERT "reset_mac_set wrong Value\n"); + } + } + mutex_unlock(&data->update_lock); + return count; +} + +ssize_t shutdown_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + int status = -EPERM; + int value = -EPERM; + int result = -EPERM; + int input; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *data = i2c_get_clientdata(Cameo_CPLD_30_client); + + mutex_lock(&data->update_lock); + status = i2c_smbus_read_byte_data(Cameo_CPLD_30_client, SHUTDOWN_REG); + if (attr->index == SHUTDOWN_SET) + { + input = simple_strtol(buf, NULL, 10); + if (input == SHUTDOWN) + { + value = status | SHUTDOWN; + result = i2c_smbus_write_byte_data(Cameo_CPLD_30_client, SHUTDOWN_REG, value); + if (result < 0) + { + printk(KERN_ALERT "ERROR: shutdown_set FAILED!\n"); + } + } + else + { + printk(KERN_ALERT "shutdown_set wrong Value\n"); + } + } + mutex_unlock(&data->update_lock); + return count; +} + +ssize_t bmc_enable_get(struct device *dev, struct device_attribute *da, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *data = i2c_get_clientdata(Cameo_CPLD_30_client); + + mutex_lock(&data->update_lock); + sprintf(buf, ""); + if (attr->index == BMC_PRESENT) + { + if (i2c_smbus_read_byte_data(Cameo_CPLD_30_client, BMC_EN_REG) & BIT_0_MASK) + { + sprintf(buf, "%s%d\n", buf, ENABLE); + } + else + { + sprintf(buf, "%s%d\n", buf, DISABLE); + } + } + mutex_unlock(&data->update_lock); + return sprintf(buf, "%s\n", buf); +} + +ssize_t themal_int_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int result = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *data = i2c_get_clientdata(Cameo_CPLD_30_client); + + mutex_lock(&data->update_lock); + sprintf(buf, ""); + switch (attr->index) + { + case TEMP_R_B_INT: + if (i2c_smbus_read_byte_data(Cameo_CPLD_30_client, THERMAL_INT_REG) & BIT_0_MASK) + { + result = ENABLE; + } + else + { + result = DISABLE; + } + break; + case TEMP_L_B_INT: + if (i2c_smbus_read_byte_data(Cameo_CPLD_30_client, THERMAL_INT_REG) & BIT_1_MASK) + { + result = ENABLE; + } + else + { + result = DISABLE; + } + break; + case TEMP_L_T_INT: + if (i2c_smbus_read_byte_data(Cameo_CPLD_30_client, THERMAL_INT_REG) & BIT_2_MASK) + { + result = ENABLE; + } + else + { + result = DISABLE; + } + break; + case TEMP_R_T_INT: + if (i2c_smbus_read_byte_data(Cameo_CPLD_30_client, THERMAL_INT_REG) & BIT_3_MASK) + { + result = ENABLE; + } + else + { + result = DISABLE; + } + break; + } + mutex_unlock(&data->update_lock); + sprintf(buf, "%s%d\n", buf, result); + return sprintf(buf, "%s\n", buf); +} + +ssize_t themal_int_mask_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int result = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *data = i2c_get_clientdata(Cameo_CPLD_30_client); + + mutex_lock(&data->update_lock); + sprintf(buf, ""); + switch (attr->index) + { + case TEMP_R_B_INT_MASK: + if (i2c_smbus_read_byte_data(Cameo_CPLD_30_client, THERMAL_INT_MASK_REG) & BIT_0_MASK) + { + result = ENABLE; + } + else + { + result = DISABLE; + } + break; + case TEMP_L_B_INT_MASK: + if (i2c_smbus_read_byte_data(Cameo_CPLD_30_client, THERMAL_INT_MASK_REG) & BIT_1_MASK) + { + result = ENABLE; + } + else + { + result = DISABLE; + } + break; + case TEMP_L_T_INT_MASK: + if (i2c_smbus_read_byte_data(Cameo_CPLD_30_client, THERMAL_INT_MASK_REG) & BIT_2_MASK) + { + result = ENABLE; + } + else + { + result = DISABLE; + } + break; + case TEMP_R_T_INT_MASK: + if (i2c_smbus_read_byte_data(Cameo_CPLD_30_client, THERMAL_INT_MASK_REG) & BIT_3_MASK) + { + result = ENABLE; + } + else + { + result = DISABLE; + } + break; + } + mutex_unlock(&data->update_lock); + sprintf(buf, "%s%d\n", buf, result); + return sprintf(buf, "%s\n", buf); +} + +ssize_t themal_int_mask_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + int status = -EPERM; + int value = -EPERM; + int result = -EPERM; + int input; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *data = i2c_get_clientdata(Cameo_CPLD_30_client); + + mutex_lock(&data->update_lock); + status = i2c_smbus_read_byte_data(Cameo_CPLD_30_client, THERMAL_INT_MASK_REG); + + input = simple_strtol(buf, NULL, 10); + switch (attr->index) + { + case TEMP_R_B_INT_MASK: + if (input == ENABLE) + { + value = status | 0x01; + } + else if (input == DISABLE) + { + value = status & 0xfe; + } + else + { + printk(KERN_ALERT "themal_int_mask_set wrong Value\n"); + return count; + } + break; + case TEMP_L_B_INT_MASK: + if (input == ENABLE) + { + value = status | 0x02; + } + else if (input == DISABLE) + { + value = status & 0xfd; + } + else + { + printk(KERN_ALERT "themal_int_mask_set wrong Value\n"); + return count; + } + break; + case TEMP_L_T_INT_MASK: + if (input == ENABLE) + { + value = status | 0x04; + } + else if (input == DISABLE) + { + value = status & 0xfb; + } + else + { + printk(KERN_ALERT "themal_int_mask_set wrong Value\n"); + return count; + } + break; + case TEMP_R_T_INT_MASK: + if (input == ENABLE) + { + value = status | 0x08; + } + else if (input == DISABLE) + { + value = status & 0xf7; + } + else + { + printk(KERN_ALERT "themal_int_mask_set wrong Value\n"); + return count; + } + break; + } + result = i2c_smbus_write_byte_data(Cameo_CPLD_30_client, THERMAL_INT_MASK_REG, value); + mutex_unlock(&data->update_lock); + return count; +} + +ssize_t sys_int_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int result = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *data = i2c_get_clientdata(Cameo_CPLD_30_client); + + mutex_lock(&data->update_lock); + sprintf(buf, ""); + switch (attr->index) + { + case CPLD_FP_INT: + if (i2c_smbus_read_byte_data(Cameo_CPLD_30_client, SYS_INT_REG) & BIT_2_MASK) + { + result = ENABLE; + } + else + { + result = DISABLE; + } + break; + case CPLD_RP_INT: + if (i2c_smbus_read_byte_data(Cameo_CPLD_30_client, SYS_INT_REG) & BIT_3_MASK) + { + result = ENABLE; + } + else + { + result = DISABLE; + } + break; + case CPLD_FAN_INT: + if (i2c_smbus_read_byte_data(Cameo_CPLD_30_client, SYS_INT_REG) & BIT_4_MASK) + { + result = ENABLE; + } + else + { + result = DISABLE; + } + break; + case CPLD_PSU_INT: + if (i2c_smbus_read_byte_data(Cameo_CPLD_30_client, SYS_INT_REG) & BIT_5_MASK) + { + result = ENABLE; + } + else + { + result = DISABLE; + } + break; + case THERMAL_INT: + if (i2c_smbus_read_byte_data(Cameo_CPLD_30_client, SYS_INT_REG) & BIT_6_MASK) + { + result = ENABLE; + } + else + { + result = DISABLE; + } + break; + case USB_INT: + if (i2c_smbus_read_byte_data(Cameo_CPLD_30_client, SYS_INT_REG) & BIT_7_MASK) + { + result = ENABLE; + } + else + { + result = DISABLE; + } + break; + } + mutex_unlock(&data->update_lock); + sprintf(buf, "%s%d\n", buf, result); + return sprintf(buf, "%s\n", buf); +} + +ssize_t sys_int_mask_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int result = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *data = i2c_get_clientdata(Cameo_CPLD_30_client); + + mutex_lock(&data->update_lock); + sprintf(buf, ""); + switch (attr->index) + { + case CPLD_FP_INT_MASK: + if (i2c_smbus_read_byte_data(Cameo_CPLD_30_client, SYS_INT_MASK_REG) & BIT_2_MASK) + { + result = ENABLE; + } + else + { + result = DISABLE; + } + break; + case CPLD_RP_INT_MASK: + if (i2c_smbus_read_byte_data(Cameo_CPLD_30_client, SYS_INT_MASK_REG) & BIT_3_MASK) + { + result = ENABLE; + } + else + { + result = DISABLE; + } + break; + case CPLD_FAN_INT_MASK: + if (i2c_smbus_read_byte_data(Cameo_CPLD_30_client, SYS_INT_MASK_REG) & BIT_4_MASK) + { + result = ENABLE; + } + else + { + result = DISABLE; + } + break; + case CPLD_PSU_INT_MASK: + if (i2c_smbus_read_byte_data(Cameo_CPLD_30_client, SYS_INT_MASK_REG) & BIT_5_MASK) + { + result = ENABLE; + } + else + { + result = DISABLE; + } + break; + case THERMAL_INT_MASK: + if (i2c_smbus_read_byte_data(Cameo_CPLD_30_client, SYS_INT_MASK_REG) & BIT_6_MASK) + { + result = ENABLE; + } + else + { + result = DISABLE; + } + break; + case USB_INT_MASK: + if (i2c_smbus_read_byte_data(Cameo_CPLD_30_client, SYS_INT_MASK_REG) & BIT_7_MASK) + { + result = ENABLE; + } + else + { + result = DISABLE; + } + break; + } + mutex_unlock(&data->update_lock); + sprintf(buf, "%s%d\n", buf, result); + return sprintf(buf, "%s\n", buf); +} + +ssize_t sys_int_mask_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + int status = -EPERM; + int value = -EPERM; + int result = -EPERM; + int input; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *data = i2c_get_clientdata(Cameo_CPLD_30_client); + + mutex_lock(&data->update_lock); + status = i2c_smbus_read_byte_data(Cameo_CPLD_30_client, SYS_INT_MASK_REG); + + input = simple_strtol(buf, NULL, 10); + switch (attr->index) + { + case CPLD_FP_INT_MASK: + if (input == ENABLE) + { + value = status | 0x02; + } + else if (input == DISABLE) + { + value = status & 0xfd; + } + else + { + printk(KERN_ALERT "sys_int_mask_set wrong Value\n"); + return count; + } + break; + case CPLD_RP_INT_MASK: + if (input == ENABLE) + { + value = status | 0x04; + } + else if (input == DISABLE) + { + value = status & 0xfb; + } + else + { + printk(KERN_ALERT "sys_int_mask_set wrong Value\n"); + return count; + } + break; + case CPLD_FAN_INT_MASK: + if (input == ENABLE) + { + value = status | 0x08; + } + else if (input == DISABLE) + { + value = status & 0xf7; + } + else + { + printk(KERN_ALERT "sys_int_mask_set wrong Value\n"); + return count; + } + break; + case CPLD_PSU_INT_MASK: + if (input == ENABLE) + { + value = status | 0x10; + } + else if (input == DISABLE) + { + value = status & 0xef; + } + else + { + printk(KERN_ALERT "sys_int_mask_set wrong Value\n"); + return count; + } + break; + case THERMAL_INT_MASK: + if (input == ENABLE) + { + value = status | 0x20; + } + else if (input == DISABLE) + { + value = status & 0xdf; + } + else + { + printk(KERN_ALERT "sys_int_mask_set wrong Value\n"); + return count; + } + break; + case USB_INT_MASK: + if (input == ENABLE) + { + value = status | 0x40; + } + else if (input == DISABLE) + { + value = status & 0xbf; + } + else + { + printk(KERN_ALERT "sys_int_mask_set wrong Value\n"); + return count; + } + break; + } + result = i2c_smbus_write_byte_data(Cameo_CPLD_30_client, SYS_INT_MASK_REG, value); + mutex_unlock(&data->update_lock); + return count; +} +/* end of implement i2c_function */ \ No newline at end of file diff --git a/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q-sys.h b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q-sys.h new file mode 100644 index 0000000000..400aeaf3d7 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q-sys.h @@ -0,0 +1,23 @@ +/* register offset define */ +#define CPLD_VER_REG 0x20 +#define WDT_EN_REG 0xa0 +#define WDT_EN_ENABLE 0x10 +#define WDT_EN_DISABLE 0xef +#define EEPROM_WP_REG 0xa0 +#define EEPROM_WP_ENABLE 0x04 +#define EEPROM_WP_DISABLE 0xfB +#define USB_EN_REG 0xa0 +#define USB_EN_ENABLE 0x02 +#define USB_EN_DISABLE 0xfD +#define MAC_RESET_REG 0xa1 +#define MAC_RESET 0x00 +#define SHUTDOWN_REG 0xa1 +#define SHUTDOWN 0x10 +#define BMC_EN_REG 0xa4 +#define BMC_EN_ENABLE 0x01 +#define BMC_EN_DISABLE 0x00 +#define THERMAL_INT_REG 0xc0 +#define THERMAL_INT_MASK_REG 0xc1 +#define SYS_INT_REG 0xd0 +#define SYS_INT_MASK_REG 0xd1 +/* end of register offset define */ \ No newline at end of file diff --git a/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q-thermal.c b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q-thermal.c new file mode 100644 index 0000000000..51e47ba597 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q-thermal.c @@ -0,0 +1,271 @@ +/* An hwmon driver for Cameo esc602-32Q Innovium i2c Module */ +#pragma GCC diagnostic ignored "-Wformat-zero-length" +#include "x86-64-cameo-esc602-32q.h" +#include "x86-64-cameo-esc602-32q-common.h" +#include "x86-64-cameo-esc602-32q-thermal.h" + +/* extern i2c_client */ +extern struct i2c_client *Cameo_BMC_14_client; //0x14 for BMC slave +/* end of extern i2c_client */ + +/* implement i2c_function */ +ssize_t themal_temp_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + sprintf(buf, ""); + + if( bmc_enable() == ENABLE) + { + switch (attr->index) + { + case TEMP_R_B_F: + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, TEMP_R_B_F_REG); + break; + case TEMP_R_B_B: + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, TEMP_R_B_B_REG); + break; + case TEMP_L_B_F: + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, TEMP_L_B_F_REG); + break; + case TEMP_L_B_B: + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, TEMP_L_B_B_REG); + break; + case TEMP_R_T_F: + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, TEMP_R_T_F_REG); + break; + case TEMP_R_T_B: + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, TEMP_R_T_B_REG); + break; + case TEMP_L_T_F: + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, TEMP_L_T_F_REG); + break; + case TEMP_L_T_B: + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, TEMP_L_T_B_REG); + break; + } + if(status == 0xff || status < 0) + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + else + { + sprintf(buf, "%s%d\n", buf, (read_8bit_temp((status & 0x80), status))*1000); + } + } + else + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + + return sprintf(buf, "%s\n", buf); +} + +ssize_t themal_temp_max_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + sprintf(buf, ""); + + if( bmc_enable() == ENABLE) + { + switch (attr->index) + { + case TEMP_R_B_F_MAX: + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, TEMP_R_B_F_MAX_REG); + break; + case TEMP_L_B_F_MAX: + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, TEMP_L_B_F_MAX_REG); + break; + case TEMP_R_T_F_MAX: + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, TEMP_R_T_F_MAX_REG); + break; + case TEMP_L_T_F_MAX: + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, TEMP_L_T_F_MAX_REG); + break; + case TEMP_R_B_B_MAX: + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, TEMP_R_B_B_MAX_REG); + break; + case TEMP_L_B_B_MAX: + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, TEMP_L_B_B_MAX_REG); + break; + case TEMP_R_T_B_MAX: + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, TEMP_R_T_B_MAX_REG); + break; + case TEMP_L_T_B_MAX: + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, TEMP_L_T_B_MAX_REG); + break; + } + if(status == 0xff || status < 0) + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + else + { + sprintf(buf, "%s%d\n", buf, (read_8bit_temp((status & 0x80), status))*1000); + } + } + else + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + + return sprintf(buf, "%s\n", buf); +} + +ssize_t themal_temp_min_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + sprintf(buf, ""); + + if( bmc_enable() == ENABLE) + { + switch (attr->index) + { + case TEMP_R_B_F_MIN: + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, TEMP_R_B_F_MIN_REG); + break; + case TEMP_L_B_F_MIN: + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, TEMP_L_B_F_MIN_REG); + break; + case TEMP_R_T_F_MIN: + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, TEMP_R_T_F_MIN_REG); + break; + case TEMP_L_T_F_MIN: + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, TEMP_L_T_F_MIN_REG); + break; + case TEMP_R_B_B_MIN: + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, TEMP_R_B_B_MIN_REG); + break; + case TEMP_L_B_B_MIN: + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, TEMP_L_B_B_MIN_REG); + break; + case TEMP_R_T_B_MIN: + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, TEMP_R_T_B_MIN_REG); + break; + case TEMP_L_T_B_MIN: + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, TEMP_L_T_B_MIN_REG); + break; + } + if(status == 0xff || status < 0) + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + else + { + sprintf(buf, "%s%d\n", buf, (read_8bit_temp((status & 0x80), status))*1000); + } + } + else + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + + return sprintf(buf, "%s\n", buf); +} + +ssize_t themal_temp_crit_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + sprintf(buf, ""); + + if( bmc_enable() == ENABLE) + { + switch (attr->index) + { + case TEMP_R_B_F_CRIT: + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, TEMP_R_B_F_CRIT_REG); + break; + case TEMP_L_B_F_CRIT: + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, TEMP_L_B_F_CRIT_REG); + break; + case TEMP_R_T_F_CRIT: + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, TEMP_R_T_F_CRIT_REG); + break; + case TEMP_L_T_F_CRIT: + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, TEMP_L_T_F_CRIT_REG); + break; + case TEMP_R_B_B_CRIT: + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, TEMP_R_B_B_CRIT_REG); + break; + case TEMP_L_B_B_CRIT: + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, TEMP_L_B_B_CRIT_REG); + break; + case TEMP_R_T_B_CRIT: + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, TEMP_R_T_B_CRIT_REG); + break; + case TEMP_L_T_B_CRIT: + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, TEMP_L_T_B_CRIT_REG); + break; + } + if(status == 0xff || status < 0) + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + else + { + sprintf(buf, "%s%d\n", buf, (read_8bit_temp((status & 0x80), status))*1000); + } + } + else + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + + return sprintf(buf, "%s\n", buf); +} + +ssize_t themal_temp_lcrit_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + sprintf(buf, ""); + + if( bmc_enable() == ENABLE) + { + switch (attr->index) + { + case TEMP_R_B_F_LCRIT: + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, TEMP_R_B_F_LCRIT_REG); + break; + case TEMP_L_B_F_LCRIT: + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, TEMP_L_B_F_LCRIT_REG); + break; + case TEMP_R_T_F_LCRIT: + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, TEMP_R_T_F_LCRIT_REG); + break; + case TEMP_L_T_F_LCRIT: + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, TEMP_L_T_F_LCRIT_REG); + break; + case TEMP_R_B_B_LCRIT: + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, TEMP_R_B_B_LCRIT_REG); + break; + case TEMP_L_B_B_LCRIT: + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, TEMP_L_B_B_LCRIT_REG); + break; + case TEMP_R_T_B_LCRIT: + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, TEMP_R_T_B_LCRIT_REG); + break; + case TEMP_L_T_B_LCRIT: + status = i2c_smbus_read_byte_data(Cameo_BMC_14_client, TEMP_L_T_B_LCRIT_REG); + break; + } + if(status == 0xff || status < 0) + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + else + { + sprintf(buf, "%s%d\n", buf, (read_8bit_temp((status & 0x80), status))*1000); + } + } + else + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + + return sprintf(buf, "%s\n", buf); +} +/* end of implement i2c_function */ \ No newline at end of file diff --git a/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q-thermal.h b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q-thermal.h new file mode 100644 index 0000000000..54b95a3869 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q-thermal.h @@ -0,0 +1,45 @@ +/* register offset define */ +#define TEMP_R_B_F_REG 0x10 +#define TEMP_R_B_B_REG 0x11 +#define TEMP_R_B_F_MAX_REG 0x12 +#define TEMP_R_B_F_MIN_REG 0x13 +#define TEMP_R_B_F_CRIT_REG 0x14 +#define TEMP_R_B_F_LCRIT_REG 0x15 +#define TEMP_R_B_B_MAX_REG 0x16 +#define TEMP_R_B_B_MIN_REG 0x17 +#define TEMP_R_B_B_CRIT_REG 0x18 +#define TEMP_R_B_B_LCRIT_REG 0x19 + +#define TEMP_L_B_F_REG 0x20 +#define TEMP_L_B_B_REG 0x21 +#define TEMP_L_B_F_MAX_REG 0x22 +#define TEMP_L_B_F_MIN_REG 0x23 +#define TEMP_L_B_F_CRIT_REG 0x24 +#define TEMP_L_B_F_LCRIT_REG 0x25 +#define TEMP_L_B_B_MAX_REG 0x26 +#define TEMP_L_B_B_MIN_REG 0x27 +#define TEMP_L_B_B_CRIT_REG 0x28 +#define TEMP_L_B_B_LCRIT_REG 0x29 + +#define TEMP_R_T_F_REG 0x30 +#define TEMP_R_T_B_REG 0x31 +#define TEMP_R_T_F_MAX_REG 0x32 +#define TEMP_R_T_F_MIN_REG 0x33 +#define TEMP_R_T_F_CRIT_REG 0x34 +#define TEMP_R_T_F_LCRIT_REG 0x35 +#define TEMP_R_T_B_MAX_REG 0x36 +#define TEMP_R_T_B_MIN_REG 0x37 +#define TEMP_R_T_B_CRIT_REG 0x38 +#define TEMP_R_T_B_LCRIT_REG 0x39 + +#define TEMP_L_T_F_REG 0x40 +#define TEMP_L_T_B_REG 0x41 +#define TEMP_L_T_F_MAX_REG 0x42 +#define TEMP_L_T_F_MIN_REG 0x43 +#define TEMP_L_T_F_CRIT_REG 0x44 +#define TEMP_L_T_F_LCRIT_REG 0x45 +#define TEMP_L_T_B_MAX_REG 0x46 +#define TEMP_L_T_B_MIN_REG 0x47 +#define TEMP_L_T_B_CRIT_REG 0x48 +#define TEMP_L_T_B_LCRIT_REG 0x49 +/* end of register offset define */ \ No newline at end of file diff --git a/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q.h b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q.h new file mode 100644 index 0000000000..48e1faf2bd --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q.h @@ -0,0 +1,1044 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRIVER_VERSION "1.0.1" + +struct i2c_adap { + int nr; + char *name; + const char *funcs; + const char *algo; +}; + +struct i2c_adap *gather_i2c_busses(void); +void free_adapters(struct i2c_adap *adapters); + +/* compiler conditional */ +/* end of compiler conditional */ + +/* Function Declaration */ +/* i2c-0 */ +ssize_t cpld_hw_ver_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t wdt_enable_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t wdt_enable_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +ssize_t eeprom_wp_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t eeprom_wp_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +ssize_t usb_enable_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t usb_enable_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +ssize_t reset_mac_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +ssize_t shutdown_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +ssize_t bmc_enable_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t led_ctrl_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t led_ctrl_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +ssize_t led_fiber_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t led_fiber_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +ssize_t themal_int_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t themal_int_mask_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t themal_int_mask_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +ssize_t sys_int_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t sys_int_mask_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t sys_int_mask_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +ssize_t themal_temp_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t themal_temp_max_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t themal_temp_min_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t themal_temp_crit_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t themal_temp_lcrit_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t fan_ctrl_mode_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t fan_ctrl_rpm_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t fan_status_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t fan_present_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t fan_power_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t fan_rpm_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t psu_status_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t psu_present_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t psu_vin_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t psu_iin_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t psu_vout_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t psu_iout_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t psu_temp_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t psu_fan_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t psu_pout_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t psu_pin_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t psu_mfr_model_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t psu_iout_max_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t psu_vmode_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t dc_vout_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t dc_iout_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t dc_pout_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t qsfp_low_power_all_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t qsfp_low_power_all_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +ssize_t qsfp_low_power_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t qsfp_low_power_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +ssize_t qsfp_reset_all_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +ssize_t qsfp_reset_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +ssize_t qsfp_present_all_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t qsfp_present_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t qsfp_int_all_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t qsfp_int_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t qsfp_quter_int_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t qsfp_quter_int_mask_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t qsfp_quter_int_mask_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +ssize_t qsfp_modprs_int_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t qsfp_modprs_int_mask_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t qsfp_modprs_int_mask_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +/* end of Function Declaration */ + +/* struct i2c_data */ +struct Cameo_i2c_data +{ + struct device *hwmon_dev; + struct mutex update_lock; + char valid; + unsigned long last_updated; + u8 status; +}; + +/* struct i2c_sysfs_attributes */ +enum Cameo_i2c_sysfs_attributes +{ + CPLD_23_VER, + CPLD_30_VER, + CPLD_31_VER, + CPLD_32_VER, + WDT_EN, + EEPROM_WP, + USB_EN, + SHUTDOWN_SET, + RESET, + BMC_PRESENT, + LED_1, + LED_2, + LED_FLOW, + LED_SYS, + LED_FIBER, + TEMP_R_B_INT, + TEMP_L_B_INT, + TEMP_R_T_INT, + TEMP_L_T_INT, + TEMP_R_B_INT_MASK, + TEMP_L_B_INT_MASK, + TEMP_R_T_INT_MASK, + TEMP_L_T_INT_MASK, + CPLD_FP_INT, + CPLD_RP_INT, + CPLD_FAN_INT, + CPLD_PSU_INT, + THERMAL_INT, + USB_INT, + CPLD_FP_INT_MASK, + CPLD_RP_INT_MASK, + CPLD_FAN_INT_MASK, + CPLD_PSU_INT_MASK, + THERMAL_INT_MASK, + USB_INT_MASK, + TEMP_R_B_F, + TEMP_R_B_B, + TEMP_L_B_F, + TEMP_L_B_B, + TEMP_R_T_F, + TEMP_R_T_B, + TEMP_L_T_F, + TEMP_L_T_B, + TEMP_R_B_F_MAX, + TEMP_L_B_F_MAX, + TEMP_R_T_F_MAX, + TEMP_L_T_F_MAX, + TEMP_R_B_B_MAX, + TEMP_L_B_B_MAX, + TEMP_R_T_B_MAX, + TEMP_L_T_B_MAX, + TEMP_R_B_F_MIN, + TEMP_L_B_F_MIN, + TEMP_R_T_F_MIN, + TEMP_L_T_F_MIN, + TEMP_R_B_B_MIN, + TEMP_L_B_B_MIN, + TEMP_R_T_B_MIN, + TEMP_L_T_B_MIN, + TEMP_R_B_F_CRIT, + TEMP_L_B_F_CRIT, + TEMP_R_T_F_CRIT, + TEMP_L_T_F_CRIT, + TEMP_R_B_B_CRIT, + TEMP_L_B_B_CRIT, + TEMP_R_T_B_CRIT, + TEMP_L_T_B_CRIT, + TEMP_R_B_F_LCRIT, + TEMP_L_B_F_LCRIT, + TEMP_R_T_F_LCRIT, + TEMP_L_T_F_LCRIT, + TEMP_R_B_B_LCRIT, + TEMP_L_B_B_LCRIT, + TEMP_R_T_B_LCRIT, + TEMP_L_T_B_LCRIT, + FANCTRL_RPM, + FANCTRL_MODE, + FAN1_STAT, + FAN2_STAT, + FAN3_STAT, + FAN4_STAT, + FAN5_STAT, + FAN1_PRESENT, + FAN2_PRESENT, + FAN3_PRESENT, + FAN4_PRESENT, + FAN5_PRESENT, + FAN1_POWER, + FAN2_POWER, + FAN3_POWER, + FAN4_POWER, + FAN5_POWER, + FAN1_FRONT_RPM, + FAN2_FRONT_RPM, + FAN3_FRONT_RPM, + FAN4_FRONT_RPM, + FAN5_FRONT_RPM, + FAN1_REAR_RPM, + FAN2_REAR_RPM, + FAN3_REAR_RPM, + FAN4_REAR_RPM, + FAN5_REAR_RPM, + PSU1_GOOD, + PSU2_GOOD, + PSU1_PRNT, + PSU2_PRNT, + PSU1_VIN, + PSU1_IIN, + PSU1_VOUT, + PSU1_IOUT, + PSU1_TEMP, + PSU1_FAN_SPEED, + PSU1_POUT, + PSU1_PIN, + PSU1_MFR_MODEL, + PSU1_MFR_IOUT_MAX, + PSU1_VOMDE, + PSU2_VIN, + PSU2_IIN, + PSU2_VOUT, + PSU2_IOUT, + PSU2_TEMP, + PSU2_FAN_SPEED, + PSU2_POUT, + PSU2_PIN, + PSU2_MFR_MODEL, + PSU2_MFR_IOUT_MAX, + PSU2_VOMDE, + DC6E_P0_VOUT, + DC6E_P0_IOUT, + DC6E_P0_POUT, + DC6E_P1_VOUT, + DC6E_P1_IOUT, + DC6E_P1_POUT, + DC70_P0_VOUT, + DC70_P0_IOUT, + DC70_P0_POUT, + DC70_P1_VOUT, + DC70_P1_IOUT, + DC70_P1_POUT, + QSFP_LOW_POWER_ALL, + QSFP1_LOW_POWER, + QSFP2_LOW_POWER, + QSFP3_LOW_POWER, + QSFP4_LOW_POWER, + QSFP5_LOW_POWER, + QSFP6_LOW_POWER, + QSFP7_LOW_POWER, + QSFP8_LOW_POWER, + QSFP9_LOW_POWER, + QSFP10_LOW_POWER, + QSFP11_LOW_POWER, + QSFP12_LOW_POWER, + QSFP13_LOW_POWER, + QSFP14_LOW_POWER, + QSFP15_LOW_POWER, + QSFP16_LOW_POWER, + QSFP17_LOW_POWER, + QSFP18_LOW_POWER, + QSFP19_LOW_POWER, + QSFP20_LOW_POWER, + QSFP21_LOW_POWER, + QSFP22_LOW_POWER, + QSFP23_LOW_POWER, + QSFP24_LOW_POWER, + QSFP25_LOW_POWER, + QSFP26_LOW_POWER, + QSFP27_LOW_POWER, + QSFP28_LOW_POWER, + QSFP29_LOW_POWER, + QSFP30_LOW_POWER, + QSFP31_LOW_POWER, + QSFP32_LOW_POWER, + QSFP_RESET_ALL, + QSFP1_RESET, + QSFP2_RESET, + QSFP3_RESET, + QSFP4_RESET, + QSFP5_RESET, + QSFP6_RESET, + QSFP7_RESET, + QSFP8_RESET, + QSFP9_RESET, + QSFP10_RESET, + QSFP11_RESET, + QSFP12_RESET, + QSFP13_RESET, + QSFP14_RESET, + QSFP15_RESET, + QSFP16_RESET, + QSFP17_RESET, + QSFP18_RESET, + QSFP19_RESET, + QSFP20_RESET, + QSFP21_RESET, + QSFP22_RESET, + QSFP23_RESET, + QSFP24_RESET, + QSFP25_RESET, + QSFP26_RESET, + QSFP27_RESET, + QSFP28_RESET, + QSFP29_RESET, + QSFP30_RESET, + QSFP31_RESET, + QSFP32_RESET, + QSFP_PRESENT_ALL, + QSFP1_PRESENT, + QSFP2_PRESENT, + QSFP3_PRESENT, + QSFP4_PRESENT, + QSFP5_PRESENT, + QSFP6_PRESENT, + QSFP7_PRESENT, + QSFP8_PRESENT, + QSFP9_PRESENT, + QSFP10_PRESENT, + QSFP11_PRESENT, + QSFP12_PRESENT, + QSFP13_PRESENT, + QSFP14_PRESENT, + QSFP15_PRESENT, + QSFP16_PRESENT, + QSFP17_PRESENT, + QSFP18_PRESENT, + QSFP19_PRESENT, + QSFP20_PRESENT, + QSFP21_PRESENT, + QSFP22_PRESENT, + QSFP23_PRESENT, + QSFP24_PRESENT, + QSFP25_PRESENT, + QSFP26_PRESENT, + QSFP27_PRESENT, + QSFP28_PRESENT, + QSFP29_PRESENT, + QSFP30_PRESENT, + QSFP31_PRESENT, + QSFP32_PRESENT, + QSFP_INT_ALL, + QSFP1_INT, + QSFP2_INT, + QSFP3_INT, + QSFP4_INT, + QSFP5_INT, + QSFP6_INT, + QSFP7_INT, + QSFP8_INT, + QSFP9_INT, + QSFP10_INT, + QSFP11_INT, + QSFP12_INT, + QSFP13_INT, + QSFP14_INT, + QSFP15_INT, + QSFP16_INT, + QSFP17_INT, + QSFP18_INT, + QSFP19_INT, + QSFP20_INT, + QSFP21_INT, + QSFP22_INT, + QSFP23_INT, + QSFP24_INT, + QSFP25_INT, + QSFP26_INT, + QSFP27_INT, + QSFP28_INT, + QSFP29_INT, + QSFP30_INT, + QSFP31_INT, + QSFP32_INT, + QSFP1_4_INT, + QSFP2_4_INT, + QSFP3_4_INT, + QSFP4_4_INT, + QSFP1_4_MODPRS, + QSFP2_4_MODPRS, + QSFP3_4_MODPRS, + QSFP4_4_MODPRS, + QSFP1_4_INT_MASK, + QSFP2_4_INT_MASK, + QSFP3_4_INT_MASK, + QSFP4_4_INT_MASK, + QSFP1_4_MODPRS_MASK, + QSFP2_4_MODPRS_MASK, + QSFP3_4_MODPRS_MASK, + QSFP4_4_MODPRS_MASK +}; +/* end of struct i2c_sysfs_attributes */ + +/* sysfs attributes for SENSOR_DEVICE_ATTR */ +static SENSOR_DEVICE_ATTR(cpld_23_ver , S_IRUGO , cpld_hw_ver_get , NULL , 23); +static SENSOR_DEVICE_ATTR(cpld_30_ver , S_IRUGO , cpld_hw_ver_get , NULL , 30); +static SENSOR_DEVICE_ATTR(cpld_31_ver , S_IRUGO , cpld_hw_ver_get , NULL , 31); +static SENSOR_DEVICE_ATTR(cpld_32_ver , S_IRUGO , cpld_hw_ver_get , NULL , 32); +static SENSOR_DEVICE_ATTR(wdt_en , S_IRUGO | S_IWUSR , wdt_enable_get , wdt_enable_set , WDT_EN); +static SENSOR_DEVICE_ATTR(eeprom_wp , S_IRUGO | S_IWUSR , eeprom_wp_get , eeprom_wp_set , EEPROM_WP); +static SENSOR_DEVICE_ATTR(usb_en , S_IRUGO | S_IWUSR , usb_enable_get , usb_enable_set , USB_EN); +static SENSOR_DEVICE_ATTR(shutdown_set , S_IRUGO | S_IWUSR , NULL , shutdown_set , SHUTDOWN_SET); +static SENSOR_DEVICE_ATTR(reset , S_IRUGO | S_IWUSR , NULL , reset_mac_set , RESET); +static SENSOR_DEVICE_ATTR(bmc_present , S_IRUGO , bmc_enable_get , NULL , BMC_PRESENT); +static SENSOR_DEVICE_ATTR(led_1 , S_IRUGO | S_IWUSR , led_ctrl_get , led_ctrl_set , 4); +static SENSOR_DEVICE_ATTR(led_2 , S_IRUGO | S_IWUSR , led_ctrl_get , led_ctrl_set , 3); +static SENSOR_DEVICE_ATTR(led_flow , S_IRUGO | S_IWUSR , led_ctrl_get , led_ctrl_set , 2); +static SENSOR_DEVICE_ATTR(led_sys , S_IRUGO | S_IWUSR , led_ctrl_get , led_ctrl_set , 1); +static SENSOR_DEVICE_ATTR(led_fiber , S_IRUGO | S_IWUSR , led_fiber_get , led_fiber_set , LED_FIBER); +static SENSOR_DEVICE_ATTR(temp_r_b_int , S_IRUGO , themal_int_get , NULL , TEMP_R_B_INT); +static SENSOR_DEVICE_ATTR(temp_l_b_int , S_IRUGO , themal_int_get , NULL , TEMP_L_B_INT); +static SENSOR_DEVICE_ATTR(temp_r_t_int , S_IRUGO , themal_int_get , NULL , TEMP_R_T_INT); +static SENSOR_DEVICE_ATTR(temp_l_t_int , S_IRUGO , themal_int_get , NULL , TEMP_L_T_INT); +static SENSOR_DEVICE_ATTR(temp_r_b_int_mask , S_IRUGO | S_IWUSR , themal_int_mask_get , themal_int_mask_set , TEMP_R_B_INT_MASK); +static SENSOR_DEVICE_ATTR(temp_l_b_int_mask , S_IRUGO | S_IWUSR , themal_int_mask_get , themal_int_mask_set , TEMP_L_B_INT_MASK); +static SENSOR_DEVICE_ATTR(temp_r_t_int_mask , S_IRUGO | S_IWUSR , themal_int_mask_get , themal_int_mask_set , TEMP_R_T_INT_MASK); +static SENSOR_DEVICE_ATTR(temp_l_t_int_mask , S_IRUGO | S_IWUSR , themal_int_mask_get , themal_int_mask_set , TEMP_L_T_INT_MASK); +static SENSOR_DEVICE_ATTR(cpld_fp_int , S_IRUGO , sys_int_get , NULL , CPLD_FP_INT); +static SENSOR_DEVICE_ATTR(cpld_rp_int , S_IRUGO , sys_int_get , NULL , CPLD_RP_INT); +static SENSOR_DEVICE_ATTR(cpld_fan_int , S_IRUGO , sys_int_get , NULL , CPLD_FAN_INT); +static SENSOR_DEVICE_ATTR(cpld_psu_int , S_IRUGO , sys_int_get , NULL , CPLD_PSU_INT); +static SENSOR_DEVICE_ATTR(thermal_int , S_IRUGO , sys_int_get , NULL , THERMAL_INT); +static SENSOR_DEVICE_ATTR(usb_int , S_IRUGO , sys_int_get , NULL , USB_INT); +static SENSOR_DEVICE_ATTR(cpld_fp_int_mask , S_IRUGO | S_IWUSR , sys_int_mask_get , sys_int_mask_set , CPLD_FP_INT_MASK); +static SENSOR_DEVICE_ATTR(cpld_rp_int_mask , S_IRUGO | S_IWUSR , sys_int_mask_get , sys_int_mask_set , CPLD_RP_INT_MASK); +static SENSOR_DEVICE_ATTR(cpld_fan_int_mask , S_IRUGO | S_IWUSR , sys_int_mask_get , sys_int_mask_set , CPLD_FAN_INT_MASK); +static SENSOR_DEVICE_ATTR(cpld_psu_int_mask , S_IRUGO | S_IWUSR , sys_int_mask_get , sys_int_mask_set , CPLD_PSU_INT_MASK); +static SENSOR_DEVICE_ATTR(thermal_int_mask , S_IRUGO | S_IWUSR , sys_int_mask_get , sys_int_mask_set , THERMAL_INT_MASK); +static SENSOR_DEVICE_ATTR(usb_int_mask , S_IRUGO | S_IWUSR , sys_int_mask_get , sys_int_mask_set , USB_INT_MASK); +static SENSOR_DEVICE_ATTR(temp_r_b_f , S_IRUGO , themal_temp_get , NULL , TEMP_R_B_F); +static SENSOR_DEVICE_ATTR(temp_r_b_b , S_IRUGO , themal_temp_get , NULL , TEMP_R_B_B); +static SENSOR_DEVICE_ATTR(temp_l_b_f , S_IRUGO , themal_temp_get , NULL , TEMP_L_B_F); +static SENSOR_DEVICE_ATTR(temp_l_b_b , S_IRUGO , themal_temp_get , NULL , TEMP_L_B_B); +static SENSOR_DEVICE_ATTR(temp_r_t_f , S_IRUGO , themal_temp_get , NULL , TEMP_R_T_F); +static SENSOR_DEVICE_ATTR(temp_r_t_b , S_IRUGO , themal_temp_get , NULL , TEMP_R_T_B); +static SENSOR_DEVICE_ATTR(temp_l_t_f , S_IRUGO , themal_temp_get , NULL , TEMP_L_T_F); +static SENSOR_DEVICE_ATTR(temp_l_t_b , S_IRUGO , themal_temp_get , NULL , TEMP_L_T_B); +static SENSOR_DEVICE_ATTR(temp_r_b_f_max , S_IRUGO , themal_temp_max_get , NULL , TEMP_R_B_F_MAX); +static SENSOR_DEVICE_ATTR(temp_l_b_f_max , S_IRUGO , themal_temp_max_get , NULL , TEMP_L_B_F_MAX); +static SENSOR_DEVICE_ATTR(temp_r_t_f_max , S_IRUGO , themal_temp_max_get , NULL , TEMP_R_T_F_MAX); +static SENSOR_DEVICE_ATTR(temp_l_t_f_max , S_IRUGO , themal_temp_max_get , NULL , TEMP_L_T_F_MAX); +static SENSOR_DEVICE_ATTR(temp_r_b_b_max , S_IRUGO , themal_temp_max_get , NULL , TEMP_R_B_B_MAX); +static SENSOR_DEVICE_ATTR(temp_l_b_b_max , S_IRUGO , themal_temp_max_get , NULL , TEMP_L_B_B_MAX); +static SENSOR_DEVICE_ATTR(temp_r_t_b_max , S_IRUGO , themal_temp_max_get , NULL , TEMP_R_T_B_MAX); +static SENSOR_DEVICE_ATTR(temp_l_t_b_max , S_IRUGO , themal_temp_max_get , NULL , TEMP_L_T_B_MAX); +static SENSOR_DEVICE_ATTR(temp_r_b_f_min , S_IRUGO , themal_temp_min_get , NULL , TEMP_R_B_F_MIN); +static SENSOR_DEVICE_ATTR(temp_l_b_f_min , S_IRUGO , themal_temp_min_get , NULL , TEMP_L_B_F_MIN); +static SENSOR_DEVICE_ATTR(temp_r_t_f_min , S_IRUGO , themal_temp_min_get , NULL , TEMP_R_T_F_MIN); +static SENSOR_DEVICE_ATTR(temp_l_t_f_min , S_IRUGO , themal_temp_min_get , NULL , TEMP_L_T_F_MIN); +static SENSOR_DEVICE_ATTR(temp_r_b_b_min , S_IRUGO , themal_temp_min_get , NULL , TEMP_R_B_B_MIN); +static SENSOR_DEVICE_ATTR(temp_l_b_b_min , S_IRUGO , themal_temp_min_get , NULL , TEMP_L_B_B_MIN); +static SENSOR_DEVICE_ATTR(temp_r_t_b_min , S_IRUGO , themal_temp_min_get , NULL , TEMP_R_T_B_MIN); +static SENSOR_DEVICE_ATTR(temp_l_t_b_min , S_IRUGO , themal_temp_min_get , NULL , TEMP_L_T_B_MIN); +static SENSOR_DEVICE_ATTR(temp_r_b_f_crit , S_IRUGO , themal_temp_crit_get , NULL , TEMP_R_B_F_CRIT); +static SENSOR_DEVICE_ATTR(temp_l_b_f_crit , S_IRUGO , themal_temp_crit_get , NULL , TEMP_L_B_F_CRIT); +static SENSOR_DEVICE_ATTR(temp_r_t_f_crit , S_IRUGO , themal_temp_crit_get , NULL , TEMP_R_T_F_CRIT); +static SENSOR_DEVICE_ATTR(temp_l_t_f_crit , S_IRUGO , themal_temp_crit_get , NULL , TEMP_L_T_F_CRIT); +static SENSOR_DEVICE_ATTR(temp_r_b_b_crit , S_IRUGO , themal_temp_crit_get , NULL , TEMP_R_B_B_CRIT); +static SENSOR_DEVICE_ATTR(temp_l_b_b_crit , S_IRUGO , themal_temp_crit_get , NULL , TEMP_L_B_B_CRIT); +static SENSOR_DEVICE_ATTR(temp_r_t_b_crit , S_IRUGO , themal_temp_crit_get , NULL , TEMP_R_T_B_CRIT); +static SENSOR_DEVICE_ATTR(temp_l_t_b_crit , S_IRUGO , themal_temp_crit_get , NULL , TEMP_L_T_B_CRIT); +static SENSOR_DEVICE_ATTR(temp_r_b_f_lcrit , S_IRUGO , themal_temp_lcrit_get , NULL , TEMP_R_B_F_LCRIT); +static SENSOR_DEVICE_ATTR(temp_l_b_f_lcrit , S_IRUGO , themal_temp_lcrit_get , NULL , TEMP_L_B_F_LCRIT); +static SENSOR_DEVICE_ATTR(temp_r_t_f_lcrit , S_IRUGO , themal_temp_lcrit_get , NULL , TEMP_R_T_F_LCRIT); +static SENSOR_DEVICE_ATTR(temp_l_t_f_lcrit , S_IRUGO , themal_temp_lcrit_get , NULL , TEMP_L_T_F_LCRIT); +static SENSOR_DEVICE_ATTR(temp_r_b_b_lcrit , S_IRUGO , themal_temp_lcrit_get , NULL , TEMP_R_B_B_LCRIT); +static SENSOR_DEVICE_ATTR(temp_l_b_b_lcrit , S_IRUGO , themal_temp_lcrit_get , NULL , TEMP_L_B_B_LCRIT); +static SENSOR_DEVICE_ATTR(temp_r_t_b_lcrit , S_IRUGO , themal_temp_lcrit_get , NULL , TEMP_R_T_B_LCRIT); +static SENSOR_DEVICE_ATTR(temp_l_t_b_lcrit , S_IRUGO , themal_temp_lcrit_get , NULL , TEMP_L_T_B_LCRIT); +static SENSOR_DEVICE_ATTR(fanctrl_rpm , S_IRUGO , fan_ctrl_rpm_get , NULL , FANCTRL_RPM); +static SENSOR_DEVICE_ATTR(fanctrl_mode , S_IRUGO , fan_ctrl_mode_get , NULL , FANCTRL_MODE); +static SENSOR_DEVICE_ATTR(fan1_stat , S_IRUGO , fan_status_get , NULL , 1); +static SENSOR_DEVICE_ATTR(fan2_stat , S_IRUGO , fan_status_get , NULL , 2); +static SENSOR_DEVICE_ATTR(fan3_stat , S_IRUGO , fan_status_get , NULL , 3); +static SENSOR_DEVICE_ATTR(fan4_stat , S_IRUGO , fan_status_get , NULL , 4); +static SENSOR_DEVICE_ATTR(fan5_stat , S_IRUGO , fan_status_get , NULL , 5); +static SENSOR_DEVICE_ATTR(fan1_present , S_IRUGO , fan_present_get , NULL , 1); +static SENSOR_DEVICE_ATTR(fan2_present , S_IRUGO , fan_present_get , NULL , 2); +static SENSOR_DEVICE_ATTR(fan3_present , S_IRUGO , fan_present_get , NULL , 3); +static SENSOR_DEVICE_ATTR(fan4_present , S_IRUGO , fan_present_get , NULL , 4); +static SENSOR_DEVICE_ATTR(fan5_present , S_IRUGO , fan_present_get , NULL , 5); +static SENSOR_DEVICE_ATTR(fan1_power , S_IRUGO , fan_power_get , NULL , 1); +static SENSOR_DEVICE_ATTR(fan2_power , S_IRUGO , fan_power_get , NULL , 2); +static SENSOR_DEVICE_ATTR(fan3_power , S_IRUGO , fan_power_get , NULL , 3); +static SENSOR_DEVICE_ATTR(fan4_power , S_IRUGO , fan_power_get , NULL , 4); +static SENSOR_DEVICE_ATTR(fan5_power , S_IRUGO , fan_power_get , NULL , 5); +static SENSOR_DEVICE_ATTR(fan1_front_rpm , S_IRUGO , fan_rpm_get , NULL , FAN1_FRONT_RPM); +static SENSOR_DEVICE_ATTR(fan2_front_rpm , S_IRUGO , fan_rpm_get , NULL , FAN2_FRONT_RPM); +static SENSOR_DEVICE_ATTR(fan3_front_rpm , S_IRUGO , fan_rpm_get , NULL , FAN3_FRONT_RPM); +static SENSOR_DEVICE_ATTR(fan4_front_rpm , S_IRUGO , fan_rpm_get , NULL , FAN4_FRONT_RPM); +static SENSOR_DEVICE_ATTR(fan5_front_rpm , S_IRUGO , fan_rpm_get , NULL , FAN5_FRONT_RPM); +static SENSOR_DEVICE_ATTR(fan1_rear_rpm , S_IRUGO , fan_rpm_get , NULL , FAN1_REAR_RPM); +static SENSOR_DEVICE_ATTR(fan2_rear_rpm , S_IRUGO , fan_rpm_get , NULL , FAN2_REAR_RPM); +static SENSOR_DEVICE_ATTR(fan3_rear_rpm , S_IRUGO , fan_rpm_get , NULL , FAN3_REAR_RPM); +static SENSOR_DEVICE_ATTR(fan4_rear_rpm , S_IRUGO , fan_rpm_get , NULL , FAN4_REAR_RPM); +static SENSOR_DEVICE_ATTR(fan5_rear_rpm , S_IRUGO , fan_rpm_get , NULL , FAN5_REAR_RPM); +static SENSOR_DEVICE_ATTR(psu1_good , S_IRUGO , psu_status_get , NULL , 1); +static SENSOR_DEVICE_ATTR(psu2_good , S_IRUGO , psu_status_get , NULL , 2); +static SENSOR_DEVICE_ATTR(psu1_prnt , S_IRUGO , psu_present_get , NULL , 1); +static SENSOR_DEVICE_ATTR(psu2_prnt , S_IRUGO , psu_present_get , NULL , 2); +static SENSOR_DEVICE_ATTR(psu1_vin , S_IRUGO , psu_vin_get , NULL , PSU1_VIN); +static SENSOR_DEVICE_ATTR(psu1_iin , S_IRUGO , psu_iin_get , NULL , PSU1_IIN); +static SENSOR_DEVICE_ATTR(psu1_vout , S_IRUGO , psu_vout_get , NULL , PSU1_VOUT); +static SENSOR_DEVICE_ATTR(psu1_iout , S_IRUGO , psu_iout_get , NULL , PSU1_IOUT); +static SENSOR_DEVICE_ATTR(psu1_temp , S_IRUGO , psu_temp_get , NULL , PSU1_TEMP); +static SENSOR_DEVICE_ATTR(psu1_fan_speed , S_IRUGO , psu_fan_get , NULL , PSU1_FAN_SPEED); +static SENSOR_DEVICE_ATTR(psu1_pout , S_IRUGO , psu_pout_get , NULL , PSU1_POUT); +static SENSOR_DEVICE_ATTR(psu1_pin , S_IRUGO , psu_pin_get , NULL , PSU1_PIN); +static SENSOR_DEVICE_ATTR(psu1_mfr_model , S_IRUGO , psu_mfr_model_get , NULL , PSU1_MFR_MODEL); +static SENSOR_DEVICE_ATTR(psu1_mfr_iout_max , S_IRUGO , psu_iout_max_get , NULL , PSU1_MFR_IOUT_MAX); +static SENSOR_DEVICE_ATTR(psu1_vomde , S_IRUGO , psu_vmode_get , NULL , PSU1_VOMDE); +static SENSOR_DEVICE_ATTR(psu2_vin , S_IRUGO , psu_vin_get , NULL , PSU2_VIN); +static SENSOR_DEVICE_ATTR(psu2_iin , S_IRUGO , psu_iin_get , NULL , PSU2_IIN); +static SENSOR_DEVICE_ATTR(psu2_vout , S_IRUGO , psu_vout_get , NULL , PSU2_VOUT); +static SENSOR_DEVICE_ATTR(psu2_iout , S_IRUGO , psu_iout_get , NULL , PSU2_IOUT); +static SENSOR_DEVICE_ATTR(psu2_temp , S_IRUGO , psu_temp_get , NULL , PSU2_TEMP); +static SENSOR_DEVICE_ATTR(psu2_fan_speed , S_IRUGO , psu_fan_get , NULL , PSU2_FAN_SPEED); +static SENSOR_DEVICE_ATTR(psu2_pout , S_IRUGO , psu_pout_get , NULL , PSU2_POUT); +static SENSOR_DEVICE_ATTR(psu2_pin , S_IRUGO , psu_pin_get , NULL , PSU2_PIN); +static SENSOR_DEVICE_ATTR(psu2_mfr_model , S_IRUGO , psu_mfr_model_get , NULL , PSU2_MFR_MODEL); +static SENSOR_DEVICE_ATTR(psu2_mfr_iout_max , S_IRUGO , psu_iout_max_get , NULL , PSU2_MFR_IOUT_MAX); +static SENSOR_DEVICE_ATTR(psu2_vomde , S_IRUGO , psu_vmode_get , NULL , PSU2_VOMDE); +static SENSOR_DEVICE_ATTR(dc6e_p0_vout , S_IRUGO , dc_vout_get , NULL , DC6E_P0_VOUT); +static SENSOR_DEVICE_ATTR(dc6e_p0_iout , S_IRUGO , dc_iout_get , NULL , DC6E_P0_IOUT); +static SENSOR_DEVICE_ATTR(dc6e_p0_pout , S_IRUGO , dc_pout_get , NULL , DC6E_P0_POUT); +static SENSOR_DEVICE_ATTR(dc6e_p1_vout , S_IRUGO , dc_vout_get , NULL , DC6E_P1_VOUT); +static SENSOR_DEVICE_ATTR(dc6e_p1_iout , S_IRUGO , dc_iout_get , NULL , DC6E_P1_IOUT); +static SENSOR_DEVICE_ATTR(dc6e_p1_pout , S_IRUGO , dc_pout_get , NULL , DC6E_P1_POUT); +static SENSOR_DEVICE_ATTR(dc70_p0_vout , S_IRUGO , dc_vout_get , NULL , DC70_P0_VOUT); +static SENSOR_DEVICE_ATTR(dc70_p0_iout , S_IRUGO , dc_iout_get , NULL , DC70_P0_IOUT); +static SENSOR_DEVICE_ATTR(dc70_p0_pout , S_IRUGO , dc_pout_get , NULL , DC70_P0_POUT); +static SENSOR_DEVICE_ATTR(dc70_p1_vout , S_IRUGO , dc_vout_get , NULL , DC70_P1_VOUT); +static SENSOR_DEVICE_ATTR(dc70_p1_iout , S_IRUGO , dc_iout_get , NULL , DC70_P1_IOUT); +static SENSOR_DEVICE_ATTR(dc70_p1_pout , S_IRUGO , dc_pout_get , NULL , DC70_P1_POUT); +static SENSOR_DEVICE_ATTR(qsfp_low_power_all , S_IRUGO | S_IWUSR , qsfp_low_power_all_get , qsfp_low_power_all_set , QSFP_LOW_POWER_ALL); +static SENSOR_DEVICE_ATTR(qsfp1_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 1); +static SENSOR_DEVICE_ATTR(qsfp2_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 2); +static SENSOR_DEVICE_ATTR(qsfp3_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 3); +static SENSOR_DEVICE_ATTR(qsfp4_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 4); +static SENSOR_DEVICE_ATTR(qsfp5_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 5); +static SENSOR_DEVICE_ATTR(qsfp6_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 6); +static SENSOR_DEVICE_ATTR(qsfp7_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 7); +static SENSOR_DEVICE_ATTR(qsfp8_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 8); +static SENSOR_DEVICE_ATTR(qsfp9_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 9); +static SENSOR_DEVICE_ATTR(qsfp10_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 10); +static SENSOR_DEVICE_ATTR(qsfp11_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 11); +static SENSOR_DEVICE_ATTR(qsfp12_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 12); +static SENSOR_DEVICE_ATTR(qsfp13_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 13); +static SENSOR_DEVICE_ATTR(qsfp14_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 14); +static SENSOR_DEVICE_ATTR(qsfp15_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 15); +static SENSOR_DEVICE_ATTR(qsfp16_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 16); +static SENSOR_DEVICE_ATTR(qsfp17_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 17); +static SENSOR_DEVICE_ATTR(qsfp18_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 18); +static SENSOR_DEVICE_ATTR(qsfp19_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 19); +static SENSOR_DEVICE_ATTR(qsfp20_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 20); +static SENSOR_DEVICE_ATTR(qsfp21_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 21); +static SENSOR_DEVICE_ATTR(qsfp22_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 22); +static SENSOR_DEVICE_ATTR(qsfp23_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 23); +static SENSOR_DEVICE_ATTR(qsfp24_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 24); +static SENSOR_DEVICE_ATTR(qsfp25_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 25); +static SENSOR_DEVICE_ATTR(qsfp26_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 26); +static SENSOR_DEVICE_ATTR(qsfp27_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 27); +static SENSOR_DEVICE_ATTR(qsfp28_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 28); +static SENSOR_DEVICE_ATTR(qsfp29_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 29); +static SENSOR_DEVICE_ATTR(qsfp30_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 30); +static SENSOR_DEVICE_ATTR(qsfp31_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 31); +static SENSOR_DEVICE_ATTR(qsfp32_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 32); +static SENSOR_DEVICE_ATTR(qsfp_reset_all , S_IRUGO | S_IWUSR , NULL , qsfp_reset_all_set , QSFP_RESET_ALL); +static SENSOR_DEVICE_ATTR(qsfp1_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 1); +static SENSOR_DEVICE_ATTR(qsfp2_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 2); +static SENSOR_DEVICE_ATTR(qsfp3_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 3); +static SENSOR_DEVICE_ATTR(qsfp4_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 4); +static SENSOR_DEVICE_ATTR(qsfp5_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 5); +static SENSOR_DEVICE_ATTR(qsfp6_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 6); +static SENSOR_DEVICE_ATTR(qsfp7_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 7); +static SENSOR_DEVICE_ATTR(qsfp8_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 8); +static SENSOR_DEVICE_ATTR(qsfp9_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 9); +static SENSOR_DEVICE_ATTR(qsfp10_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 10); +static SENSOR_DEVICE_ATTR(qsfp11_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 11); +static SENSOR_DEVICE_ATTR(qsfp12_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 12); +static SENSOR_DEVICE_ATTR(qsfp13_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 13); +static SENSOR_DEVICE_ATTR(qsfp14_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 14); +static SENSOR_DEVICE_ATTR(qsfp15_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 15); +static SENSOR_DEVICE_ATTR(qsfp16_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 16); +static SENSOR_DEVICE_ATTR(qsfp17_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 17); +static SENSOR_DEVICE_ATTR(qsfp18_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 18); +static SENSOR_DEVICE_ATTR(qsfp19_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 19); +static SENSOR_DEVICE_ATTR(qsfp20_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 20); +static SENSOR_DEVICE_ATTR(qsfp21_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 21); +static SENSOR_DEVICE_ATTR(qsfp22_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 22); +static SENSOR_DEVICE_ATTR(qsfp23_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 23); +static SENSOR_DEVICE_ATTR(qsfp24_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 24); +static SENSOR_DEVICE_ATTR(qsfp25_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 25); +static SENSOR_DEVICE_ATTR(qsfp26_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 26); +static SENSOR_DEVICE_ATTR(qsfp27_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 27); +static SENSOR_DEVICE_ATTR(qsfp28_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 28); +static SENSOR_DEVICE_ATTR(qsfp29_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 29); +static SENSOR_DEVICE_ATTR(qsfp30_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 30); +static SENSOR_DEVICE_ATTR(qsfp31_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 31); +static SENSOR_DEVICE_ATTR(qsfp32_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 32); +static SENSOR_DEVICE_ATTR(qsfp_present_all , S_IRUGO , qsfp_present_all_get , NULL , QSFP_PRESENT_ALL); +static SENSOR_DEVICE_ATTR(qsfp1_present , S_IRUGO , qsfp_present_get , NULL , 1); +static SENSOR_DEVICE_ATTR(qsfp2_present , S_IRUGO , qsfp_present_get , NULL , 2); +static SENSOR_DEVICE_ATTR(qsfp3_present , S_IRUGO , qsfp_present_get , NULL , 3); +static SENSOR_DEVICE_ATTR(qsfp4_present , S_IRUGO , qsfp_present_get , NULL , 4); +static SENSOR_DEVICE_ATTR(qsfp5_present , S_IRUGO , qsfp_present_get , NULL , 5); +static SENSOR_DEVICE_ATTR(qsfp6_present , S_IRUGO , qsfp_present_get , NULL , 6); +static SENSOR_DEVICE_ATTR(qsfp7_present , S_IRUGO , qsfp_present_get , NULL , 7); +static SENSOR_DEVICE_ATTR(qsfp8_present , S_IRUGO , qsfp_present_get , NULL , 8); +static SENSOR_DEVICE_ATTR(qsfp9_present , S_IRUGO , qsfp_present_get , NULL , 9); +static SENSOR_DEVICE_ATTR(qsfp10_present , S_IRUGO , qsfp_present_get , NULL , 10); +static SENSOR_DEVICE_ATTR(qsfp11_present , S_IRUGO , qsfp_present_get , NULL , 11); +static SENSOR_DEVICE_ATTR(qsfp12_present , S_IRUGO , qsfp_present_get , NULL , 12); +static SENSOR_DEVICE_ATTR(qsfp13_present , S_IRUGO , qsfp_present_get , NULL , 13); +static SENSOR_DEVICE_ATTR(qsfp14_present , S_IRUGO , qsfp_present_get , NULL , 14); +static SENSOR_DEVICE_ATTR(qsfp15_present , S_IRUGO , qsfp_present_get , NULL , 15); +static SENSOR_DEVICE_ATTR(qsfp16_present , S_IRUGO , qsfp_present_get , NULL , 16); +static SENSOR_DEVICE_ATTR(qsfp17_present , S_IRUGO , qsfp_present_get , NULL , 17); +static SENSOR_DEVICE_ATTR(qsfp18_present , S_IRUGO , qsfp_present_get , NULL , 18); +static SENSOR_DEVICE_ATTR(qsfp19_present , S_IRUGO , qsfp_present_get , NULL , 19); +static SENSOR_DEVICE_ATTR(qsfp20_present , S_IRUGO , qsfp_present_get , NULL , 20); +static SENSOR_DEVICE_ATTR(qsfp21_present , S_IRUGO , qsfp_present_get , NULL , 21); +static SENSOR_DEVICE_ATTR(qsfp22_present , S_IRUGO , qsfp_present_get , NULL , 22); +static SENSOR_DEVICE_ATTR(qsfp23_present , S_IRUGO , qsfp_present_get , NULL , 23); +static SENSOR_DEVICE_ATTR(qsfp24_present , S_IRUGO , qsfp_present_get , NULL , 24); +static SENSOR_DEVICE_ATTR(qsfp25_present , S_IRUGO , qsfp_present_get , NULL , 25); +static SENSOR_DEVICE_ATTR(qsfp26_present , S_IRUGO , qsfp_present_get , NULL , 26); +static SENSOR_DEVICE_ATTR(qsfp27_present , S_IRUGO , qsfp_present_get , NULL , 27); +static SENSOR_DEVICE_ATTR(qsfp28_present , S_IRUGO , qsfp_present_get , NULL , 28); +static SENSOR_DEVICE_ATTR(qsfp29_present , S_IRUGO , qsfp_present_get , NULL , 29); +static SENSOR_DEVICE_ATTR(qsfp30_present , S_IRUGO , qsfp_present_get , NULL , 30); +static SENSOR_DEVICE_ATTR(qsfp31_present , S_IRUGO , qsfp_present_get , NULL , 31); +static SENSOR_DEVICE_ATTR(qsfp32_present , S_IRUGO , qsfp_present_get , NULL , 32); +static SENSOR_DEVICE_ATTR(qsfp_int_all , S_IRUGO , qsfp_int_all_get , NULL , QSFP_INT_ALL); +static SENSOR_DEVICE_ATTR(qsfp1_int , S_IRUGO , qsfp_int_get , NULL , 1); +static SENSOR_DEVICE_ATTR(qsfp2_int , S_IRUGO , qsfp_int_get , NULL , 2); +static SENSOR_DEVICE_ATTR(qsfp3_int , S_IRUGO , qsfp_int_get , NULL , 3); +static SENSOR_DEVICE_ATTR(qsfp4_int , S_IRUGO , qsfp_int_get , NULL , 4); +static SENSOR_DEVICE_ATTR(qsfp5_int , S_IRUGO , qsfp_int_get , NULL , 5); +static SENSOR_DEVICE_ATTR(qsfp6_int , S_IRUGO , qsfp_int_get , NULL , 6); +static SENSOR_DEVICE_ATTR(qsfp7_int , S_IRUGO , qsfp_int_get , NULL , 7); +static SENSOR_DEVICE_ATTR(qsfp8_int , S_IRUGO , qsfp_int_get , NULL , 8); +static SENSOR_DEVICE_ATTR(qsfp9_int , S_IRUGO , qsfp_int_get , NULL , 9); +static SENSOR_DEVICE_ATTR(qsfp10_int , S_IRUGO , qsfp_int_get , NULL , 10); +static SENSOR_DEVICE_ATTR(qsfp11_int , S_IRUGO , qsfp_int_get , NULL , 11); +static SENSOR_DEVICE_ATTR(qsfp12_int , S_IRUGO , qsfp_int_get , NULL , 12); +static SENSOR_DEVICE_ATTR(qsfp13_int , S_IRUGO , qsfp_int_get , NULL , 13); +static SENSOR_DEVICE_ATTR(qsfp14_int , S_IRUGO , qsfp_int_get , NULL , 14); +static SENSOR_DEVICE_ATTR(qsfp15_int , S_IRUGO , qsfp_int_get , NULL , 15); +static SENSOR_DEVICE_ATTR(qsfp16_int , S_IRUGO , qsfp_int_get , NULL , 16); +static SENSOR_DEVICE_ATTR(qsfp17_int , S_IRUGO , qsfp_int_get , NULL , 17); +static SENSOR_DEVICE_ATTR(qsfp18_int , S_IRUGO , qsfp_int_get , NULL , 18); +static SENSOR_DEVICE_ATTR(qsfp19_int , S_IRUGO , qsfp_int_get , NULL , 19); +static SENSOR_DEVICE_ATTR(qsfp20_int , S_IRUGO , qsfp_int_get , NULL , 20); +static SENSOR_DEVICE_ATTR(qsfp21_int , S_IRUGO , qsfp_int_get , NULL , 21); +static SENSOR_DEVICE_ATTR(qsfp22_int , S_IRUGO , qsfp_int_get , NULL , 22); +static SENSOR_DEVICE_ATTR(qsfp23_int , S_IRUGO , qsfp_int_get , NULL , 23); +static SENSOR_DEVICE_ATTR(qsfp24_int , S_IRUGO , qsfp_int_get , NULL , 24); +static SENSOR_DEVICE_ATTR(qsfp25_int , S_IRUGO , qsfp_int_get , NULL , 25); +static SENSOR_DEVICE_ATTR(qsfp26_int , S_IRUGO , qsfp_int_get , NULL , 26); +static SENSOR_DEVICE_ATTR(qsfp27_int , S_IRUGO , qsfp_int_get , NULL , 27); +static SENSOR_DEVICE_ATTR(qsfp28_int , S_IRUGO , qsfp_int_get , NULL , 28); +static SENSOR_DEVICE_ATTR(qsfp29_int , S_IRUGO , qsfp_int_get , NULL , 29); +static SENSOR_DEVICE_ATTR(qsfp30_int , S_IRUGO , qsfp_int_get , NULL , 30); +static SENSOR_DEVICE_ATTR(qsfp31_int , S_IRUGO , qsfp_int_get , NULL , 31); +static SENSOR_DEVICE_ATTR(qsfp32_int , S_IRUGO , qsfp_int_get , NULL , 32); +static SENSOR_DEVICE_ATTR(qsfp1_4_int , S_IRUGO , qsfp_quter_int_get , NULL , 1); +static SENSOR_DEVICE_ATTR(qsfp2_4_int , S_IRUGO , qsfp_quter_int_get , NULL , 2); +static SENSOR_DEVICE_ATTR(qsfp3_4_int , S_IRUGO , qsfp_quter_int_get , NULL , 3); +static SENSOR_DEVICE_ATTR(qsfp4_4_int , S_IRUGO , qsfp_quter_int_get , NULL , 4); +static SENSOR_DEVICE_ATTR(qsfp1_4_modprs , S_IRUGO , qsfp_modprs_int_get , NULL , 1); +static SENSOR_DEVICE_ATTR(qsfp2_4_modprs , S_IRUGO , qsfp_modprs_int_get , NULL , 2); +static SENSOR_DEVICE_ATTR(qsfp3_4_modprs , S_IRUGO , qsfp_modprs_int_get , NULL , 3); +static SENSOR_DEVICE_ATTR(qsfp4_4_modprs , S_IRUGO , qsfp_modprs_int_get , NULL , 4); +static SENSOR_DEVICE_ATTR(qsfp1_4_int_mask , S_IRUGO | S_IWUSR , qsfp_quter_int_mask_get , qsfp_quter_int_mask_set , 1); +static SENSOR_DEVICE_ATTR(qsfp2_4_int_mask , S_IRUGO | S_IWUSR , qsfp_quter_int_mask_get , qsfp_quter_int_mask_set , 2); +static SENSOR_DEVICE_ATTR(qsfp3_4_int_mask , S_IRUGO | S_IWUSR , qsfp_quter_int_mask_get , qsfp_quter_int_mask_set , 3); +static SENSOR_DEVICE_ATTR(qsfp4_4_int_mask , S_IRUGO | S_IWUSR , qsfp_quter_int_mask_get , qsfp_quter_int_mask_set , 4); +static SENSOR_DEVICE_ATTR(qsfp1_4_modprs_mask , S_IRUGO | S_IWUSR , qsfp_modprs_int_mask_get , qsfp_modprs_int_mask_set , 1); +static SENSOR_DEVICE_ATTR(qsfp2_4_modprs_mask , S_IRUGO | S_IWUSR , qsfp_modprs_int_mask_get , qsfp_modprs_int_mask_set , 2); +static SENSOR_DEVICE_ATTR(qsfp3_4_modprs_mask , S_IRUGO | S_IWUSR , qsfp_modprs_int_mask_get , qsfp_modprs_int_mask_set , 3); +static SENSOR_DEVICE_ATTR(qsfp4_4_modprs_mask , S_IRUGO | S_IWUSR , qsfp_modprs_int_mask_get , qsfp_modprs_int_mask_set , 4); +/* end of sysfs attributes for SENSOR_DEVICE_ATTR */ + +/* sysfs attributes for hwmon */ +/* i2c-0 */ +static struct attribute *ESC602_SYS_attributes[] = +{ + &sensor_dev_attr_cpld_23_ver.dev_attr.attr, + &sensor_dev_attr_cpld_30_ver.dev_attr.attr, + &sensor_dev_attr_cpld_31_ver.dev_attr.attr, + &sensor_dev_attr_cpld_32_ver.dev_attr.attr, + &sensor_dev_attr_wdt_en.dev_attr.attr, + &sensor_dev_attr_eeprom_wp.dev_attr.attr, + &sensor_dev_attr_usb_en.dev_attr.attr, + &sensor_dev_attr_shutdown_set.dev_attr.attr, + &sensor_dev_attr_reset.dev_attr.attr, + &sensor_dev_attr_bmc_present.dev_attr.attr, + &sensor_dev_attr_cpld_fp_int.dev_attr.attr, + &sensor_dev_attr_cpld_rp_int.dev_attr.attr, + &sensor_dev_attr_cpld_fan_int.dev_attr.attr, + &sensor_dev_attr_cpld_psu_int.dev_attr.attr, + &sensor_dev_attr_thermal_int.dev_attr.attr, + &sensor_dev_attr_usb_int.dev_attr.attr, + &sensor_dev_attr_cpld_fp_int_mask.dev_attr.attr, + &sensor_dev_attr_cpld_rp_int_mask.dev_attr.attr, + &sensor_dev_attr_cpld_fan_int_mask.dev_attr.attr, + &sensor_dev_attr_cpld_psu_int_mask.dev_attr.attr, + &sensor_dev_attr_thermal_int_mask.dev_attr.attr, + &sensor_dev_attr_usb_int_mask.dev_attr.attr, + NULL +}; +static struct attribute *ESC602_LED_attributes[] = +{ + &sensor_dev_attr_led_1.dev_attr.attr, + &sensor_dev_attr_led_2.dev_attr.attr, + &sensor_dev_attr_led_flow.dev_attr.attr, + &sensor_dev_attr_led_sys.dev_attr.attr, + &sensor_dev_attr_led_fiber.dev_attr.attr, + NULL +}; +static struct attribute *ESC602_THERMAL_attributes[] = +{ + &sensor_dev_attr_temp_r_b_f.dev_attr.attr, + &sensor_dev_attr_temp_r_b_b.dev_attr.attr, + &sensor_dev_attr_temp_l_b_f.dev_attr.attr, + &sensor_dev_attr_temp_l_b_b.dev_attr.attr, + &sensor_dev_attr_temp_r_t_f.dev_attr.attr, + &sensor_dev_attr_temp_r_t_b.dev_attr.attr, + &sensor_dev_attr_temp_l_t_f.dev_attr.attr, + &sensor_dev_attr_temp_l_t_b.dev_attr.attr, + &sensor_dev_attr_temp_r_b_int.dev_attr.attr, + &sensor_dev_attr_temp_l_b_int.dev_attr.attr, + &sensor_dev_attr_temp_r_t_int.dev_attr.attr, + &sensor_dev_attr_temp_l_t_int.dev_attr.attr, + &sensor_dev_attr_temp_r_b_int_mask.dev_attr.attr, + &sensor_dev_attr_temp_l_b_int_mask.dev_attr.attr, + &sensor_dev_attr_temp_r_t_int_mask.dev_attr.attr, + &sensor_dev_attr_temp_l_t_int_mask.dev_attr.attr, + &sensor_dev_attr_temp_r_b_f_max.dev_attr.attr, + &sensor_dev_attr_temp_r_b_f_min.dev_attr.attr, + &sensor_dev_attr_temp_r_b_f_crit.dev_attr.attr, + &sensor_dev_attr_temp_r_b_f_lcrit.dev_attr.attr, + &sensor_dev_attr_temp_r_b_b_max.dev_attr.attr, + &sensor_dev_attr_temp_r_b_b_min.dev_attr.attr, + &sensor_dev_attr_temp_r_b_b_crit.dev_attr.attr, + &sensor_dev_attr_temp_r_b_b_lcrit.dev_attr.attr, + &sensor_dev_attr_temp_l_b_f_max.dev_attr.attr, + &sensor_dev_attr_temp_l_b_f_min.dev_attr.attr, + &sensor_dev_attr_temp_l_b_f_crit.dev_attr.attr, + &sensor_dev_attr_temp_l_b_f_lcrit.dev_attr.attr, + &sensor_dev_attr_temp_l_b_b_max.dev_attr.attr, + &sensor_dev_attr_temp_l_b_b_min.dev_attr.attr, + &sensor_dev_attr_temp_l_b_b_crit.dev_attr.attr, + &sensor_dev_attr_temp_l_b_b_lcrit.dev_attr.attr, + &sensor_dev_attr_temp_r_t_f_max.dev_attr.attr, + &sensor_dev_attr_temp_r_t_f_min.dev_attr.attr, + &sensor_dev_attr_temp_r_t_f_crit.dev_attr.attr, + &sensor_dev_attr_temp_r_t_f_lcrit.dev_attr.attr, + &sensor_dev_attr_temp_r_t_b_max.dev_attr.attr, + &sensor_dev_attr_temp_r_t_b_min.dev_attr.attr, + &sensor_dev_attr_temp_r_t_b_crit.dev_attr.attr, + &sensor_dev_attr_temp_r_t_b_lcrit.dev_attr.attr, + &sensor_dev_attr_temp_l_t_f_max.dev_attr.attr, + &sensor_dev_attr_temp_l_t_f_min.dev_attr.attr, + &sensor_dev_attr_temp_l_t_f_crit.dev_attr.attr, + &sensor_dev_attr_temp_l_t_f_lcrit.dev_attr.attr, + &sensor_dev_attr_temp_l_t_b_max.dev_attr.attr, + &sensor_dev_attr_temp_l_t_b_min.dev_attr.attr, + &sensor_dev_attr_temp_l_t_b_crit.dev_attr.attr, + &sensor_dev_attr_temp_l_t_b_lcrit.dev_attr.attr, + NULL +}; +static struct attribute *ESC602_FAN_attributes[] = +{ + &sensor_dev_attr_fanctrl_rpm.dev_attr.attr, + &sensor_dev_attr_fanctrl_mode.dev_attr.attr, + &sensor_dev_attr_fan1_stat.dev_attr.attr, + &sensor_dev_attr_fan2_stat.dev_attr.attr, + &sensor_dev_attr_fan3_stat.dev_attr.attr, + &sensor_dev_attr_fan4_stat.dev_attr.attr, + &sensor_dev_attr_fan5_stat.dev_attr.attr, + &sensor_dev_attr_fan1_present.dev_attr.attr, + &sensor_dev_attr_fan2_present.dev_attr.attr, + &sensor_dev_attr_fan3_present.dev_attr.attr, + &sensor_dev_attr_fan4_present.dev_attr.attr, + &sensor_dev_attr_fan5_present.dev_attr.attr, + &sensor_dev_attr_fan1_power.dev_attr.attr, + &sensor_dev_attr_fan2_power.dev_attr.attr, + &sensor_dev_attr_fan3_power.dev_attr.attr, + &sensor_dev_attr_fan4_power.dev_attr.attr, + &sensor_dev_attr_fan5_power.dev_attr.attr, + &sensor_dev_attr_fan1_front_rpm.dev_attr.attr, + &sensor_dev_attr_fan2_front_rpm.dev_attr.attr, + &sensor_dev_attr_fan3_front_rpm.dev_attr.attr, + &sensor_dev_attr_fan4_front_rpm.dev_attr.attr, + &sensor_dev_attr_fan5_front_rpm.dev_attr.attr, + &sensor_dev_attr_fan1_rear_rpm.dev_attr.attr, + &sensor_dev_attr_fan2_rear_rpm.dev_attr.attr, + &sensor_dev_attr_fan3_rear_rpm.dev_attr.attr, + &sensor_dev_attr_fan4_rear_rpm.dev_attr.attr, + &sensor_dev_attr_fan5_rear_rpm.dev_attr.attr, + NULL +}; +static struct attribute *ESC602_POWER_attributes[] = +{ + &sensor_dev_attr_psu1_good.dev_attr.attr, + &sensor_dev_attr_psu2_good.dev_attr.attr, + &sensor_dev_attr_psu1_prnt.dev_attr.attr, + &sensor_dev_attr_psu2_prnt.dev_attr.attr, + &sensor_dev_attr_psu1_vin.dev_attr.attr, + &sensor_dev_attr_psu1_iin.dev_attr.attr, + &sensor_dev_attr_psu1_vout.dev_attr.attr, + &sensor_dev_attr_psu1_iout.dev_attr.attr, + &sensor_dev_attr_psu1_temp.dev_attr.attr, + &sensor_dev_attr_psu1_fan_speed.dev_attr.attr, + &sensor_dev_attr_psu1_pout.dev_attr.attr, + &sensor_dev_attr_psu1_pin.dev_attr.attr, + &sensor_dev_attr_psu1_mfr_model.dev_attr.attr, + &sensor_dev_attr_psu1_mfr_iout_max.dev_attr.attr, + &sensor_dev_attr_psu1_vomde.dev_attr.attr, + &sensor_dev_attr_psu2_vin.dev_attr.attr, + &sensor_dev_attr_psu2_iin.dev_attr.attr, + &sensor_dev_attr_psu2_vout.dev_attr.attr, + &sensor_dev_attr_psu2_iout.dev_attr.attr, + &sensor_dev_attr_psu2_temp.dev_attr.attr, + &sensor_dev_attr_psu2_fan_speed.dev_attr.attr, + &sensor_dev_attr_psu2_pout.dev_attr.attr, + &sensor_dev_attr_psu2_pin.dev_attr.attr, + &sensor_dev_attr_psu2_mfr_model.dev_attr.attr, + &sensor_dev_attr_psu2_mfr_iout_max.dev_attr.attr, + &sensor_dev_attr_psu2_vomde.dev_attr.attr, + &sensor_dev_attr_dc6e_p0_vout.dev_attr.attr, + &sensor_dev_attr_dc6e_p0_iout.dev_attr.attr, + &sensor_dev_attr_dc6e_p0_pout.dev_attr.attr, + &sensor_dev_attr_dc6e_p1_vout.dev_attr.attr, + &sensor_dev_attr_dc6e_p1_iout.dev_attr.attr, + &sensor_dev_attr_dc6e_p1_pout.dev_attr.attr, + &sensor_dev_attr_dc70_p0_vout.dev_attr.attr, + &sensor_dev_attr_dc70_p0_iout.dev_attr.attr, + &sensor_dev_attr_dc70_p0_pout.dev_attr.attr, + &sensor_dev_attr_dc70_p1_vout.dev_attr.attr, + &sensor_dev_attr_dc70_p1_iout.dev_attr.attr, + &sensor_dev_attr_dc70_p1_pout.dev_attr.attr, + NULL +}; +static struct attribute *ESC602_QSFP_attributes[] = +{ + &sensor_dev_attr_qsfp_low_power_all.dev_attr.attr, + &sensor_dev_attr_qsfp1_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp2_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp3_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp4_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp5_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp6_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp7_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp8_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp9_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp10_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp11_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp12_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp13_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp14_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp15_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp16_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp17_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp18_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp19_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp20_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp21_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp22_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp23_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp24_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp25_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp26_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp27_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp28_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp29_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp30_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp31_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp32_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp_reset_all.dev_attr.attr, + &sensor_dev_attr_qsfp1_reset.dev_attr.attr, + &sensor_dev_attr_qsfp2_reset.dev_attr.attr, + &sensor_dev_attr_qsfp3_reset.dev_attr.attr, + &sensor_dev_attr_qsfp4_reset.dev_attr.attr, + &sensor_dev_attr_qsfp5_reset.dev_attr.attr, + &sensor_dev_attr_qsfp6_reset.dev_attr.attr, + &sensor_dev_attr_qsfp7_reset.dev_attr.attr, + &sensor_dev_attr_qsfp8_reset.dev_attr.attr, + &sensor_dev_attr_qsfp9_reset.dev_attr.attr, + &sensor_dev_attr_qsfp10_reset.dev_attr.attr, + &sensor_dev_attr_qsfp11_reset.dev_attr.attr, + &sensor_dev_attr_qsfp12_reset.dev_attr.attr, + &sensor_dev_attr_qsfp13_reset.dev_attr.attr, + &sensor_dev_attr_qsfp14_reset.dev_attr.attr, + &sensor_dev_attr_qsfp15_reset.dev_attr.attr, + &sensor_dev_attr_qsfp16_reset.dev_attr.attr, + &sensor_dev_attr_qsfp17_reset.dev_attr.attr, + &sensor_dev_attr_qsfp18_reset.dev_attr.attr, + &sensor_dev_attr_qsfp19_reset.dev_attr.attr, + &sensor_dev_attr_qsfp20_reset.dev_attr.attr, + &sensor_dev_attr_qsfp21_reset.dev_attr.attr, + &sensor_dev_attr_qsfp22_reset.dev_attr.attr, + &sensor_dev_attr_qsfp23_reset.dev_attr.attr, + &sensor_dev_attr_qsfp24_reset.dev_attr.attr, + &sensor_dev_attr_qsfp25_reset.dev_attr.attr, + &sensor_dev_attr_qsfp26_reset.dev_attr.attr, + &sensor_dev_attr_qsfp27_reset.dev_attr.attr, + &sensor_dev_attr_qsfp28_reset.dev_attr.attr, + &sensor_dev_attr_qsfp29_reset.dev_attr.attr, + &sensor_dev_attr_qsfp30_reset.dev_attr.attr, + &sensor_dev_attr_qsfp31_reset.dev_attr.attr, + &sensor_dev_attr_qsfp32_reset.dev_attr.attr, + &sensor_dev_attr_qsfp_present_all.dev_attr.attr, + &sensor_dev_attr_qsfp1_present.dev_attr.attr, + &sensor_dev_attr_qsfp2_present.dev_attr.attr, + &sensor_dev_attr_qsfp3_present.dev_attr.attr, + &sensor_dev_attr_qsfp4_present.dev_attr.attr, + &sensor_dev_attr_qsfp5_present.dev_attr.attr, + &sensor_dev_attr_qsfp6_present.dev_attr.attr, + &sensor_dev_attr_qsfp7_present.dev_attr.attr, + &sensor_dev_attr_qsfp8_present.dev_attr.attr, + &sensor_dev_attr_qsfp9_present.dev_attr.attr, + &sensor_dev_attr_qsfp10_present.dev_attr.attr, + &sensor_dev_attr_qsfp11_present.dev_attr.attr, + &sensor_dev_attr_qsfp12_present.dev_attr.attr, + &sensor_dev_attr_qsfp13_present.dev_attr.attr, + &sensor_dev_attr_qsfp14_present.dev_attr.attr, + &sensor_dev_attr_qsfp15_present.dev_attr.attr, + &sensor_dev_attr_qsfp16_present.dev_attr.attr, + &sensor_dev_attr_qsfp17_present.dev_attr.attr, + &sensor_dev_attr_qsfp18_present.dev_attr.attr, + &sensor_dev_attr_qsfp19_present.dev_attr.attr, + &sensor_dev_attr_qsfp20_present.dev_attr.attr, + &sensor_dev_attr_qsfp21_present.dev_attr.attr, + &sensor_dev_attr_qsfp22_present.dev_attr.attr, + &sensor_dev_attr_qsfp23_present.dev_attr.attr, + &sensor_dev_attr_qsfp24_present.dev_attr.attr, + &sensor_dev_attr_qsfp25_present.dev_attr.attr, + &sensor_dev_attr_qsfp26_present.dev_attr.attr, + &sensor_dev_attr_qsfp27_present.dev_attr.attr, + &sensor_dev_attr_qsfp28_present.dev_attr.attr, + &sensor_dev_attr_qsfp29_present.dev_attr.attr, + &sensor_dev_attr_qsfp30_present.dev_attr.attr, + &sensor_dev_attr_qsfp31_present.dev_attr.attr, + &sensor_dev_attr_qsfp32_present.dev_attr.attr, + &sensor_dev_attr_qsfp_int_all.dev_attr.attr, + &sensor_dev_attr_qsfp1_int.dev_attr.attr, + &sensor_dev_attr_qsfp2_int.dev_attr.attr, + &sensor_dev_attr_qsfp3_int.dev_attr.attr, + &sensor_dev_attr_qsfp4_int.dev_attr.attr, + &sensor_dev_attr_qsfp5_int.dev_attr.attr, + &sensor_dev_attr_qsfp6_int.dev_attr.attr, + &sensor_dev_attr_qsfp7_int.dev_attr.attr, + &sensor_dev_attr_qsfp8_int.dev_attr.attr, + &sensor_dev_attr_qsfp9_int.dev_attr.attr, + &sensor_dev_attr_qsfp10_int.dev_attr.attr, + &sensor_dev_attr_qsfp11_int.dev_attr.attr, + &sensor_dev_attr_qsfp12_int.dev_attr.attr, + &sensor_dev_attr_qsfp13_int.dev_attr.attr, + &sensor_dev_attr_qsfp14_int.dev_attr.attr, + &sensor_dev_attr_qsfp15_int.dev_attr.attr, + &sensor_dev_attr_qsfp16_int.dev_attr.attr, + &sensor_dev_attr_qsfp17_int.dev_attr.attr, + &sensor_dev_attr_qsfp18_int.dev_attr.attr, + &sensor_dev_attr_qsfp19_int.dev_attr.attr, + &sensor_dev_attr_qsfp20_int.dev_attr.attr, + &sensor_dev_attr_qsfp21_int.dev_attr.attr, + &sensor_dev_attr_qsfp22_int.dev_attr.attr, + &sensor_dev_attr_qsfp23_int.dev_attr.attr, + &sensor_dev_attr_qsfp24_int.dev_attr.attr, + &sensor_dev_attr_qsfp25_int.dev_attr.attr, + &sensor_dev_attr_qsfp26_int.dev_attr.attr, + &sensor_dev_attr_qsfp27_int.dev_attr.attr, + &sensor_dev_attr_qsfp28_int.dev_attr.attr, + &sensor_dev_attr_qsfp29_int.dev_attr.attr, + &sensor_dev_attr_qsfp30_int.dev_attr.attr, + &sensor_dev_attr_qsfp31_int.dev_attr.attr, + &sensor_dev_attr_qsfp32_int.dev_attr.attr, + &sensor_dev_attr_qsfp1_4_int.dev_attr.attr, + &sensor_dev_attr_qsfp2_4_int.dev_attr.attr, + &sensor_dev_attr_qsfp3_4_int.dev_attr.attr, + &sensor_dev_attr_qsfp4_4_int.dev_attr.attr, + &sensor_dev_attr_qsfp1_4_modprs.dev_attr.attr, + &sensor_dev_attr_qsfp2_4_modprs.dev_attr.attr, + &sensor_dev_attr_qsfp3_4_modprs.dev_attr.attr, + &sensor_dev_attr_qsfp4_4_modprs.dev_attr.attr, + &sensor_dev_attr_qsfp1_4_int_mask.dev_attr.attr, + &sensor_dev_attr_qsfp2_4_int_mask.dev_attr.attr, + &sensor_dev_attr_qsfp3_4_int_mask.dev_attr.attr, + &sensor_dev_attr_qsfp4_4_int_mask.dev_attr.attr, + &sensor_dev_attr_qsfp1_4_modprs_mask.dev_attr.attr, + &sensor_dev_attr_qsfp2_4_modprs_mask.dev_attr.attr, + &sensor_dev_attr_qsfp3_4_modprs_mask.dev_attr.attr, + &sensor_dev_attr_qsfp4_4_modprs_mask.dev_attr.attr, + NULL +}; +/* end of sysfs attributes for hwmon */ + +/* struct attribute_group */ +static const struct attribute_group ESC602_SYS_group = +{ + .name = "ESC602_SYS", + .attrs = ESC602_SYS_attributes, +}; + +static const struct attribute_group ESC602_LED_group = +{ + .name = "ESC602_LED", + .attrs = ESC602_LED_attributes, +}; + +static const struct attribute_group ESC602_THERMAL_group = +{ + .name = "ESC602_THERMAL", + .attrs = ESC602_THERMAL_attributes, +}; + +static const struct attribute_group ESC602_FAN_group = +{ + .name = "ESC602_FAN", + .attrs = ESC602_FAN_attributes, +}; + +static const struct attribute_group ESC602_POWER_group = +{ + .name = "ESC602_POWER", + .attrs = ESC602_POWER_attributes, +}; + +static const struct attribute_group ESC602_QSFP_group = +{ + .name = "ESC602_QSFP", + .attrs = ESC602_QSFP_attributes, +}; +/* end of struct attribute_group */ diff --git a/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q.txt b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q.txt new file mode 100644 index 0000000000..0e423a8abf --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/x86-64-cameo-esc602-32q.txt @@ -0,0 +1,38 @@ +/*------------------------ Software Release Note ------------------------------ + * + * This document is the Standard Format for Software Release Note. + * + *----------------------------------------------------------------------------*/ + +******************************************************************************** +*[PRODUCT NAME] : ESQC610 56SQ * +******************************************************************************** +_______________________________________________________________________________ + RELEASE VERSION : 1.0 + RELEASE DATE : 2020/08/18 + RELEASE BY : Weian Tien +_______________________________________________________________________________ + +1. New Features: +------------- +Initial version for ESC602-32Q +------------- + +2. Bug Fixed: +------------- +N/A +------------- + +3. Known Issue: +------------- +N/A +------------- + +4. Changed (Spec Changed info): +------------- +N/A +------------- + +Note: +------------- +_____________________________________[END]______________________________________ \ No newline at end of file diff --git a/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/zrh2800k2.c b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/zrh2800k2.c new file mode 100644 index 0000000000..a24b2b8836 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/modules/zrh2800k2.c @@ -0,0 +1,684 @@ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DEBUG_MSG +#ifdef DEBUG_MSG + #define debug_print(s) printk s +#else + #define debug_print(s) +#endif + +//#define SYMBOL_FOR_LM_SENSOR + + +struct zrh2800k2_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u64 last_energy_value_EIN; + u64 last_smaple_count_EIN; + u64 last_energy_value_EOUT; + u64 last_smaple_count_EOUT; +}; + +typedef enum _access_type_{ + READ_BYTE, + READ_WORD, + READ_BLOCK +}ACCESS_TYPE; + +typedef enum _value_format_{ + FORMAT_NORMAL, + FORMAT_DIRECT, + FORMAT_LINEAR +}VALUE_FORMAT; + +typedef enum _zrh2800k2_regs_ { + REG_CAPABILITY = 0x19, + REG_QUERY = 0X1A, + REG_VOUT_MODE = 0x20, + REG_COEFFICIENTS = 0X30, + REG_FAN_CONFIG_1_2 = 0x3A, + REG_STATUS_WORD = 0x79, + REG_STATUS_VOUT = 0x7A, + REG_STATUS_IOUT = 0x7B, + REG_STATUS_INPUT = 0x7C, + REG_STATUS_TEMPERATURE = 0x7D, + REG_STATUS_FANS_1_2 = 0x81, + REG_READ_EIN = 0x86, /* direct data format */ + REG_READ_EOUT = 0x87, /* direct data format */ + REG_READ_VIN = 0x88, + REG_READ_IIN = 0x89, + REG_READ_VOUT = 0x8B, /* linear data format */ + REG_READ_IOUT = 0x8C, /* linear data format */ + REG_READ_TEMPERATURE1 = 0x8D, /* linear data format */ + REG_READ_FAN_SPEED_1 = 0x90, /* linear data format */ + REG_READ_POUT = 0x96, /* linear data format */ + REG_READ_PIN = 0x97, /* linear data format */ + REG_READ_PMBUS_REVISION = 0x98, + REG_READ_MFR_ID = 0x99, /* ZIPPY 5 BYTES */ + REG_READ_MFR_MODEL = 0x9A, + REG_READ_MFR_VIN_MAX = 0xA4, /* linear data format */ + REG_READ_MFR_IOUT_MAX = 0xA6 /* lineat data format */ +}ZRH2800K2_REGS; + +enum zrh2800k2_sysfs_attributes { + PSU_CAPABILITY, /* 0 */ + PSU_QUERY, + PSU_VOUT_MODE, + PSU_COEFFICIENTS, + PSU_FAN_CONFIG_1_2, + PSU_STATUS_WORD, /* 5 */ + PSU_STATUS_VOUT, + PSU_STATUS_IOUT, + PSU_STATUS_INPUT, + PSU_STATUS_TEMPERATURE, + PSU_STATUS_FANS_1_2, /* 10 */ + PSU_EIN, + PSU_EOUT, + PSU_VIN, + PSU_IIN, + PSU_VOUT, /* 15 */ + PSU_IOUT, + PSU_TEMPERATURE_1, + PSU_FAN_SPEED_1, + PSU_POUT, + PSU_PIN, /* 20 */ + PSU_PMBUS_REVISION, + PSU_MFR_ID, + PSU_MFR_MODEL, + PSU_MFR_VIN_MAX, + PSU_MFR_IOUT_MAX +}; + +struct _OPERATION_SET_ { + ZRH2800K2_REGS reg; + ACCESS_TYPE type; + u8 data_size; // unit: byte, only used for block read +}; + +/* the index of operations are mapping to the zrh2800k2_sysfs_attributes */ +static struct _OPERATION_SET_ operation_set[] = { + { REG_CAPABILITY, READ_BYTE, 1 }, // 0 + { REG_QUERY, READ_BYTE, 1}, // 1 + { REG_VOUT_MODE, READ_BYTE, 1 }, // 2 + { REG_COEFFICIENTS, READ_BLOCK, 5 }, // 3 + { REG_FAN_CONFIG_1_2 , READ_BYTE, 1 }, // 4 + { REG_STATUS_WORD, READ_WORD, 2 }, // 5 + { REG_STATUS_VOUT, READ_BYTE, 1 }, // 6 + { REG_STATUS_IOUT, READ_BYTE, 1 }, // 7 + { REG_STATUS_INPUT, READ_BYTE, 1 }, // 8 + { REG_STATUS_TEMPERATURE, READ_BYTE, 1 }, //9 + { REG_STATUS_FANS_1_2, READ_BYTE, 1 }, // 10 + { REG_READ_EIN, READ_BLOCK, 6 }, // 11 + { REG_READ_EOUT, READ_BLOCK, 6 }, // 12 + { REG_READ_VIN, READ_WORD, 2 }, // 13 + { REG_READ_IIN, READ_WORD, 2 }, // 14 + { REG_READ_VOUT, READ_WORD, 2 }, // 15 + { REG_READ_IOUT, READ_WORD, 2 }, // 16 + { REG_READ_TEMPERATURE1, READ_WORD, 2 }, // 17 + { REG_READ_FAN_SPEED_1, READ_WORD, 2 }, // 18 + { REG_READ_POUT, READ_WORD, 2 }, // 19 + { REG_READ_PIN, READ_WORD, 2 }, // 20 + { REG_READ_PMBUS_REVISION, READ_BYTE, 1 }, //21 + { REG_READ_MFR_ID, READ_BLOCK, 5 }, // 22 + { REG_READ_MFR_MODEL, READ_BLOCK, 9 }, // 23 + { REG_READ_MFR_VIN_MAX, READ_WORD, 2 }, // 24 + { REG_READ_MFR_IOUT_MAX, READ_WORD, 2 } // 25 +}; + + +static int zrh2800k2_remove(struct i2c_client *client); +static int zrh2800k2_probe(struct i2c_client *client, const struct i2c_device_id *dev_id); +static ssize_t show_value(struct device *dev, struct device_attribute *da, char *buf); + +static ssize_t show_capability(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t psu_pm_query(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t psu_coefficient(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t set_fan_config(struct device *dev, struct device_attribute *da, const char *buf, size_t count); + + +/* Addresses scanned */ +static const unsigned short normal_i2c[] = { 0x58, 0x59, I2C_CLIENT_END }; + +/* sysfs attributes for hwmon */ +static SENSOR_DEVICE_ATTR(psu_query, S_IRUGO, psu_pm_query, NULL, PSU_QUERY); +static SENSOR_DEVICE_ATTR(psu_coeff, S_IRUGO, psu_coefficient,NULL, PSU_COEFFICIENTS); +static SENSOR_DEVICE_ATTR(psu_fan_config_1_2, S_IRUGO|S_IWUSR, show_value, set_fan_config, PSU_FAN_CONFIG_1_2); +static SENSOR_DEVICE_ATTR(psu_capability, S_IRUGO, show_capability, NULL, PSU_CAPABILITY); +static SENSOR_DEVICE_ATTR(psu_vout_mode, S_IRUGO, show_value, NULL, PSU_VOUT_MODE); +static SENSOR_DEVICE_ATTR(psu_status_word, S_IRUGO, show_value, NULL, PSU_STATUS_WORD); +static SENSOR_DEVICE_ATTR(psu_status_vout, S_IRUGO, show_value, NULL, PSU_STATUS_VOUT); +static SENSOR_DEVICE_ATTR(psu_status_iout, S_IRUGO, show_value, NULL, PSU_STATUS_IOUT); +static SENSOR_DEVICE_ATTR(psu_status_input, S_IRUGO, show_value, NULL, PSU_STATUS_INPUT); +static SENSOR_DEVICE_ATTR(psu_status_temp, S_IRUGO, show_value, NULL, PSU_STATUS_TEMPERATURE); +static SENSOR_DEVICE_ATTR(psu_status_fan_1_2, S_IRUGO, show_value, NULL, PSU_STATUS_FANS_1_2); +static SENSOR_DEVICE_ATTR(psu_ein, S_IRUGO, show_value, NULL, PSU_EIN); +static SENSOR_DEVICE_ATTR(psu_eout, S_IRUGO, show_value, NULL, PSU_EOUT); +static SENSOR_DEVICE_ATTR(psu_pmbus_rev,S_IRUGO, show_value, NULL, PSU_PMBUS_REVISION); +static SENSOR_DEVICE_ATTR(psu_mfr_id, S_IRUGO, show_value, NULL, PSU_MFR_ID); +static SENSOR_DEVICE_ATTR(psu_mfr_model,S_IRUGO, show_value, NULL, PSU_MFR_MODEL); + +static SENSOR_DEVICE_ATTR(psu_vin, S_IRUGO, show_value, NULL, PSU_VIN); +static SENSOR_DEVICE_ATTR(psu_vout, S_IRUGO, show_value, NULL, PSU_VOUT); +static SENSOR_DEVICE_ATTR(psu_iin, S_IRUGO, show_value, NULL, PSU_IIN); +static SENSOR_DEVICE_ATTR(psu_iout, S_IRUGO, show_value, NULL, PSU_IOUT); +static SENSOR_DEVICE_ATTR(psu_iout_max, S_IRUGO, show_value, NULL, PSU_MFR_IOUT_MAX); +static SENSOR_DEVICE_ATTR(psu_pin, S_IRUGO, show_value, NULL, PSU_PIN); +static SENSOR_DEVICE_ATTR(psu_pout, S_IRUGO, show_value, NULL, PSU_POUT); + +static SENSOR_DEVICE_ATTR(psu_temp_1, S_IRUGO, show_value, NULL, PSU_TEMPERATURE_1); +static SENSOR_DEVICE_ATTR(psu_fan_speed_1, S_IRUGO, show_value, NULL, PSU_FAN_SPEED_1); + +/* section for lm-sensor */ +#ifdef SYMBOL_FOR_LM_SENSOR +static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_value, NULL, PSU_VIN); +// static SENSOR_DEVICE_ATTR(in1_max, S_IRUGO, show_value, NULL, PSU_MFR_VIN_MAX); -> not support +static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_value, NULL, PSU_VOUT); +static SENSOR_DEVICE_ATTR(curr1_input, S_IRUGO, show_value, NULL, PSU_IIN); +static SENSOR_DEVICE_ATTR(curr2_input, S_IRUGO, show_value, NULL, PSU_IOUT); +static SENSOR_DEVICE_ATTR(curr2_max, S_IRUGO, show_value, NULL, PSU_MFR_IOUT_MAX); +static SENSOR_DEVICE_ATTR(power1_input, S_IRUGO, show_value, NULL, PSU_PIN); +static SENSOR_DEVICE_ATTR(power2_input, S_IRUGO, show_value, NULL, PSU_POUT); + +static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_value, NULL, PSU_TEMPERATURE_1); +static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_value, NULL, PSU_FAN_SPEED_1); +#endif + +static struct attribute *zrh2800k2_attributes[] = { + &sensor_dev_attr_psu_query.dev_attr.attr, + &sensor_dev_attr_psu_coeff.dev_attr.attr, + &sensor_dev_attr_psu_fan_config_1_2.dev_attr.attr, + &sensor_dev_attr_psu_capability.dev_attr.attr, + &sensor_dev_attr_psu_vout_mode.dev_attr.attr, + &sensor_dev_attr_psu_status_word.dev_attr.attr, + &sensor_dev_attr_psu_status_vout.dev_attr.attr, + &sensor_dev_attr_psu_status_iout.dev_attr.attr, + &sensor_dev_attr_psu_status_input.dev_attr.attr, + &sensor_dev_attr_psu_status_temp.dev_attr.attr, + &sensor_dev_attr_psu_status_fan_1_2.dev_attr.attr, + &sensor_dev_attr_psu_ein.dev_attr.attr, + &sensor_dev_attr_psu_eout.dev_attr.attr, + &sensor_dev_attr_psu_pmbus_rev.dev_attr.attr, + &sensor_dev_attr_psu_mfr_id.dev_attr.attr, + &sensor_dev_attr_psu_mfr_model.dev_attr.attr, + &sensor_dev_attr_psu_vin.dev_attr.attr, + &sensor_dev_attr_psu_vout.dev_attr.attr, + &sensor_dev_attr_psu_iin.dev_attr.attr, + &sensor_dev_attr_psu_iout.dev_attr.attr, + &sensor_dev_attr_psu_iout_max.dev_attr.attr, + &sensor_dev_attr_psu_pin.dev_attr.attr, + &sensor_dev_attr_psu_pout.dev_attr.attr, + &sensor_dev_attr_psu_temp_1.dev_attr.attr, + &sensor_dev_attr_psu_fan_speed_1.dev_attr.attr, +#ifdef SYMBOL_FOR_LM_SENSOR + &sensor_dev_attr_in1_input.dev_attr.attr, + &sensor_dev_attr_in2_input.dev_attr.attr, + &sensor_dev_attr_curr1_input.dev_attr.attr, + &sensor_dev_attr_curr2_input.dev_attr.attr, + &sensor_dev_attr_curr2_max.dev_attr.attr, + &sensor_dev_attr_power1_input.dev_attr.attr, + &sensor_dev_attr_power2_input.dev_attr.attr, + &sensor_dev_attr_temp1_input.dev_attr.attr, + &sensor_dev_attr_fan1_input.dev_attr.attr, +#endif + NULL +}; + +static const struct attribute_group zrh2800k2_group = { + .attrs = zrh2800k2_attributes, +}; + +static u32 easy_pow(u32 num, u32 power) +{ + if(power == 0) + return 1; + + power--; + + while(power) { + num = num*num; + power--; + } + return num; +} + +static int two_complement_to_int(u16 data, u8 valid_bit, int mask) +{ + u16 valid_data = data & mask; + bool is_negative = valid_data >> (valid_bit - 1); + + return is_negative ? (-(((~valid_data) & mask) + 1)) : valid_data; +} + + +static int zrh2800k2_read(struct device *dev, ACCESS_TYPE rtype , ZRH2800K2_REGS reg) +{ + + struct i2c_client *client = to_i2c_client(dev); + struct zrh2800k2_data *data = i2c_get_clientdata(client); + + int result; + + mutex_lock(&data->update_lock); + + if (rtype == READ_BYTE) { + result = i2c_smbus_read_byte_data(client, (u8)reg); + }else if(rtype == READ_WORD) { + result = i2c_smbus_read_word_data(client, (u8)reg); + }else{ + printk(KERN_ALERT "ERROR: unknown read type"); + } + + mutex_unlock(&data->update_lock); + + return result; + +} + + +static int zrh2800k2_read_block(struct device *dev, ZRH2800K2_REGS reg, u8* block_data, int block_data_len) +{ + + struct i2c_client *client = to_i2c_client(dev); + struct zrh2800k2_data *data = i2c_get_clientdata(client); + + int result; + + mutex_lock(&data->update_lock); + + result = i2c_smbus_read_i2c_block_data(client, (u8)reg, block_data_len, block_data); + + mutex_unlock(&data->update_lock); + + if (unlikely(result < 0)) { + goto read_block_exit; + } + + if (result != block_data_len) { + result = -EIO; + goto read_block_exit; + } + + result = 0; + +read_block_exit: + return result; + +} + +static int get_coefficient(struct device* dev, u16* m, u16* b, u8* R) +{ + u8 buf_block[6] = {0}; + int ret = zrh2800k2_read_block(dev, REG_COEFFICIENTS, buf_block, 6); + + + // [ byte_count,m-l,m-h,b-l,b-h,R ] + if (ret < 0) { + printk(KERN_ALERT "get coefficient fail(%d)\n", ret); + return -1; + } + + *R = buf_block[5]; + *m = buf_block[2]; + *m = ((*m)<<8 )+ buf_block[1]; + *b = buf_block[4]; + *b = ((*b)<<8 )+ buf_block[3]; + + debug_print((KERN_DEBUG " coefficient read : 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x \n", buf_block[0], buf_block[1], buf_block[2], + buf_block[3], buf_block[4], buf_block[5])); + debug_print((KERN_DEBUG " coefficient r m b: 0x%x, 0x%x, 0x%x \n", *R, *m, *b)); + + return 0; + +} + + +/* read a byte or word value and show*/ +static ssize_t show_value(struct device *dev, struct device_attribute *da, char *buf) +{ + + u16 u16_val = 0; + int exponent = 0, mantissa = 0; + int multiplier = 1000; // lm-sensor uint: mV, mA, mC + + u8 buf_block[11] = {0}; // used to save enough data from read block. + + char *ascii = NULL; + int ret = 0; + + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + debug_print((KERN_DEBUG "show value op[%d]: reg %d\n", attr->index, + operation_set[attr->index].reg )); + + switch (operation_set[attr->index].type) { + + case READ_BYTE: + case READ_WORD: + ret = zrh2800k2_read(dev, operation_set[attr->index].type , operation_set[attr->index].reg); + break; + + case READ_BLOCK: + ret = zrh2800k2_read_block(dev, operation_set[attr->index].reg, buf_block, operation_set[attr->index].data_size + 1); + break; + + default: + printk(KERN_ALERT "unknown access type\n"); + return 0; + + } + + if (ret < 0) { + printk(KERN_ALERT "ERROR: Read fail ret(%d)\n", ret); + return 0; + } + + /* arrange return buf */ + switch (attr->index) { + + /* case directly return */ + case PSU_STATUS_WORD: + case PSU_VOUT_MODE: + return sprintf(buf, "%d\n", ret); + + case PSU_STATUS_VOUT: + return sprintf(buf, + "VOUT Over Voltage Fault : %d \nVOUT Over Voltage Warning : %d \nVOUT Under Voltage Warning : %d \nVOUT Under Voltage Fault : %d \n", + (ret>>7)&0x1,(ret>>6)&0x1, + (ret>>5)&0x1,(ret>>4)&0x1); + + case PSU_STATUS_IOUT: + return sprintf(buf, + "IOUT Overcurrent Fault : %d \nIOUT Overcurrent Warnning : %d \nPOUT Overcurrent Fault : %d \nPOUT Overcurrent Warnning : %d \n", + (ret>>7)&0x1, (ret>>5)&0x1, + (ret>>1)&0x1, ret&0x1); + + case PSU_STATUS_INPUT: + return sprintf(buf, + "PIN Overpower Warning : %d \n", (ret&0x1)); + + case PSU_STATUS_TEMPERATURE: + return sprintf(buf, + "Overtemperature Fault : %d \nOvertemperature Warning : %d \nUbdertemperature Warning : %d \nUbdertemperature Fault : %d \n", + (ret>>7)&0x1,(ret>>6)&0x1, + (ret>>5)&0x1,(ret>>4)&0x1); + + case PSU_STATUS_FANS_1_2: + return sprintf(buf, + "Fan Fault : %d \nFan Warning : %d \n", + (ret>>7)&0x1, (ret>>5)&0x1); + + case PSU_FAN_CONFIG_1_2: + debug_print((KERN_DEBUG "PSU_FAN_CONFIG_1_2: 0x%X\n",ret)); + return sprintf(buf, + "Fan is installed in Position1: %s\n" \ + "Fan1 speed Unit: %s\n" \ + "Fan1 Tachometer Pulses Per Revolution 0x%x\n" \ + "Fan install in Position2: %s\n" \ + "Fan2 speed Unit: %s\n" \ + "Fan2 Tachometer Pulses Per Revolution 0x%x\n", + (ret>>7)?"YES":"NONE", + ((ret>>6)&0x1)?"RPM":"Duty Cycle", + (ret>>4)&0x3, + (ret>>3&0x01)?"YES":"NONE", + ((ret>>2)&0x1)?"RPM":"Duty Cycle", + ret&0x3); + + /* special case for READ_VOUT */ + case PSU_VOUT: + /* save mantissa */ + mantissa = ret; + + debug_print((KERN_DEBUG "PSU_VOUT: mantissa 0x%X\n",mantissa)); + + /* read the exponent from REG_READ_VMODE */ + ret = zrh2800k2_read(dev, READ_BYTE , REG_VOUT_MODE); + if (ret < 0) { + printk(KERN_ALERT "Error: Read fail ret(%d)\n", ret); + return 0; + } + exponent = two_complement_to_int(ret & 0x1f, 5, 0x1f); + + debug_print((KERN_DEBUG "PSU_VOUT: VOUT_MODE 0x%X\n",ret)); + debug_print((KERN_DEBUG "PSU_VOUT: exponent 0x%X\n",exponent)); + + return (exponent >= 0) ? sprintf(buf, "%d\n", (mantissa << exponent)*multiplier ) : \ + sprintf(buf, "%d\n", (mantissa*multiplier / (1 << -exponent))); + + /* word data with linear format */ + case PSU_POUT: + case PSU_PIN: + multiplier = 1000000; // lm-sensor unit: uW + case PSU_VIN: + case PSU_IIN: + case PSU_IOUT: + case PSU_TEMPERATURE_1: + case PSU_FAN_SPEED_1: + case PSU_MFR_VIN_MAX: + case PSU_MFR_IOUT_MAX: + + if (attr->index == PSU_FAN_SPEED_1) + multiplier = 1; + + u16_val = ret; + exponent = two_complement_to_int(u16_val >> 11, 5, 0x1f); + mantissa = two_complement_to_int(u16_val & 0x7ff, 11, 0x7ff); + + debug_print((KERN_DEBUG "REG(%d): ret 0x%X, u16_val: 0x%x\n", attr->index, ret, u16_val)); + debug_print((KERN_DEBUG "REG(%d): exponent 0x%X\n", attr->index, exponent)); + debug_print((KERN_DEBUG "REG(%d): mantissa 0x%X\n", attr->index, mantissa)); + + return (exponent >= 0) ? sprintf(buf, "%d\n", (mantissa << exponent)*multiplier ) : \ + sprintf(buf, "%d\n", (mantissa*multiplier / (1 << -exponent))); + + case PSU_EIN: + case PSU_EOUT: { + + u16 m,b; + u8 R; + + u64 ev = buf_block[2]; + u8 rc = buf_block[3]; + u64 sc = buf_block[6]; + u32 sc_mid = buf_block[5]; + u64 average_value = 0; + + struct i2c_client *client = to_i2c_client(dev); + struct zrh2800k2_data *data = i2c_get_clientdata(client); + + if (get_coefficient(dev, &m, &b, &R) < 0) { + return sprintf(buf, "ERROR, fail to get coefficient\n"); + } + + // [ bytecount, energy_count-l, energy_count-h, ROLLOVER_count , + // sample_count-l, sample_count-mid, sample_count-h ] + // maximum_direct_format_value = (m*32767+b)*(10)^R + // energy_value = Rollover_count * maximum_direct_format_value + energy_count + + debug_print((KERN_DEBUG "[ec-l,ec-h,rc,sc-l,sc-,sc-h]: [0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x]\n", buf_block[0], buf_block[1], buf_block[2], + buf_block[3], buf_block[4], buf_block[5], buf_block[6])); + + ev = rc * (m*32767+b)*easy_pow(10,R) + ((ev<<8) + buf_block[1]); + sc = (sc<<16) + (sc_mid<<8) + buf_block[4]; + + if(attr->index == PSU_EIN) { + average_value = ((ev - data->last_energy_value_EIN)*1000) / (sc - data->last_smaple_count_EIN); + data->last_energy_value_EIN = ev; + data->last_smaple_count_EIN = sc; + } else { + average_value = ((ev - data->last_energy_value_EOUT)*1000) / (sc - data->last_smaple_count_EOUT); + data->last_energy_value_EOUT = ev; + data->last_smaple_count_EOUT = sc; + } + return sprintf(buf, "%llu.%llu\n", average_value/1000, average_value%1000); + + } + + case PSU_MFR_ID: + case PSU_MFR_MODEL: + debug_print((KERN_DEBUG "[0x%x,0x%x,0x%x,0x%x,0x%x,0x%x]\n", buf_block[0], buf_block[1], buf_block[2], + buf_block[3], buf_block[4], buf_block[5])); + + ascii = &buf_block[1]; + return sprintf(buf, "%s\n", ascii); + + + case PSU_PMBUS_REVISION: + return sprintf(buf, "Part1 Revision: 1.%d, Part2 Revision: 1.%d\n", + (ret>>5), (ret&0x7) ); + + /* not implement yet */ + default: + return sprintf(buf, "not implement yet\n"); + + } + + /* should not goto here */ + return sprintf(buf, "unknown case\n"); + +} + + +static ssize_t show_capability(struct device *dev, struct device_attribute *da, char *buf) +{ + /* todo */ + return sprintf(buf, "not implement yet\n"); +} + +static ssize_t psu_pm_query(struct device *dev, struct device_attribute *da, char *buf) +{ + /* todo */ + return sprintf(buf, "not implement yet\n"); +} + +static ssize_t psu_coefficient(struct device *dev, struct device_attribute *da, char *buf) +{ + /* todo */ + return sprintf(buf, "not implement yet\n"); +} + +static ssize_t set_fan_config(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct zrh2800k2_data *data = i2c_get_clientdata(client); + + int result; + u8 input_val; + + mutex_lock(&data->update_lock); + + input_val = simple_strtol(buf, NULL, 10); + + result = i2c_smbus_write_byte_data(client, REG_FAN_CONFIG_1_2, input_val); + + mutex_unlock(&data->update_lock); + + if (result < 0) { + printk(KERN_ALERT "ERROR: SET_FAN_CONFIG %s fail\n", buf); + } else { + debug_print((KERN_DEBUG "SET_FAN_CONFIG %s success\n", buf)); + } + + + return count; + +} + + +static const struct i2c_device_id zrh2800k2_id[] = { + { "zrh2800k2", 0 }, + {} +}; + +static struct i2c_driver zrh2800k2_driver = { + .class = I2C_CLASS_HWMON, + .driver = + { + .name = "ZRH2800K2", + }, + .probe = zrh2800k2_probe, + .remove = zrh2800k2_remove, + .id_table = zrh2800k2_id, + .address_list = normal_i2c, +}; + +static int zrh2800k2_remove(struct i2c_client *client) +{ + struct zrh2800k2_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &zrh2800k2_group); + kfree(data); + return 0; + +} + +static int zrh2800k2_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + + struct zrh2800k2_data *data; + int status; + + if(!i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_BYTE_DATA | + I2C_FUNC_SMBUS_WORD_DATA)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct zrh2800k2_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &zrh2800k2_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: psu '%s'\n", dev_name(data->hwmon_dev), + client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &zrh2800k2_group); + +exit_free: + kfree(data); + +exit: + return status; + +} + + +module_i2c_driver(zrh2800k2_driver); +MODULE_AUTHOR("Cameo Inc."); +MODULE_DESCRIPTION("Power Supply zrh-2800k2 driver"); +MODULE_LICENSE("GPL"); + diff --git a/platform/innovium/sonic-platform-modules-cameo/esc602-32q/scripts/sensors b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/scripts/sensors new file mode 100755 index 0000000000..cccbf5352f --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/scripts/sensors @@ -0,0 +1,8 @@ +#!/bin/bash +docker exec -i pmon sensors "$@" + +#To probe sensors not part of lm-sensors +if [ -r /usr/local/bin/cameo_esc602_sensors.py ]; then + python /usr/local/bin/cameo_esc602_sensors.py fan_status + python /usr/local/bin/cameo_esc602_sensors.py sensor_status +fi diff --git a/platform/innovium/sonic-platform-modules-cameo/esc602-32q/service/esc602-platform-init.service b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/service/esc602-platform-init.service new file mode 100644 index 0000000000..73fd811a36 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/service/esc602-platform-init.service @@ -0,0 +1,14 @@ +[Unit] +Description=Cameo Esc602-32q Platform initialization service +After=local-fs.target innovium_platform_driver.service +Before=pmon.service + + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/cameo_esc602_startup start +ExecStop=/usr/local/bin/cameo_esc602_startup stop +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/platform/innovium/sonic-platform-modules-cameo/esc602-32q/templates/cameo_esc602_util.py.j2 b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/templates/cameo_esc602_util.py.j2 new file mode 100644 index 0000000000..92773653c6 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/templates/cameo_esc602_util.py.j2 @@ -0,0 +1,737 @@ +#!/usr/bin/env python +# +# Copyright (C) 2019 Cameo Networks, Inc. + + +""" +Usage: %(scriptName)s [options] command object + +options: + -h | --help : this help message + -d | --debug : run with debug mode + -f | --force : ignore error during installation or clean +command: + install : install drivers and generate related sysfs nodes + clean : uninstall drivers and remove related sysfs nodes + show : show all systen status + sff : dump SFP eeprom + set : change board setting with fan|led|sfp +""" + +import os +import commands +import sys, getopt +import logging +import re +import time +import json + +PROJECT_NAME = 'esc602_32q' +verbose = False +DEBUG = False +FORCE = 0 + +PLATFORM_INSTALL_INFO_FILE="/etc/sonic/platform_install.json" + +PLATFORM_DRIVER_VER = {{ env("PLATFORM_DRIVER_VER") }} + +# default is 'i2c-0', we will choose the correct one from 'i2c-0' and 'i2c-1'. +DEFAULT_BASE_BUS = 'i2c-0' +BASE_BUS = 'i2c-0' + +I2C_BASE_BUS = { + 'i2c-0':{ + 'path':'/sys/bus/i2c/devices/i2c-0', + 'status':'INSTALLED' + }, + 'i2c-1':{ + 'path':'/sys/bus/i2c/devices/i2c-1', + 'status':'INSTALLED' + } +} + +switch_install_order = [ +'PCA9548_0x73', +'PCA9548_0x71_1', +'PCA9548_0x71_2', +'PCA9548_0x71_3', +'PCA9548_0x71_4', +'PCA9548_0x75' +] + +I2C_SWITCH_LIST = { + # i2c switches + 'PCA9548_0x73': { + 'parent':'base', + 'driver':'pca9548', + 'i2caddr': '0x73', + 'path': ' ', + 'bus_map': [0,0,0,0,0,0,0,0], + 'status':'NOTINST' + }, + 'PCA9548_0x75': { + 'parent':'base', + 'driver':'pca9548', + 'i2caddr': '0x75', + 'path': ' ', + 'bus_map': [0,0,0,0,0,0,0,0], + 'status':'NOTINST' + }, + 'PCA9548_0x71_1': { + 'parent':'PCA9548_0x73', + 'parent_ch': 4, + 'driver':'pca9548', + 'i2caddr': '0x71', + 'path': ' ', + 'bus_map': [0,0,0,0,0,0,0,0], + 'status':'NOTINST' + }, + 'PCA9548_0x71_2': { + 'parent':'PCA9548_0x73', + 'parent_ch': 5, + 'driver':'pca9548', + 'i2caddr': '0x71', + 'path': ' ', + 'bus_map': [0,0,0,0,0,0,0,0], + 'status':'NOTINST' + }, + 'PCA9548_0x71_3': { + 'parent':'PCA9548_0x73', + 'parent_ch': 6, + 'driver':'pca9548', + 'i2caddr': '0x71', + 'path': ' ', + 'bus_map': [0,0,0,0,0,0,0,0], + 'status':'NOTINST' + }, + 'PCA9548_0x71_4': { + 'parent':'PCA9548_0x73', + 'parent_ch': 7, + 'driver':'pca9548', + 'i2caddr': '0x71', + 'path': ' ', + 'bus_map': [0,0,0,0,0,0,0,0], + 'status':'NOTINST' + } +} + +I2C_DEVICES = { + # sys eeprom + 'SYS_EEPROM': { + 'parent':'base', + 'driver':'24c64smbus', + 'i2caddr': '0x56', + 'path': ' ', + 'status':'NOTINST' + }, + # NCT7511Y sensor & fan control + 'NCT7511Y(U73)': { + 'parent':'PCA9548_0x75', + 'parent_ch': 0, + 'driver':'nct7511', + 'i2caddr': '0x2e', + 'path': ' ', + 'status':'NOTINST' + }, + # G781 sensors + 'G781(U94)': { + 'parent':'PCA9548_0x75', + 'parent_ch': 1, + 'driver':'g781', + 'i2caddr': '0x4c', + 'path': ' ', + 'status':'NOTINST' + }, + 'G781(U4)': { + 'parent':'PCA9548_0x75', + 'parent_ch': 2, + 'driver':'g781', + 'i2caddr': '0x4c', + 'path': ' ', + 'status':'NOTINST' + }, + 'G781(U34)': { + 'parent':'PCA9548_0x75', + 'parent_ch': 3, + 'driver':'g781', + 'i2caddr': '0x4c', + 'path': ' ', + 'status':'NOTINST' + }, + # PSU + 'PSU1': { + 'parent':'PCA9548_0x75', + 'parent_ch': 4, + 'driver':'zrh2800k2', + 'i2caddr': '0x58', + 'path': ' ', + 'status':'NOTINST' + }, + 'PSU2': { + 'parent':'PCA9548_0x75', + 'parent_ch': 4, + 'driver':'zrh2800k2', + 'i2caddr': '0x59', + 'path': ' ', + 'status':'NOTINST' + }, + 'TPS53681(0x6C)': { + 'parent':'PCA9548_0x75', + 'parent_ch': 5, + 'driver':'tps53679', + 'i2caddr': '0x6c', + 'path': ' ', + 'status':'NOTINST' + }, + 'TPS53681(0x6E)': { + 'parent':'PCA9548_0x75', + 'parent_ch': 5, + 'driver':'tps53679', + 'i2caddr': '0x6e', + 'path': ' ', + 'status':'NOTINST' + }, + 'TPS53681(0x70)': { + 'parent':'PCA9548_0x75', + 'parent_ch': 5, + 'driver':'tps53679', + 'i2caddr': '0x70', + 'path': ' ', + 'status':'NOTINST' + } +} + +SFP_GROUPS = { + 'SFP-G01' :{ + 'number': 8, + 'parent':'PCA9548_0x71_1', + 'channels':[0,1,2,3,4,5,6,7], + 'driver':'optoe1', + 'i2caddr': '0x50', + 'paths': [], + 'status':'NOTINST' + }, + 'SFP-G02' :{ + 'number': 8, + 'parent':'PCA9548_0x71_2', + 'channels':[0,1,2,3,4,5,6,7], + 'driver':'optoe1', + 'i2caddr': '0x50', + 'paths': [], + 'status':'NOTINST' + }, + 'SFP-G03' :{ + 'number': 8, + 'parent':'PCA9548_0x71_3', + 'channels':[0,1,2,3,4,5,6,7], + 'driver':'optoe1', + 'i2caddr': '0x50', + 'paths': [], + 'status':'NOTINST' + }, + 'SFP-G04' :{ + 'number': 8, + 'parent':'PCA9548_0x71_4', + 'channels':[0,1,2,3,4,5,6,7], + 'driver':'optoe1', + 'i2caddr': '0x50', + 'paths': [], + 'status':'NOTINST' + } +} + + + +if DEBUG == True: + print sys.argv[0] + print 'ARGV :', sys.argv[1:] + + +def main(): + global DEBUG + global args + global FORCE + + if len(sys.argv) < 2: + show_help() + + options, args = getopt.getopt(sys.argv[1:], 'hdf', ['help', + 'debug', + 'force', + ]) + if DEBUG == True: + print options + print args + print len(sys.argv) + + for opt, arg in options: + if opt in ('-h', '--help'): + show_help() + elif opt in ('-d', '--debug'): + DEBUG = True + logging.basicConfig(level=logging.INFO) + elif opt in ('-f', '--force'): + FORCE = 1 + else: + logging.info('no option') + for arg in args: + if arg == 'install': + do_install() + elif arg == 'clean': + do_uninstall() + elif arg == 'show': + devices_info() + elif arg == 'version': + show_version() + else: + show_help() + + return 0 + +def show_version(): + print("platform driver version: {}\n".format(PLATFORM_DRIVER_VER)) + +def show_help(): + print __doc__ % {'scriptName': sys.argv[0].split("/")[-1]} + sys.exit(0) + +def log_os_system(cmd, show): + logging.info('Run :' + cmd) + status, output = commands.getstatusoutput(cmd) + logging.info(cmd + "with result:" + str(status)) + logging.info(" output:" + output) + if status: + logging.info('Failed :' + cmd) + if show: + print('Failed ({}):'.format(status) + cmd) + return status, output + + +def driver_check(): + ret, lsmod = log_os_system("lsmod| grep cameo", 0) + logging.info('mods:' + lsmod) + if len(lsmod) == 0: + return False + return True + + +kos = [ + 'depmod -a', + 'modprobe i2c_dev', + 'modprobe x86-64-cameo-esc602-32q', + 'modprobe i2c_mux_pca954x force_deselect_on_exit=1', + 'modprobe nct7511', + 'modprobe at24_smbus', + 'modprobe at24', + 'modprobe zrh2800k2', + 'modprobe tps53679' +] + + +def driver_install(): + global FORCE + for i in range(0, len(kos)): + status, output = log_os_system(kos[i], 1) + if status: + if FORCE == 0: + return status + return 0 + + +def driver_uninstall(): + global FORCE + for i in range(0, len(kos)): + rm = kos[-(i + 1)].replace("modprobe", "modprobe -rq") + rm = rm.replace("insmod", "rmmod") + rm = rm.replace("force_deselect_on_exit=1", " ") + status, output = log_os_system(rm, 1) + if status: + if FORCE == 0: + return status + return 0 + +def check_base_bus(): + global I2C_SWITCH_LIST + global I2C_DEVICES + global SFP_GROUPS + global BASE_BUS + # we start check with the first i2c switch to install which on base bus + switch = I2C_SWITCH_LIST[switch_install_order[0]] + for bbus in I2C_BASE_BUS.keys(): + install_path = I2C_BASE_BUS[bbus]['path'] + cmd = "echo {} {} > {}/new_device".format(switch['driver'], switch['i2caddr'], install_path) + log_os_system(cmd, 1) + time.sleep(1) + cmd = "ls /sys/bus/i2c/devices/{}-00{}/channel-0".format(bbus[-1],switch['i2caddr'][-2:]) + result = log_os_system(cmd, 1)[0] + #uninstall + cmd = "echo {} > {}/delete_device".format(switch['i2caddr'], install_path) + log_os_system(cmd, 1) + if result == 0: + BASE_BUS = bbus + break + + logging.info('Base bus is {}'.format(BASE_BUS)) + + #exchange all base bus + for dev_name in I2C_SWITCH_LIST.keys(): + if I2C_SWITCH_LIST[dev_name]['parent'] == 'base': + I2C_SWITCH_LIST[dev_name]['parent'] = BASE_BUS + for dev_name in I2C_DEVICES.keys(): + if I2C_DEVICES[dev_name]['parent'] == 'base': + I2C_DEVICES[dev_name]['parent'] = BASE_BUS + for dev_name in SFP_GROUPS.keys(): + if SFP_GROUPS[dev_name]['parent'] == 'base': + SFP_GROUPS[dev_name]['parent'] = BASE_BUS + + +def get_next_bus_num(): + num_list = [] + device_list = os.listdir("/sys/bus/i2c/devices") + for x in device_list: + t = re.match(r'i2c-(\d+)', x) + if t: + num_list.append(int(t.group(1))) + logging.info('next_bus_id is {}'.format(max(num_list)+1)) + return max(num_list)+1 + +def install_i2c_switch(): + + for switch_name in switch_install_order: + next_bus_id = get_next_bus_num() + switch = I2C_SWITCH_LIST[switch_name] + if switch['parent'] in I2C_BASE_BUS: + install_path = I2C_BASE_BUS[switch['parent']]['path'] + else: + install_path = I2C_SWITCH_LIST[switch['parent']]['path'] + + if 'parent_ch' in switch: + install_path = install_path+"/channel-{}".format(switch['parent_ch']) + if I2C_SWITCH_LIST[switch['parent']]['status'] != 'INSTALLED': + continue + + cmd = "echo {} {} > {}/new_device".format(switch['driver'], switch['i2caddr'], install_path) + status, output = log_os_system(cmd, 1) + if status != 0: + switch['status'] = 'FAILED' + continue + + if switch['parent'] in I2C_BASE_BUS: + switch['path'] = "/sys/bus/i2c/devices/{}-00{}".format(switch['parent'][-1],switch['i2caddr'][-2:]) + else: + switch['path'] = "/sys/bus/i2c/devices/{}-00{}".format(I2C_SWITCH_LIST[switch['parent']]['bus_map'][switch['parent_ch']],switch['i2caddr'][-2:]) + + # add delay to make sure the root switch for sfp is installed completely, + # so we can start the installation of next switch + if switch_name == 'PCA9548_0x73': + time.sleep(1) + + #Check if bus are actually created + for busid in range(next_bus_id,next_bus_id+8): + if not os.path.exists("/sys/bus/i2c/devices/i2c-{}".format(busid)): + print("Fail to create bus when install {}".format(switch_name)) + switch['status'] = 'FAILED' + break + else: + # exit loop normally; not breakout + switch['bus_map'] = list(range(next_bus_id,next_bus_id+8)) + switch['status'] = 'INSTALLED' + +def remove_install_status(): + if os.path.exists(PLATFORM_INSTALL_INFO_FILE): + os.remove(PLATFORM_INSTALL_INFO_FILE) + +def restore_install_status(): + output = [] + output.append(I2C_SWITCH_LIST) + output.append(I2C_DEVICES) + output.append(SFP_GROUPS) + jsondata = json.dumps(output) + with open(PLATFORM_INSTALL_INFO_FILE,'w') as fd: + fd.write(jsondata) + +def update_hwmon(): + for dev_name in I2C_DEVICES.keys(): + dev = I2C_DEVICES[dev_name] + if dev['status'] == 'INSTALLED': + if os.path.exists(dev['path']+'/hwmon'): + dev['hwmon_path'] = os.path.join(dev['path']+'/hwmon', os.listdir(dev['path']+'/hwmon')[0]) + + +def install_i2c_device(): + for dev_name in I2C_DEVICES.keys(): + dev = I2C_DEVICES[dev_name] + if dev['parent'] in I2C_BASE_BUS: + install_path = I2C_BASE_BUS[dev['parent']]['path'] + else: + install_path = I2C_SWITCH_LIST[dev['parent']]['path'] + + if 'parent_ch' in dev: + install_path = install_path+"/channel-{}".format(dev['parent_ch']) + if I2C_SWITCH_LIST[dev['parent']]['status'] != 'INSTALLED': + continue + + cmd = "echo {} {} > {}/new_device".format(dev['driver'], dev['i2caddr'], install_path) + status, output = log_os_system(cmd, 1) + if status != 0: + dev['status'] = 'FAILED' + continue + + if dev['parent'] in I2C_BASE_BUS: + dev['path'] = "/sys/bus/i2c/devices/{}-00{}".format(dev['parent'][-1],dev['i2caddr'][-2:]) + else: + dev['path'] = "/sys/bus/i2c/devices/{}-00{}".format(I2C_SWITCH_LIST[dev['parent']]['bus_map'][dev['parent_ch']],dev['i2caddr'][-2:]) + + dev['status'] = 'INSTALLED' + + +def install_sfp(): + for sfp_group_name in SFP_GROUPS.keys(): + sfp_group = SFP_GROUPS[sfp_group_name] + if sfp_group['parent'] in I2C_BASE_BUS: + install_path = I2C_BASE_BUS[sfp_group['parent']]['path'] + else: + install_path = I2C_SWITCH_LIST[sfp_group['parent']]['path'] + + # parent switch is not installed, skip this sfp group + if I2C_SWITCH_LIST[sfp_group['parent']]['status'] != 'INSTALLED': + sfp_group['paths'] = ['n/a']*sfp_group['number'] + continue + + for n in range(0,sfp_group['number']): + sfp_install_path = install_path+"/channel-{}".format(sfp_group['channels'][n]) + cmd = "echo {} {} > {}/new_device".format(sfp_group['driver'], sfp_group['i2caddr'], sfp_install_path) + status, output = log_os_system(cmd, 1) + if status != 0: + sfp_group['status'] = 'FAILED' + sfp_group['paths'].append("n/a") + continue + + if sfp_group['parent'] in I2C_BASE_BUS: + sfp_group['paths'].append("/sys/bus/i2c/devices/{}-00{}".format(sfp_group['parent'][-1],sfp_group['i2caddr'][-2:])) + else: + sfp_group['paths'].append("/sys/bus/i2c/devices/{}-00{}".format(I2C_SWITCH_LIST[sfp_group['parent']]['bus_map'][sfp_group['channels'][n]],sfp_group['i2caddr'][-2:])) + + # if all sfps in a group are success + if len(sfp_group['paths']) == sfp_group['number']: + sfp_group['status'] = "INSTALLED" + +def uninstall_sfp(): + for sfp_group_name in SFP_GROUPS.keys(): + sfp_group = SFP_GROUPS[sfp_group_name] + if sfp_group['parent'] in I2C_BASE_BUS: + uninst_path = I2C_BASE_BUS[sfp_group['parent']]['path'] + else: + uninst_path = I2C_SWITCH_LIST[sfp_group['parent']]['path'] + + # sfp is not installed, skip this sfp group + if sfp_group['status'] != 'INSTALLED': + continue + + for n in range(0,sfp_group['number']): + sfp_uninst_path = uninst_path+"/channel-{}".format(sfp_group['channels'][n]) + cmd = "echo {} > {}/delete_device".format(sfp_group['i2caddr'], sfp_uninst_path) + log_os_system(cmd, 1) + +def uninstall_i2c_device(): + for dev_name in I2C_DEVICES.keys(): + dev = I2C_DEVICES[dev_name] + if dev['parent'] in I2C_BASE_BUS: + uninst_path = I2C_BASE_BUS[dev['parent']]['path'] + else: + uninst_path = I2C_SWITCH_LIST[dev['parent']]['path'] + + # device is not installed, skip this device + if dev['status'] != 'INSTALLED': + continue + + if 'parent_ch' in dev: + uninst_path = uninst_path+"/channel-{}".format(dev['parent_ch']) + + cmd = "echo {} > {}/delete_device".format(dev['i2caddr'], uninst_path) + log_os_system(cmd, 1) + +def uninstall_i2c_switch(): + for switch_name in reversed(switch_install_order): + switch = I2C_SWITCH_LIST[switch_name] + if switch['parent'] in I2C_BASE_BUS: + uninst_path = I2C_BASE_BUS[switch['parent']]['path'] + else: + uninst_path = I2C_SWITCH_LIST[switch['parent']]['path'] + + # switch is not installed, skip this switch + if switch['status'] != 'INSTALLED': + continue + + if 'parent_ch' in switch: + uninst_path = uninst_path+"/channel-{}".format(switch['parent_ch']) + + cmd = "echo {} > {}/delete_device".format(switch['i2caddr'], uninst_path) + log_os_system(cmd, 1) + +def hw_adjustment(): + global SFP_GROUPS + global I2C_DEVICES + global switch_install_order + if bmc_is_exist(): + switch_install_order.remove('PCA9548_0x75') + for device_name in I2C_DEVICES.keys(): + device = I2C_DEVICES[device_name] + if device['parent'] == 'PCA9548_0x75': + device['status'] = 'viaBMC' + + +def set_led_control(): + cmd = "echo 1 > /sys/class/hwmon/hwmon2/device/ESC602_LED/led_fiber" + status, output = log_os_system(cmd, 1) + if status: + print output + +def device_install(): + remove_install_status() + hw_adjustment() + check_base_bus() + set_led_control() + install_i2c_switch() + # add delay to make sure all switch is installed completely, + # so we can start install other slave device safely. + time.sleep(1) + install_i2c_device() + install_sfp() + update_hwmon() + restore_install_status() + return 0 + +def device_uninstall(): + global SFP_GROUPS + global I2C_DEVICES + global I2C_SWITCH_LIST + try: + with open(PLATFORM_INSTALL_INFO_FILE) as fd: + install_info = json.load(fd) + SFP_GROUPS = install_info[2] + I2C_DEVICES = install_info[1] + I2C_SWITCH_LIST = install_info[0] + uninstall_sfp() + uninstall_i2c_device() + uninstall_i2c_switch() + remove_install_status() + return 0 + except IOError as e: + print(e) + print("Platform install information file is not exist, please do install first") + return 1 + +i2c_prefix = '/sys/bus/i2c/devices/' + +def get_attr_value(attr_path): + retval = 'ERR' + if not os.path.isfile(attr_path): + return retval + + try: + with open(attr_path, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", attr_path, " file !") + + retval = retval.rstrip('\r\n') + fd.close() + return retval + +def bmc_is_exist(): + value = '' + bmc_filePath = '/sys/class/hwmon/hwmon2/device/ESC602_SYS/bmc_present' + if os.path.exists(bmc_filePath): + value = get_attr_value(bmc_filePath) + if int(value) == 1: + return True + else: + return False + else: + return False + + +def do_install(): + print "Checking system...." + if driver_check() == False: + print "No driver, installing...." + status = driver_install() + if status: + if FORCE == 0: + return status + else: + print PROJECT_NAME.upper() + " drivers detected...." + if not device_exist(): + print "No device, installing...." + status = device_install() + if status: + if FORCE == 0: + return status + else: + print PROJECT_NAME.upper() + " devices detected...." + return + + +def do_uninstall(): + print "Checking system...." + if not device_exist(): + print PROJECT_NAME.upper() + " has no device installed...." + else: + print "Removing device...." + status = device_uninstall() + if status: + + if FORCE == 0: + return status + + if driver_check() == False: + print PROJECT_NAME.upper() + " has no driver installed...." + else: + print "Removing installed driver...." + status = driver_uninstall() + if status: + if FORCE == 0: + return status + + return + +def devices_info(): + bus_list = [] + with open(PLATFORM_INSTALL_INFO_FILE) as fd: + install_info = json.load(fd) + for i in range(0,2): + for device_name in install_info[i].keys(): + device = install_info[i][device_name] + print("{} :".format(device_name)) + if device['parent'] in I2C_BASE_BUS: + print(" On Bus: {}".format(device['parent'])) + else: + print(" On Bus: i2c-{}".format(install_info[0][device['parent']]['bus_map'][device['parent_ch']])) + print(" i2c Address: {}".format(device['i2caddr'])) + print(" status: {}".format(device['status'])) + if device['status'] == 'INSTALLED': + print(" install path: {}".format(device['path'])) + if device.get('hwmon_path'): + print(" hwmon_path: {}".format(device['hwmon_path'])) + print(' ') + + for sfp_group_name in install_info[2].keys(): + bus_list = [] + sfp_group = install_info[2][sfp_group_name] + print("{} :".format(sfp_group_name)) + print(" sfp number: {}".format(sfp_group['number'])) + for n in range(0,sfp_group['number']): + bus_list.append("i2c-{}".format(install_info[0][sfp_group['parent']]['bus_map'][sfp_group['channels'][n]])) + print(" On Bus: {}".format(bus_list)) + print(" status: {}".format(sfp_group['status'])) + print(" install path: {}".format(', '.join(sfp_group['paths']))) + print(' ') + +def device_exist(): + ret1, log = log_os_system("ls " + i2c_prefix + "*0056", 0) + return not ret1 + + +if __name__ == "__main__": + main() diff --git a/platform/innovium/sonic-platform-modules-cameo/esc602-32q/utils/cameo_esc602_platform.sh b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/utils/cameo_esc602_platform.sh new file mode 100755 index 0000000000..732a1e3018 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/utils/cameo_esc602_platform.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# Install esc601-32q python package +DEVICE="/usr/share/sonic/device" +PLATFORM=$(/usr/local/bin/sonic-cfggen -H -v DEVICE_METADATA.localhost.platform) + +if [ -e $DEVICE/$PLATFORM/sonic_platform-1.0-py2-none-any.whl ]; then + pip install $DEVICE/$PLATFORM/sonic_platform-1.0-py2-none-any.whl +fi + diff --git a/platform/innovium/sonic-platform-modules-cameo/esc602-32q/utils/cameo_esc602_sensors.py b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/utils/cameo_esc602_sensors.py new file mode 100755 index 0000000000..5244c1ae58 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/utils/cameo_esc602_sensors.py @@ -0,0 +1,318 @@ +#!/usr/bin/python + +from __future__ import print_function +from tabulate import tabulate +import os +import sys +import logging +import json + +MAX_FAN_NUM = 5 +MAX_PSU_NUM = 2 +PSU_LIST = ['PSU1','PSU2'] #0x58, 0x59 + +THERMAL_SENSOR_LIST = ['NCT7511Y(U73)', 'G781(U94)', 'G781(U34)', 'G781(U4)'] + +PLATFORM_INSTALL_INFO_FILE = '/etc/sonic/platform_install.json' +BMC_SYSFILE_PATH = '/sys/class/hwmon/hwmon2/device/ESC602_SYS/' +FAN_SYSFILE_PATH = '/sys/class/hwmon/hwmon2/device/ESC602_FAN/' +POWER_SYSFILE_PATH = '/sys/class/hwmon/hwmon2/device/ESC602_POWER/' +THERMAL_SYSFILE_PATH = '/sys/class/hwmon/hwmon2/device/ESC602_THERMAL/' + +def get_psu_path(): + """ + get psu path when without BMC control + """ + psu_path = [] + try: + with open(PLATFORM_INSTALL_INFO_FILE) as fd: + install_info = json.load(fd) + for psu_name in PSU_LIST: + psu = install_info[1][psu_name] + psu_path.append(psu['path']+'/') + return psu_path + except Exception: + print("Fail to get psu sysfsfile path") + + return psu_path + +def get_thermal_sensor_path(): + sensor_path = [] + try: + with open(PLATFORM_INSTALL_INFO_FILE) as fd: + install_info = json.load(fd) + for sensor_name in THERMAL_SENSOR_LIST: + sensor = install_info[1][sensor_name] + sensor_path.append(sensor['hwmon_path']+'/') + return sensor_path + except Exception: + print("Fail to get sensor sysfsfile path") + + return sensor_path + +# Get sysfs attribute +def get_attr_value(attr_path): + retval = 'ERR' + if not os.path.isfile(attr_path): + return retval + + try: + with open(attr_path, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", attr_path, " file !") + + retval = retval.rstrip('\r\n') + fd.close() + return retval + +def bmc_is_exist(): + value = '' + bmc_filePath = BMC_SYSFILE_PATH+'bmc_present' + if os.path.exists(bmc_filePath): + value = get_attr_value(bmc_filePath) + if int(value) == 1: + return True + else: + return False + else: + return False + +def print_attr_value_lines(sys_path): + retval = 'ERR' + if not os.path.isfile(sys_path): + return retval + try: + fo = open(sys_path, "r") + except Exception as error: + logging.error("Unable to open ", sys_path, " file !") + for line in fo.readlines(): + line = line.strip() + print (" %s" % line) + fo.close() + return retval + +def show_sensor_table(): + + headers = ['Sensor', 'Temperature', 'High', 'Low', 'Critical High', 'Critical Low'] + table = list() + temp = list() + + if bmc_is_exist(): + sensor_table = [ + ['Right Bottom Front' , 'temp_r_b_f', 'temp_r_b_f_max', 'temp_r_b_f_min', 'temp_r_b_f_crit', 'temp_r_b_f_lcrit'], + ['Right Bottom Back' , 'temp_r_b_b', 'temp_r_b_b_max', 'temp_r_b_b_min', 'temp_r_b_b_crit', 'temp_r_b_b_lcrit'], + ['Left Bottom Front' , 'temp_l_b_f', 'temp_l_b_f_max', 'temp_l_b_f_min', 'temp_l_b_f_crit', 'temp_l_b_f_lcrit'], + ['Left Bottom Back' , 'temp_l_b_b', 'temp_l_b_b_max', 'temp_l_b_b_min', 'temp_l_b_b_crit', 'temp_l_b_b_lcrit'], + ['Right Top Front' , 'temp_r_t_f', 'temp_r_t_f_max', 'temp_r_t_f_min', 'temp_r_t_f_crit', 'temp_r_t_f_lcrit'], + ['Right Top Back Sensor', 'temp_r_t_b', 'temp_r_t_b_max', 'temp_r_t_b_min', 'temp_r_t_b_crit', 'temp_r_t_b_lcrit'], + ['Left Top Front Sensor', 'temp_l_t_f', 'temp_l_t_f_max', 'temp_l_t_f_min', 'temp_l_t_f_crit', 'temp_l_t_f_lcrit'], + ['Left Top Back Sensor' , 'temp_l_t_b', 'temp_l_t_b_max', 'temp_l_t_b_min', 'temp_l_t_b_crit', 'temp_l_t_b_lcrit'], + ] + else: + sensor_path = get_thermal_sensor_path() + sensor_table = [ + ['Right Bottom Front' , sensor_path[0]+'temp1_input', sensor_path[0]+'temp1_max', sensor_path[0]+'temp1_min', sensor_path[0]+'temp1_crit', sensor_path[0]+'temp1_lcrit'], + ['Right Bottom Back' , sensor_path[0]+'temp2_input', sensor_path[0]+'temp2_max', sensor_path[0]+'temp2_min', sensor_path[0]+'temp2_crit', sensor_path[0]+'temp2_lcrit'], + ['Left Bottom Front' , sensor_path[1]+'temp1_input', sensor_path[1]+'temp1_max', sensor_path[1]+'temp1_min', sensor_path[1]+'temp1_crit', sensor_path[1]+'temp1_lcrit'], + ['Left Bottom Back' , sensor_path[1]+'temp2_input', sensor_path[1]+'temp2_max', sensor_path[1]+'temp2_min', sensor_path[1]+'temp2_crit', sensor_path[1]+'temp2_lcrit'], + ['Right Top Front' , sensor_path[2]+'temp1_input', sensor_path[2]+'temp1_max', sensor_path[2]+'temp1_min', sensor_path[2]+'temp1_crit', sensor_path[2]+'temp1_lcrit'], + ['Right Top Back Sensor', sensor_path[2]+'temp2_input', sensor_path[2]+'temp2_max', sensor_path[2]+'temp2_min', sensor_path[2]+'temp2_crit', sensor_path[2]+'temp2_lcrit'], + ['Left Top Front Sensor', sensor_path[3]+'temp1_input', sensor_path[3]+'temp1_max', sensor_path[3]+'temp1_min', sensor_path[3]+'temp1_crit', sensor_path[3]+'temp1_lcrit'], + ['Left Top Back Sensor' , sensor_path[3]+'temp2_input', sensor_path[3]+'temp2_max', sensor_path[3]+'temp2_min', sensor_path[3]+'temp2_crit', sensor_path[3]+'temp2_lcrit'], + ] + + for index in range(len(sensor_table)): + name = sensor_table[index][0] + for x in range(0, 5): + if bmc_is_exist(): + sys_path = THERMAL_SYSFILE_PATH + sensor_table[index][x+1] + else: + sys_path = sensor_table[index][x+1] + t = get_attr_value(sys_path) + if t == 'ERR': + temp.append('N/A') + else: + if t.isdigit(): + t = int(t)/1000.0 + temp.append('{} C'.format(t)) + + table.append([name, temp[0], temp[1], temp[2], temp[3], temp[4]]) + del temp[:] + + print(tabulate(table, headers, tablefmt='simple', stralign='right')) + print('') + +def show_fan_table(): + headers = ['Fan', 'Speed', 'Presence', 'Status', 'Power'] + table = [] + for index in range(1, MAX_FAN_NUM+1): + name_front = "FAN{}-Front".format(index) + name_rear = "FAN{}-Rear".format(index) + speed_front, speed_rear = fan_speed_dual(index) + present = fan_present(index) + status = fan_status(index) + power = fan_power(index) + table.append( [name_front, speed_front, present, status, power] ) + table.append( [name_rear , speed_front, present, status, power] ) + + print(tabulate(table, headers, tablefmt='simple', stralign='right')) + print('') + +def fan_status(index): + sys_path = FAN_SYSFILE_PATH + 'fan{}_stat'.format(index) + ret = get_attr_value(sys_path) + if ret == '1': + return 'OK' + elif ret == '0': + return 'NG' + else: + return 'N/A' + +def fan_present(index): + sys_path = FAN_SYSFILE_PATH + 'fan{}_present'.format(index) + ret = get_attr_value(sys_path) + if ret == '1': + return 'Present' + elif ret == '0': + return 'Not Present' + else: + return 'N/A' + +def fan_power(index): + sys_path = FAN_SYSFILE_PATH + 'fan{}_power'.format(index) + ret = get_attr_value(sys_path) + if ret == '1': + return 'On' + elif ret == '0': + return 'Off' + else: + return 'N/A' + +def fan_speed_dual(index): + sys_path = FAN_SYSFILE_PATH + 'fan{}_front_rpm'.format(index) + front_ret = get_attr_value(sys_path) + if front_ret == 'ERR': + front_ret = 'N/A' + else: + front_ret = front_ret+'RPM' + + sys_path = FAN_SYSFILE_PATH + 'fan{}_rear_rpm'.format(index) + rear_ret = get_attr_value(sys_path) + if rear_ret == 'ERR': + rear_ret = 'N/A' + else: + rear_ret = rear_ret+'RPM' + + return (front_ret, rear_ret) + +def is_psu_present(psu_number): + sys_path = POWER_SYSFILE_PATH + 'psu{}_prnt'.format(psu_number) + if os.path.exists(sys_path): + value = get_attr_value(sys_path) + if value == '1': + return True + else: + return False + + return False + +def is_psu_power_up(psu_number): + sys_path = POWER_SYSFILE_PATH + 'psu{}_good'.format(psu_number) + if os.path.exists(sys_path): + value = get_attr_value(sys_path) + if value == '1': + return True + else: + return False + + return False + +def show_psu_table(): + headers = ['PSU', 'Presence', 'Power', 'Fan Speed(RPM)', 'Temperature(C)', 'Vin(V)', 'Vout(V)', 'Pin(W)', 'Pout(W)', 'Iin(A)', 'Iout(A)', 'Max Iout(A)'] + table = [] + psu_sysfiles_list = [] + isbmc = bmc_is_exist() + if isbmc is False: + PSU_PATH = get_psu_path() + + for index in range(0, MAX_PSU_NUM): + if isbmc: + psu_sysfiles_list = [ + POWER_SYSFILE_PATH+'psu{}_fan_speed'.format(index+1), + POWER_SYSFILE_PATH+'psu{}_temp'.format(index+1), + POWER_SYSFILE_PATH+'psu{}_vin'.format(index+1), + POWER_SYSFILE_PATH+'psu{}_vout'.format(index+1), + POWER_SYSFILE_PATH+'psu{}_pin'.format(index+1), + POWER_SYSFILE_PATH+'psu{}_pout'.format(index+1), + POWER_SYSFILE_PATH+'psu{}_iin'.format(index+1), + POWER_SYSFILE_PATH+'psu{}_iout'.format(index+1), + POWER_SYSFILE_PATH+'psu{}_mfr_iout_max'.format(index+1) + ] + else: + psu_sysfiles_list = [ + PSU_PATH[index]+'psu_fan_speed_1', + PSU_PATH[index]+'psu_temp_1', + PSU_PATH[index]+'psu_vin', + PSU_PATH[index]+'psu_vout', + PSU_PATH[index]+'psu_pin', + PSU_PATH[index]+'psu_pout', + PSU_PATH[index]+'psu_iin', + PSU_PATH[index]+'psu_iout', + PSU_PATH[index]+'psu_iout_max' + ] + status_list = get_psu_status(index+1, psu_sysfiles_list) + table.append(status_list) + + print(tabulate(table, headers, tablefmt='simple', stralign='right')) + print('') + +def get_psu_status(index, sysfile_list): + # result_list: [name, presence, power, fanSpeed(RPM), temperature(C), vin(V), vout(V), pin(W), pout(W), iin(A), iout(A), maxIout(A)] + name = 'PSU{}'.format(index) + result_list = [name, 'Not Present', 'N/A', 'N/A', 'N/A', 'N/A', 'N/A', 'N/A', 'N/A', 'N/A', 'N/A', 'N/A'] + result_mutipler = [None, None, None, None, 1000.0, 1000.0, 1000.0, 1000000.0, 1000000.0, 1000.0, 1000.0, 1000.0] + + if is_psu_present(index): + result_list[1] = 'Present' + else: + return result_list + + if is_psu_power_up(index): + result_list[2] = 'up' + else: + result_list[2] = 'down' + + for x in range(0, 9): + result_list[x+3] = get_attr_value(sysfile_list[x]) + + for x in range(0, 12): + if result_mutipler[x] != None and result_list[x] != 'ERR': + result_list[x] = int(result_list[x]) / result_mutipler[x] + + return result_list + + +def main(): + """ + Usage: %(scriptName)s command object + + command: + fan_status : display fans status(present/power good) + """ + + if len(sys.argv)<2: + print (main.__doc__) + + for arg in sys.argv[1:]: + if arg == 'fan_status': + show_fan_table() + elif arg == 'sensor_status': + show_sensor_table() + show_psu_table() + + else: + print (main.__doc__) + +if __name__ == "__main__": + main() diff --git a/platform/innovium/sonic-platform-modules-cameo/esc602-32q/utils/cameo_esc602_startup b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/utils/cameo_esc602_startup new file mode 100755 index 0000000000..6b42d06d9d --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/utils/cameo_esc602_startup @@ -0,0 +1,17 @@ +#!/bin/bash + + +start() { + # load platform driver, native drivers + /usr/local/bin/cameo_esc602_util.py install +} + +stop() { + /usr/local/bin/cameo_esc602_util.py clean +} + + +case $1 in + start|stop) "$1" ;; +esac + diff --git a/platform/innovium/sonic-platform-modules-cameo/esc602-32q/utils/halt b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/utils/halt new file mode 100755 index 0000000000..1d09c2a3d9 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/utils/halt @@ -0,0 +1,18 @@ +#!/bin/sh + +mr_reboot() { + + sudo rmmod x86-64-cameo-esc602-32q + sudo i2cset -y 0 0x30 0xa1 0 + +} + +if [ $# -eq 0 ] || [ $@ = "--halt" ] || [ $@ = "-f" ] || [ $@ = "--force" ]; then + sudo /sbin/halt +elif [ $@ = "-p" ] || [ $@ = "--reboot" ] || [ $@ = "--poweroff" ]; then + sync;sync + mr_reboot +else + echo "unsupported option" +fi + diff --git a/platform/innovium/sonic-platform-modules-cameo/esc602-32q/utils/poweroff b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/utils/poweroff new file mode 100755 index 0000000000..c0e5fc7de6 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/utils/poweroff @@ -0,0 +1,18 @@ +#!/bin/sh + +mr_reboot() { + + sudo rmmod x86-64-cameo-esc602-32q + sudo i2cset -y 0 0x30 0xa1 0 + +} + +if [ $# -eq 0 ] || [ $@ = "-p" ] || [ $@ = "--reboot" ] || [ $@ = "--poweroff" ] || [ $@ = "-f" ] || [ $@ = "--force" ]; then + sync;sync + mr_reboot +elif [ $@ = "--halt" ]; then + sudo halt +else + echo "unsupported option" +fi + diff --git a/platform/innovium/sonic-platform-modules-cameo/esc602-32q/utils/shutdown b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/utils/shutdown new file mode 100755 index 0000000000..777c270c16 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esc602-32q/utils/shutdown @@ -0,0 +1,18 @@ +#!/bin/sh + +mr_reboot() { + + sudo rmmod x86-64-cameo-esc602-32q + sudo i2cset -y 0 0x31 0xa1 0 + +} + +if [ $# -eq 0 ] || [ $@ = "-r" ] || [ $@ = "--reboot" ] || [ $@ = "-h" ] || [ $@ = "-P" ] || [ $@ = "--poweroff" ]; then + sync;sync + mr_reboot +elif [ $@ = "-H" ] || [ $@ = "--halt" ]; then + sudo halt +else + echo "unsupported option" +fi + diff --git a/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/modules/Makefile b/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/modules/Makefile new file mode 100644 index 0000000000..4f51487255 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/modules/Makefile @@ -0,0 +1 @@ +obj-m := x86-64-cameo-esqc610-56sq.o nct7511.o zrh2800k2.o at24_smbus.o diff --git a/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/modules/at24_smbus.c b/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/modules/at24_smbus.c new file mode 100644 index 0000000000..16d6594746 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/modules/at24_smbus.c @@ -0,0 +1,847 @@ +/* + * at24.c - handle most I2C EEPROMs + * + * Copyright (C) 2005-2007 David Brownell + * Copyright (C) 2008 Wolfram Sang, Pengutronix + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * I2C EEPROMs from most vendors are inexpensive and mostly interchangeable. + * Differences between different vendor product lines (like Atmel AT24C or + * MicroChip 24LC, etc) won't much matter for typical read/write access. + * There are also I2C RAM chips, likewise interchangeable. One example + * would be the PCF8570, which acts like a 24c02 EEPROM (256 bytes). + * + * However, misconfiguration can lose data. "Set 16-bit memory address" + * to a part with 8-bit addressing will overwrite data. Writing with too + * big a page size also loses data. And it's not safe to assume that the + * conventional addresses 0x50..0x57 only hold eeproms; a PCF8563 RTC + * uses 0x51, for just one example. + * + * Accordingly, explicit board-specific configuration data should be used + * in almost all cases. (One partial exception is an SMBus used to access + * "SPD" data for DRAM sticks. Those only use 24c02 EEPROMs.) + * + * So this driver uses "new style" I2C driver binding, expecting to be + * told what devices exist. That may be in arch/X/mach-Y/board-Z.c or + * similar kernel-resident tables; or, configuration data coming from + * a bootloader. + * + * Other than binding model, current differences from "eeprom" driver are + * that this one handles write access and isn't restricted to 24c02 devices. + * It also handles larger devices (32 kbit and up) with two-byte addresses, + * which won't work on pure SMBus systems. + */ + +struct at24_data { + struct at24_platform_data chip; + int use_smbus; + int use_smbus_write; + + ssize_t (*read_func)(struct at24_data *, char *, unsigned int, size_t); + ssize_t (*write_func)(struct at24_data *, + const char *, unsigned int, size_t); + + /* + * Lock protects against activities from other Linux tasks, + * but not from changes by other I2C masters. + */ + struct mutex lock; + + u8 *writebuf; + unsigned write_max; + unsigned num_addresses; + + struct nvmem_config nvmem_config; + struct nvmem_device *nvmem; + + /* + * Some chips tie up multiple I2C addresses; dummy devices reserve + * them for us, and we'll use them with SMBus calls. + */ + struct i2c_client *client[]; +}; + +/* + * This parameter is to help this driver avoid blocking other drivers out + * of I2C for potentially troublesome amounts of time. With a 100 kHz I2C + * clock, one 256 byte read takes about 1/43 second which is excessive; + * but the 1/170 second it takes at 400 kHz may be quite reasonable; and + * at 1 MHz (Fm+) a 1/430 second delay could easily be invisible. + * + * This value is forced to be a power of two so that writes align on pages. + */ +static unsigned io_limit = 128; +module_param(io_limit, uint, 0); +MODULE_PARM_DESC(io_limit, "Maximum bytes per I/O (default 128)"); + +/* + * Specs often allow 5 msec for a page write, sometimes 20 msec; + * it's important to recover from write timeouts. + */ +static unsigned write_timeout = 25; +module_param(write_timeout, uint, 0); +MODULE_PARM_DESC(write_timeout, "Time (in ms) to try writes (default 25)"); + +#define AT24_SIZE_BYTELEN 5 +#define AT24_SIZE_FLAGS 8 + +#define AT24_BITMASK(x) (BIT(x) - 1) + +/* create non-zero magic value for given eeprom parameters */ +#define AT24_DEVICE_MAGIC(_len, _flags) \ + ((1 << AT24_SIZE_FLAGS | (_flags)) \ + << AT24_SIZE_BYTELEN | ilog2(_len)) + +/* + * Both reads and writes fail if the previous write didn't complete yet. This + * macro loops a few times waiting at least long enough for one entire page + * write to work while making sure that at least one iteration is run before + * checking the break condition. + * + * It takes two parameters: a variable in which the future timeout in jiffies + * will be stored and a temporary variable holding the time of the last + * iteration of processing the request. Both should be unsigned integers + * holding at least 32 bits. + */ +#define loop_until_timeout(tout, op_time) \ + for (tout = jiffies + msecs_to_jiffies(write_timeout), op_time = 0; \ + op_time ? time_before(op_time, tout) : true; \ + usleep_range(1000, 1500), op_time = jiffies) + +static const struct i2c_device_id at24_ids[] = { + { "24c64smbus", AT24_DEVICE_MAGIC(65536 / 8, AT24_FLAG_ADDR16) }, + { /* END OF LIST */ } +}; +MODULE_DEVICE_TABLE(i2c, at24_ids); + +static const struct acpi_device_id at24_acpi_ids[] = { + { "INT3499", AT24_DEVICE_MAGIC(8192 / 8, 0) }, + { } +}; +MODULE_DEVICE_TABLE(acpi, at24_acpi_ids); + +/*-------------------------------------------------------------------------*/ + +/* + * This routine supports chips which consume multiple I2C addresses. It + * computes the addressing information to be used for a given r/w request. + * Assumes that sanity checks for offset happened at sysfs-layer. + * + * Slave address and byte offset derive from the offset. Always + * set the byte address; on a multi-master board, another master + * may have changed the chip's "current" address pointer. + * + * REVISIT some multi-address chips don't rollover page reads to + * the next slave address, so we may need to truncate the count. + * Those chips might need another quirk flag. + * + * If the real hardware used four adjacent 24c02 chips and that + * were misconfigured as one 24c08, that would be a similar effect: + * one "eeprom" file not four, but larger reads would fail when + * they crossed certain pages. + */ +static struct i2c_client *at24_translate_offset(struct at24_data *at24, + unsigned int *offset) +{ + unsigned i; + + if (at24->chip.flags & AT24_FLAG_ADDR16) { + i = *offset >> 16; + *offset &= 0xffff; + } else { + i = *offset >> 8; + *offset &= 0xff; + } + + return at24->client[i]; +} + +static ssize_t at24_eeprom_read_smbus(struct at24_data *at24, char *buf, + unsigned int offset, size_t count) +{ + unsigned long timeout, read_time; + struct i2c_client *client; + int status,i,j; + + client = at24_translate_offset(at24, &offset); + + if (count > io_limit) + count = io_limit; + /* Smaller eeproms can work given some SMBus extension calls */ + if (count > I2C_SMBUS_BLOCK_MAX) + count = I2C_SMBUS_BLOCK_MAX; + + if(at24->chip.flags & AT24_FLAG_ADDR16){ + + + status = i2c_smbus_write_byte_data(client, offset>>8, + offset&0xff); + if(status < 0) + return status; + + mdelay(7); + for (i = 0; i < count; i++) { + j = i2c_smbus_read_byte(client); + if (j < 0) { + return j; + } + buf[i] = j; + } + return count; + + }else{ + + loop_until_timeout(timeout, read_time) { + status = i2c_smbus_read_i2c_block_data_or_emulated(client, + offset, + count, buf); + + dev_dbg(&client->dev, "read %zu@%d --> %d (%ld)\n", + count, offset, status, jiffies); + + if (status == count) + return count; + } + } + return -ETIMEDOUT; +} + +static ssize_t at24_eeprom_read_i2c(struct at24_data *at24, char *buf, + unsigned int offset, size_t count) +{ + unsigned long timeout, read_time; + struct i2c_client *client; + struct i2c_msg msg[2]; + int status, i; + u8 msgbuf[2]; + + memset(msg, 0, sizeof(msg)); + client = at24_translate_offset(at24, &offset); + + if (count > io_limit) + count = io_limit; + + /* + * When we have a better choice than SMBus calls, use a combined I2C + * message. Write address; then read up to io_limit data bytes. Note + * that read page rollover helps us here (unlike writes). msgbuf is + * u8 and will cast to our needs. + */ + i = 0; + if (at24->chip.flags & AT24_FLAG_ADDR16) + msgbuf[i++] = offset >> 8; + msgbuf[i++] = offset; + + msg[0].addr = client->addr; + msg[0].buf = msgbuf; + msg[0].len = i; + + msg[1].addr = client->addr; + msg[1].flags = I2C_M_RD; + msg[1].buf = buf; + msg[1].len = count; + + loop_until_timeout(timeout, read_time) { + status = i2c_transfer(client->adapter, msg, 2); + if (status == 2) + status = count; + + dev_dbg(&client->dev, "read %zu@%d --> %d (%ld)\n", + count, offset, status, jiffies); + + if (status == count) + return count; + } + + return -ETIMEDOUT; +} + +static ssize_t at24_eeprom_read_serial(struct at24_data *at24, char *buf, + unsigned int offset, size_t count) +{ + unsigned long timeout, read_time; + struct i2c_client *client; + struct i2c_msg msg[2]; + u8 addrbuf[2]; + int status; + + client = at24_translate_offset(at24, &offset); + + memset(msg, 0, sizeof(msg)); + msg[0].addr = client->addr; + msg[0].buf = addrbuf; + + /* + * The address pointer of the device is shared between the regular + * EEPROM array and the serial number block. The dummy write (part of + * the sequential read protocol) ensures the address pointer is reset + * to the desired position. + */ + if (at24->chip.flags & AT24_FLAG_ADDR16) { + /* + * For 16 bit address pointers, the word address must contain + * a '10' sequence in bits 11 and 10 regardless of the + * intended position of the address pointer. + */ + addrbuf[0] = 0x08; + addrbuf[1] = offset; + msg[0].len = 2; + } else { + /* + * Otherwise the word address must begin with a '10' sequence, + * regardless of the intended address. + */ + addrbuf[0] = 0x80 + offset; + msg[0].len = 1; + } + + msg[1].addr = client->addr; + msg[1].flags = I2C_M_RD; + msg[1].buf = buf; + msg[1].len = count; + + loop_until_timeout(timeout, read_time) { + status = i2c_transfer(client->adapter, msg, 2); + if (status == 2) + return count; + } + + return -ETIMEDOUT; +} + +static ssize_t at24_eeprom_read_mac(struct at24_data *at24, char *buf, + unsigned int offset, size_t count) +{ + unsigned long timeout, read_time; + struct i2c_client *client; + struct i2c_msg msg[2]; + u8 addrbuf[2]; + int status; + + client = at24_translate_offset(at24, &offset); + + memset(msg, 0, sizeof(msg)); + msg[0].addr = client->addr; + msg[0].buf = addrbuf; + /* EUI-48 starts from 0x9a, EUI-64 from 0x98 */ + addrbuf[0] = 0xa0 - at24->chip.byte_len + offset; + msg[0].len = 1; + msg[1].addr = client->addr; + msg[1].flags = I2C_M_RD; + msg[1].buf = buf; + msg[1].len = count; + + loop_until_timeout(timeout, read_time) { + status = i2c_transfer(client->adapter, msg, 2); + if (status == 2) + return count; + } + + return -ETIMEDOUT; +} + +/* + * Note that if the hardware write-protect pin is pulled high, the whole + * chip is normally write protected. But there are plenty of product + * variants here, including OTP fuses and partial chip protect. + * + * We only use page mode writes; the alternative is sloooow. These routines + * write at most one page. + */ + +static size_t at24_adjust_write_count(struct at24_data *at24, + unsigned int offset, size_t count) +{ + unsigned next_page; + + /* write_max is at most a page */ + if (count > at24->write_max) + count = at24->write_max; + + /* Never roll over backwards, to the start of this page */ + next_page = roundup(offset + 1, at24->chip.page_size); + if (offset + count > next_page) + count = next_page - offset; + + return count; +} + +static ssize_t at24_eeprom_write_smbus_block(struct at24_data *at24, + const char *buf, + unsigned int offset, size_t count) +{ + unsigned long timeout, write_time; + struct i2c_client *client; + ssize_t status = 0; + + client = at24_translate_offset(at24, &offset); + count = at24_adjust_write_count(at24, offset, count); + + loop_until_timeout(timeout, write_time) { + status = i2c_smbus_write_i2c_block_data(client, + offset, count, buf); + if (status == 0) + status = count; + + dev_dbg(&client->dev, "write %zu@%d --> %zd (%ld)\n", + count, offset, status, jiffies); + + if (status == count) + return count; + } + + return -ETIMEDOUT; +} + +static ssize_t at24_eeprom_write_smbus_byte(struct at24_data *at24, + const char *buf, + unsigned int offset, size_t count) +{ + unsigned long timeout, write_time; + struct i2c_client *client; + ssize_t status = 0; + + client = at24_translate_offset(at24, &offset); + + loop_until_timeout(timeout, write_time) { + status = i2c_smbus_write_byte_data(client, offset, buf[0]); + if (status == 0) + status = count; + + dev_dbg(&client->dev, "write %zu@%d --> %zd (%ld)\n", + count, offset, status, jiffies); + + if (status == count) + return count; + } + + return -ETIMEDOUT; +} + +static ssize_t at24_eeprom_write_i2c(struct at24_data *at24, const char *buf, + unsigned int offset, size_t count) +{ + unsigned long timeout, write_time; + struct i2c_client *client; + struct i2c_msg msg; + ssize_t status = 0; + int i = 0; + + client = at24_translate_offset(at24, &offset); + count = at24_adjust_write_count(at24, offset, count); + + msg.addr = client->addr; + msg.flags = 0; + + /* msg.buf is u8 and casts will mask the values */ + msg.buf = at24->writebuf; + if (at24->chip.flags & AT24_FLAG_ADDR16) + msg.buf[i++] = offset >> 8; + + msg.buf[i++] = offset; + memcpy(&msg.buf[i], buf, count); + msg.len = i + count; + + loop_until_timeout(timeout, write_time) { + status = i2c_transfer(client->adapter, &msg, 1); + if (status == 1) + status = count; + + dev_dbg(&client->dev, "write %zu@%d --> %zd (%ld)\n", + count, offset, status, jiffies); + + if (status == count) + return count; + } + + return -ETIMEDOUT; +} + +static int at24_read(void *priv, unsigned int off, void *val, size_t count) +{ + struct at24_data *at24 = priv; + char *buf = val; + + if (unlikely(!count)) + return count; + + if (off + count > at24->chip.byte_len) + return -EINVAL; + + /* + * Read data from chip, protecting against concurrent updates + * from this host, but not from other I2C masters. + */ + mutex_lock(&at24->lock); + + while (count) { + int status; + + status = at24->read_func(at24, buf, off, count); + if (status < 0) { + mutex_unlock(&at24->lock); + return status; + } + buf += status; + off += status; + count -= status; + } + + mutex_unlock(&at24->lock); + + return 0; +} + +static int at24_write(void *priv, unsigned int off, void *val, size_t count) +{ + struct at24_data *at24 = priv; + char *buf = val; + + if (unlikely(!count)) + return -EINVAL; + + if (off + count > at24->chip.byte_len) + return -EINVAL; + + /* + * Write data to chip, protecting against concurrent updates + * from this host, but not from other I2C masters. + */ + mutex_lock(&at24->lock); + + while (count) { + int status; + + status = at24->write_func(at24, buf, off, count); + if (status < 0) { + mutex_unlock(&at24->lock); + return status; + } + buf += status; + off += status; + count -= status; + } + + mutex_unlock(&at24->lock); + + return 0; +} + +#ifdef CONFIG_OF +static void at24_get_ofdata(struct i2c_client *client, + struct at24_platform_data *chip) +{ + const __be32 *val; + struct device_node *node = client->dev.of_node; + + if (node) { + if (of_get_property(node, "read-only", NULL)) + chip->flags |= AT24_FLAG_READONLY; + val = of_get_property(node, "pagesize", NULL); + if (val) + chip->page_size = be32_to_cpup(val); + } +} +#else +static void at24_get_ofdata(struct i2c_client *client, + struct at24_platform_data *chip) +{ } +#endif /* CONFIG_OF */ + +static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id) +{ + struct at24_platform_data chip; + kernel_ulong_t magic = 0; + bool writable; + int use_smbus = 0; + int use_smbus_write = 0; + struct at24_data *at24; + int err; + unsigned i, num_addresses; + u8 test_byte; + + if (client->dev.platform_data) { + chip = *(struct at24_platform_data *)client->dev.platform_data; + } else { + if (id) { + magic = id->driver_data; + } else { + const struct acpi_device_id *aid; + + aid = acpi_match_device(at24_acpi_ids, &client->dev); + if (aid) + magic = aid->driver_data; + } + if (!magic) + return -ENODEV; + + chip.byte_len = BIT(magic & AT24_BITMASK(AT24_SIZE_BYTELEN)); + magic >>= AT24_SIZE_BYTELEN; + chip.flags = magic & AT24_BITMASK(AT24_SIZE_FLAGS); + /* + * This is slow, but we can't know all eeproms, so we better + * play safe. Specifying custom eeprom-types via platform_data + * is recommended anyhow. + */ + chip.page_size = 1; + + /* update chipdata if OF is present */ + at24_get_ofdata(client, &chip); + + chip.setup = NULL; + chip.context = NULL; + } + + if (!is_power_of_2(chip.byte_len)) + dev_warn(&client->dev, + "byte_len looks suspicious (no power of 2)!\n"); + if (!chip.page_size) { + dev_err(&client->dev, "page_size must not be 0!\n"); + return -EINVAL; + } + if (!is_power_of_2(chip.page_size)) + dev_warn(&client->dev, + "page_size looks suspicious (no power of 2)!\n"); + + /* + * REVISIT: the size of the EUI-48 byte array is 6 in at24mac402, while + * the call to ilog2() in AT24_DEVICE_MAGIC() rounds it down to 4. + * + * Eventually we'll get rid of the magic values altoghether in favor of + * real structs, but for now just manually set the right size. + */ + if (chip.flags & AT24_FLAG_MAC && chip.byte_len == 4) + chip.byte_len = 6; + + /* Use I2C operations unless we're stuck with SMBus extensions. */ + if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { + //if (chip.flags & AT24_FLAG_ADDR16) + // return -EPFNOSUPPORT; + + if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { + use_smbus = I2C_SMBUS_I2C_BLOCK_DATA; + } else if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_READ_WORD_DATA)) { + use_smbus = I2C_SMBUS_WORD_DATA; + } else if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_READ_BYTE_DATA)) { + use_smbus = I2C_SMBUS_BYTE_DATA; + } else { + return -EPFNOSUPPORT; + } + + if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_WRITE_I2C_BLOCK)) { + use_smbus_write = I2C_SMBUS_I2C_BLOCK_DATA; + } else if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) { + use_smbus_write = I2C_SMBUS_BYTE_DATA; + chip.page_size = 1; + } + } + + if (chip.flags & AT24_FLAG_TAKE8ADDR) + num_addresses = 8; + else + num_addresses = DIV_ROUND_UP(chip.byte_len, + (chip.flags & AT24_FLAG_ADDR16) ? 65536 : 256); + + at24 = devm_kzalloc(&client->dev, sizeof(struct at24_data) + + num_addresses * sizeof(struct i2c_client *), GFP_KERNEL); + if (!at24) + return -ENOMEM; + + mutex_init(&at24->lock); + at24->use_smbus = use_smbus; + at24->use_smbus_write = use_smbus_write; + at24->chip = chip; + at24->num_addresses = num_addresses; + + if ((chip.flags & AT24_FLAG_SERIAL) && (chip.flags & AT24_FLAG_MAC)) { + dev_err(&client->dev, + "invalid device data - cannot have both AT24_FLAG_SERIAL & AT24_FLAG_MAC."); + return -EINVAL; + } + + if (chip.flags & AT24_FLAG_SERIAL) { + at24->read_func = at24_eeprom_read_serial; + } else if (chip.flags & AT24_FLAG_MAC) { + at24->read_func = at24_eeprom_read_mac; + } else { + at24->read_func = at24->use_smbus ? at24_eeprom_read_smbus + : at24_eeprom_read_i2c; + } + + if (at24->use_smbus) { + if (at24->use_smbus_write == I2C_SMBUS_I2C_BLOCK_DATA) + at24->write_func = at24_eeprom_write_smbus_block; + else + at24->write_func = at24_eeprom_write_smbus_byte; + } else { + at24->write_func = at24_eeprom_write_i2c; + } + + writable = !(chip.flags & AT24_FLAG_READONLY); + if (writable) { + if (!use_smbus || use_smbus_write) { + + unsigned write_max = chip.page_size; + + if (write_max > io_limit) + write_max = io_limit; + if (use_smbus && write_max > I2C_SMBUS_BLOCK_MAX) + write_max = I2C_SMBUS_BLOCK_MAX; + at24->write_max = write_max; + + /* buffer (data + address at the beginning) */ + at24->writebuf = devm_kzalloc(&client->dev, + write_max + 2, GFP_KERNEL); + if (!at24->writebuf) + return -ENOMEM; + } else { + dev_warn(&client->dev, + "cannot write due to controller restrictions."); + } + } + + at24->client[0] = client; + + /* use dummy devices for multiple-address chips */ + for (i = 1; i < num_addresses; i++) { + at24->client[i] = i2c_new_dummy(client->adapter, + client->addr + i); + if (!at24->client[i]) { + dev_err(&client->dev, "address 0x%02x unavailable\n", + client->addr + i); + err = -EADDRINUSE; + goto err_clients; + } + } + + i2c_set_clientdata(client, at24); + + /* + * Perform a one-byte test read to verify that the + * chip is functional. + */ + err = at24_read(at24, 0, &test_byte, 1); + if (err) { + err = -ENODEV; + goto err_clients; + } + + at24->nvmem_config.name = dev_name(&client->dev); + at24->nvmem_config.dev = &client->dev; + at24->nvmem_config.read_only = !writable; + at24->nvmem_config.root_only = true; + at24->nvmem_config.owner = THIS_MODULE; + at24->nvmem_config.compat = true; + at24->nvmem_config.base_dev = &client->dev; + at24->nvmem_config.reg_read = at24_read; + at24->nvmem_config.reg_write = at24_write; + at24->nvmem_config.priv = at24; + at24->nvmem_config.stride = 1; + at24->nvmem_config.word_size = 1; + at24->nvmem_config.size = chip.byte_len; + + at24->nvmem = nvmem_register(&at24->nvmem_config); + + if (IS_ERR(at24->nvmem)) { + err = PTR_ERR(at24->nvmem); + goto err_clients; + } + + dev_info(&client->dev, "%u byte %s EEPROM, %s, %u bytes/write\n", + chip.byte_len, client->name, + writable ? "writable" : "read-only", at24->write_max); + if (use_smbus == I2C_SMBUS_WORD_DATA || + use_smbus == I2C_SMBUS_BYTE_DATA) { + dev_notice(&client->dev, "Falling back to %s reads, " + "performance will suffer\n", use_smbus == + I2C_SMBUS_WORD_DATA ? "word" : "byte"); + } + + /* export data to kernel code */ + if (chip.setup) + chip.setup(at24->nvmem, chip.context); + + return 0; + +err_clients: + for (i = 1; i < num_addresses; i++) + if (at24->client[i]) + i2c_unregister_device(at24->client[i]); + + return err; +} + +static int at24_remove(struct i2c_client *client) +{ + struct at24_data *at24; + int i; + + at24 = i2c_get_clientdata(client); + + nvmem_unregister(at24->nvmem); + + for (i = 1; i < at24->num_addresses; i++) + i2c_unregister_device(at24->client[i]); + + return 0; +} + +/*-------------------------------------------------------------------------*/ + +static struct i2c_driver at24_driver = { + .driver = { + .name = "at24_smbus", + .acpi_match_table = ACPI_PTR(at24_acpi_ids), + }, + .probe = at24_probe, + .remove = at24_remove, + .id_table = at24_ids, +}; + +static int __init at24_init(void) +{ + if (!io_limit) { + pr_err("at24: io_limit must not be 0!\n"); + return -EINVAL; + } + + io_limit = rounddown_pow_of_two(io_limit); + return i2c_add_driver(&at24_driver); +} +module_init(at24_init); + +static void __exit at24_exit(void) +{ + i2c_del_driver(&at24_driver); +} +module_exit(at24_exit); + +MODULE_DESCRIPTION("Driver for most I2C EEPROMs"); +MODULE_AUTHOR("David Brownell and Wolfram Sang"); +MODULE_LICENSE("GPL"); diff --git a/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/modules/nct7511.c b/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/modules/nct7511.c new file mode 100644 index 0000000000..8ddf1919f5 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/modules/nct7511.c @@ -0,0 +1,765 @@ +/* + + */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRVNAME "nct7511" + + +#define REG_BANK 0x00 +#define REG_TEMP_LSB 0x05 +#define REG_FANCOUNT_LOW 0x13 +#define REG_START 0x21 +#define REG_MODE 0x22 /* 7.2.32 Mode Selection Register */ +#define REG_FAN_ENABLE 0x24 +#define REG_PWM(x) (0x60 + (x)) +#define REG_SMARTFAN_EN(x) (0x64 + (x) / 2) +#define SMARTFAN_EN_SHIFT(x) ((x) % 2 * 4) +#define REG_VENDOR_ID 0xfd +#define REG_CHIP_ID 0xfe +#define REG_VERSION_ID 0xff + +/* + * Data structures and manipulation thereof + */ + +struct nct7511_data { + struct regmap *regmap; + struct mutex access_lock; /* for multi-byte read and write operations */ +}; + +static ssize_t show_temp_type(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct nct7511_data *data = dev_get_drvdata(dev); + struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr); + unsigned int mode; + int ret; + + ret = regmap_read(data->regmap, REG_MODE, &mode); + if (ret < 0) + return ret; + + return sprintf(buf, "%u\n", (mode >> (2 * sattr->index) & 3) + 2); +} + +static ssize_t store_temp_type(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct nct7511_data *data = dev_get_drvdata(dev); + struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr); + unsigned int type; + int err; + + err = kstrtouint(buf, 0, &type); + if (err < 0) + return err; + if (sattr->index == 2 && type != 4) /* RD3 */ + return -EINVAL; + if (type < 3 || type > 4) + return -EINVAL; + err = regmap_update_bits(data->regmap, REG_MODE, + 3 << 2 * sattr->index, (type - 2) << 2 * sattr->index); + return err ? : count; +} + +static ssize_t show_pwm_mode(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr); + struct nct7511_data *data = dev_get_drvdata(dev); + unsigned int regval; + int ret; + + if (sattr->index > 1) + return sprintf(buf, "1\n"); + + ret = regmap_read(data->regmap, 0x5E, ®val); + if (ret < 0) + return ret; + + return sprintf(buf, "%u\n", !(regval & (1 << sattr->index))); +} + +static ssize_t show_pwm(struct device *dev, struct device_attribute *devattr, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct nct7511_data *data = dev_get_drvdata(dev); + unsigned int val; + int ret; + + if (!attr->index) + return sprintf(buf, "255\n"); + + ret = regmap_read(data->regmap, attr->index, &val); + if (ret < 0) + return ret; + + return sprintf(buf, "%d\n", val); +} + +static ssize_t store_pwm(struct device *dev, struct device_attribute *devattr, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct nct7511_data *data = dev_get_drvdata(dev); + int err; + u8 val; + + err = kstrtou8(buf, 0, &val); + if (err < 0) + return err; + + err = regmap_write(data->regmap, attr->index, val); + return err ? : count; +} + +static ssize_t show_pwm_enable(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct nct7511_data *data = dev_get_drvdata(dev); + struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr); + unsigned int reg, enabled; + int ret; + + ret = regmap_read(data->regmap, REG_SMARTFAN_EN(sattr->index), ®); + if (ret < 0) + return ret; + enabled = reg >> SMARTFAN_EN_SHIFT(sattr->index) & 1; + return sprintf(buf, "%u\n", enabled + 1); +} + +static ssize_t store_pwm_enable(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct nct7511_data *data = dev_get_drvdata(dev); + struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr); + u8 val; + int ret; + + ret = kstrtou8(buf, 0, &val); + if (ret < 0) + return ret; + if (val < 1 || val > 2) + return -EINVAL; + ret = regmap_update_bits(data->regmap, REG_SMARTFAN_EN(sattr->index), + 1 << SMARTFAN_EN_SHIFT(sattr->index), + (val - 1) << SMARTFAN_EN_SHIFT(sattr->index)); + return ret ? : count; +} + +static int nct7511_read_temp(struct nct7511_data *data, + u8 reg_temp, u8 reg_temp_low, int *temp) +{ + unsigned int t1, t2 = 0; + int err; + + *temp = 0; + + mutex_lock(&data->access_lock); + err = regmap_read(data->regmap, reg_temp, &t1); + if (err < 0) + goto abort; + t1 <<= 8; + if (reg_temp_low) { /* 11 bit data */ + err = regmap_read(data->regmap, reg_temp_low, &t2); + if (err < 0) + goto abort; + } + t1 |= t2 & 0xe0; + *temp = (s16)t1 / 32 * 125; +abort: + mutex_unlock(&data->access_lock); + return err; +} + +static int nct7511_read_fan(struct nct7511_data *data, u8 reg_fan) +{ + unsigned int f1, f2; + int ret; + + mutex_lock(&data->access_lock); + ret = regmap_read(data->regmap, reg_fan, &f1); + if (ret < 0) + goto abort; + ret = regmap_read(data->regmap, REG_FANCOUNT_LOW, &f2); + if (ret < 0) + goto abort; + ret = (f1 << 5) | (f2 >> 3); + /* convert fan count to rpm */ + if (ret == 0x1fff) /* maximum value, assume fan is stopped */ + ret = 0; + else if (ret) + ret = DIV_ROUND_CLOSEST(1350000U, ret); +abort: + mutex_unlock(&data->access_lock); + return ret; +} + +static int nct7511_read_fan_min(struct nct7511_data *data, u8 reg_fan_low, + u8 reg_fan_high) +{ + unsigned int f1, f2; + int ret; + + mutex_lock(&data->access_lock); + ret = regmap_read(data->regmap, reg_fan_low, &f1); + if (ret < 0) + goto abort; + ret = regmap_read(data->regmap, reg_fan_high, &f2); + if (ret < 0) + goto abort; + ret = f1 | ((f2 & 0xf8) << 5); + /* convert fan count to rpm */ + if (ret == 0x1fff) /* maximum value, assume no limit */ + ret = 0; + else if (ret) + ret = DIV_ROUND_CLOSEST(1350000U, ret); + else + ret = 1350000U; +abort: + mutex_unlock(&data->access_lock); + return ret; +} + +static int nct7511_write_fan_min(struct nct7511_data *data, u8 reg_fan_low, + u8 reg_fan_high, unsigned long limit) +{ + int err; + + if (limit) + limit = DIV_ROUND_CLOSEST(1350000U, limit); + else + limit = 0x1fff; + limit = clamp_val(limit, 0, 0x1fff); + + mutex_lock(&data->access_lock); + err = regmap_write(data->regmap, reg_fan_low, limit & 0xff); + if (err < 0) + goto abort; + + err = regmap_write(data->regmap, reg_fan_high, (limit & 0x1f00) >> 5); +abort: + mutex_unlock(&data->access_lock); + return err; +} + +static ssize_t show_temp(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct nct7511_data *data = dev_get_drvdata(dev); + struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); + int err, temp; + + err = nct7511_read_temp(data, sattr->nr, sattr->index, &temp); + if (err < 0) + return err; + + return sprintf(buf, "%d\n", temp); +} + +static ssize_t store_temp(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); + struct nct7511_data *data = dev_get_drvdata(dev); + int nr = sattr->nr; + long val; + int err; + + err = kstrtol(buf, 10, &val); + if (err < 0) + return err; + + val = DIV_ROUND_CLOSEST(clamp_val(val, -128000, 127000), 1000); + + err = regmap_write(data->regmap, nr, val & 0xff); + return err ? : count; +} + +static ssize_t show_fan(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr); + struct nct7511_data *data = dev_get_drvdata(dev); + int speed; + + speed = nct7511_read_fan(data, sattr->index); + if (speed < 0) + return speed; + + return sprintf(buf, "%d\n", speed); +} + +static ssize_t show_fan_min(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); + struct nct7511_data *data = dev_get_drvdata(dev); + int speed; + + speed = nct7511_read_fan_min(data, sattr->nr, sattr->index); + if (speed < 0) + return speed; + + return sprintf(buf, "%d\n", speed); +} + +static ssize_t store_fan_min(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); + struct nct7511_data *data = dev_get_drvdata(dev); + unsigned long val; + int err; + + err = kstrtoul(buf, 10, &val); + if (err < 0) + return err; + + err = nct7511_write_fan_min(data, sattr->nr, sattr->index, val); + return err ? : count; +} + +static ssize_t show_alarm(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct nct7511_data *data = dev_get_drvdata(dev); + struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); + int bit = sattr->index; + unsigned int val; + int ret; + + ret = regmap_read(data->regmap, sattr->nr, &val); + if (ret < 0) + return ret; + + return sprintf(buf, "%u\n", !!(val & (1 << bit))); +} + +static ssize_t +show_beep(struct device *dev, struct device_attribute *attr, char *buf) +{ + struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); + struct nct7511_data *data = dev_get_drvdata(dev); + unsigned int regval; + int err; + + err = regmap_read(data->regmap, sattr->nr, ®val); + if (err) + return err; + + return sprintf(buf, "%u\n", !!(regval & (1 << sattr->index))); +} + +static ssize_t +store_beep(struct device *dev, struct device_attribute *attr, const char *buf, + size_t count) +{ + struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); + struct nct7511_data *data = dev_get_drvdata(dev); + unsigned long val; + int err; + + err = kstrtoul(buf, 10, &val); + if (err < 0) + return err; + if (val > 1) + return -EINVAL; + + err = regmap_update_bits(data->regmap, sattr->nr, 1 << sattr->index, + val ? 1 << sattr->index : 0); + return err ? : count; +} + +static SENSOR_DEVICE_ATTR(temp1_type, S_IRUGO | S_IWUSR, + show_temp_type, store_temp_type, 0); +static SENSOR_DEVICE_ATTR_2(temp1_input, S_IRUGO, show_temp, NULL, 0x01, + REG_TEMP_LSB); +static SENSOR_DEVICE_ATTR_2(temp1_min, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x31, 0); +static SENSOR_DEVICE_ATTR_2(temp1_max, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x30, 0); +static SENSOR_DEVICE_ATTR_2(temp1_crit, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x3a, 0); + +static SENSOR_DEVICE_ATTR(temp2_type, S_IRUGO | S_IWUSR, + show_temp_type, store_temp_type, 1); +static SENSOR_DEVICE_ATTR_2(temp2_input, S_IRUGO, show_temp, NULL, 0x02, + REG_TEMP_LSB); +static SENSOR_DEVICE_ATTR_2(temp2_min, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x33, 0); +static SENSOR_DEVICE_ATTR_2(temp2_max, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x32, 0); +static SENSOR_DEVICE_ATTR_2(temp2_crit, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x3b, 0); + +static SENSOR_DEVICE_ATTR(temp3_type, S_IRUGO | S_IWUSR, + show_temp_type, store_temp_type, 2); +static SENSOR_DEVICE_ATTR_2(temp3_input, S_IRUGO, show_temp, NULL, 0x03, + REG_TEMP_LSB); +static SENSOR_DEVICE_ATTR_2(temp3_min, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x35, 0); +static SENSOR_DEVICE_ATTR_2(temp3_max, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x34, 0); +static SENSOR_DEVICE_ATTR_2(temp3_crit, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x3c, 0); + +static SENSOR_DEVICE_ATTR_2(temp4_input, S_IRUGO, show_temp, NULL, 0x04, 0); +static SENSOR_DEVICE_ATTR_2(temp4_min, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x37, 0); +static SENSOR_DEVICE_ATTR_2(temp4_max, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x36, 0); +static SENSOR_DEVICE_ATTR_2(temp4_crit, S_IRUGO | S_IWUSR, show_temp, + store_temp, 0x3d, 0); + + +static SENSOR_DEVICE_ATTR_2(temp1_min_alarm, S_IRUGO, show_alarm, NULL, + 0x18, 0); +static SENSOR_DEVICE_ATTR_2(temp2_min_alarm, S_IRUGO, show_alarm, NULL, + 0x18, 1); +static SENSOR_DEVICE_ATTR_2(temp3_min_alarm, S_IRUGO, show_alarm, NULL, + 0x18, 2); +static SENSOR_DEVICE_ATTR_2(temp4_min_alarm, S_IRUGO, show_alarm, NULL, + 0x18, 3); + +static SENSOR_DEVICE_ATTR_2(temp1_max_alarm, S_IRUGO, show_alarm, NULL, + 0x19, 0); +static SENSOR_DEVICE_ATTR_2(temp2_max_alarm, S_IRUGO, show_alarm, NULL, + 0x19, 1); +static SENSOR_DEVICE_ATTR_2(temp3_max_alarm, S_IRUGO, show_alarm, NULL, + 0x19, 2); +static SENSOR_DEVICE_ATTR_2(temp4_max_alarm, S_IRUGO, show_alarm, NULL, + 0x19, 3); + + +static SENSOR_DEVICE_ATTR_2(temp1_crit_alarm, S_IRUGO, show_alarm, NULL, + 0x1b, 0); +static SENSOR_DEVICE_ATTR_2(temp2_crit_alarm, S_IRUGO, show_alarm, NULL, + 0x1b, 1); +static SENSOR_DEVICE_ATTR_2(temp3_crit_alarm, S_IRUGO, show_alarm, NULL, + 0x1b, 2); +static SENSOR_DEVICE_ATTR_2(temp4_crit_alarm, S_IRUGO, show_alarm, NULL, + 0x1b, 3); + +static SENSOR_DEVICE_ATTR_2(temp1_fault, S_IRUGO, show_alarm, NULL, 0x17, 0); +static SENSOR_DEVICE_ATTR_2(temp2_fault, S_IRUGO, show_alarm, NULL, 0x17, 1); +static SENSOR_DEVICE_ATTR_2(temp3_fault, S_IRUGO, show_alarm, NULL, 0x17, 2); + +static SENSOR_DEVICE_ATTR_2(temp1_beep, S_IRUGO | S_IWUSR, show_beep, + store_beep, 0x5c, 0); +static SENSOR_DEVICE_ATTR_2(temp2_beep, S_IRUGO | S_IWUSR, show_beep, + store_beep, 0x5c, 1); +static SENSOR_DEVICE_ATTR_2(temp3_beep, S_IRUGO | S_IWUSR, show_beep, + store_beep, 0x5c, 2); +static SENSOR_DEVICE_ATTR_2(temp4_beep, S_IRUGO | S_IWUSR, show_beep, + store_beep, 0x5c, 3); + +static struct attribute *nct7511_temp_attrs[] = { + &sensor_dev_attr_temp1_type.dev_attr.attr, + &sensor_dev_attr_temp1_input.dev_attr.attr, + &sensor_dev_attr_temp1_min.dev_attr.attr, + &sensor_dev_attr_temp1_max.dev_attr.attr, + &sensor_dev_attr_temp1_crit.dev_attr.attr, + &sensor_dev_attr_temp1_min_alarm.dev_attr.attr, + &sensor_dev_attr_temp1_max_alarm.dev_attr.attr, + &sensor_dev_attr_temp1_crit_alarm.dev_attr.attr, + &sensor_dev_attr_temp1_fault.dev_attr.attr, + &sensor_dev_attr_temp1_beep.dev_attr.attr, + + &sensor_dev_attr_temp2_type.dev_attr.attr, /* 10 */ + &sensor_dev_attr_temp2_input.dev_attr.attr, + &sensor_dev_attr_temp2_min.dev_attr.attr, + &sensor_dev_attr_temp2_max.dev_attr.attr, + &sensor_dev_attr_temp2_crit.dev_attr.attr, + &sensor_dev_attr_temp2_min_alarm.dev_attr.attr, + &sensor_dev_attr_temp2_max_alarm.dev_attr.attr, + &sensor_dev_attr_temp2_crit_alarm.dev_attr.attr, + &sensor_dev_attr_temp2_fault.dev_attr.attr, + &sensor_dev_attr_temp2_beep.dev_attr.attr, + + &sensor_dev_attr_temp3_type.dev_attr.attr, /* 20 */ + &sensor_dev_attr_temp3_input.dev_attr.attr, + &sensor_dev_attr_temp3_min.dev_attr.attr, + &sensor_dev_attr_temp3_max.dev_attr.attr, + &sensor_dev_attr_temp3_crit.dev_attr.attr, + &sensor_dev_attr_temp3_min_alarm.dev_attr.attr, + &sensor_dev_attr_temp3_max_alarm.dev_attr.attr, + &sensor_dev_attr_temp3_crit_alarm.dev_attr.attr, + &sensor_dev_attr_temp3_fault.dev_attr.attr, + &sensor_dev_attr_temp3_beep.dev_attr.attr, + + &sensor_dev_attr_temp4_input.dev_attr.attr, /* 30 */ + &sensor_dev_attr_temp4_min.dev_attr.attr, + &sensor_dev_attr_temp4_max.dev_attr.attr, + &sensor_dev_attr_temp4_crit.dev_attr.attr, + &sensor_dev_attr_temp4_min_alarm.dev_attr.attr, + &sensor_dev_attr_temp4_max_alarm.dev_attr.attr, + &sensor_dev_attr_temp4_crit_alarm.dev_attr.attr, + &sensor_dev_attr_temp4_beep.dev_attr.attr, + + NULL +}; + +static umode_t nct7511_temp_is_visible(struct kobject *kobj, + struct attribute *attr, int index) +{ + struct device *dev = container_of(kobj, struct device, kobj); + struct nct7511_data *data = dev_get_drvdata(dev); + unsigned int reg; + int err; + + err = regmap_read(data->regmap, REG_MODE, ®); + if (err < 0) + return 0; + + if (index < 10 && + (reg & 03) != 0x01 && (reg & 0x03) != 0x02) /* RD1 */ + return 0; + + if (index >= 10 && index < 20 && + (reg & 0x0c) != 0x04 && (reg & 0x0c) != 0x08) /* RD2 */ + return 0; + if (index >= 20 && index < 30 && (reg & 0x30) != 0x20) /* RD3 */ + return 0; + + if (index >= 30 && index < 38) /* local */ + return attr->mode; + + return attr->mode; +} + +static struct attribute_group nct7511_temp_group = { + .attrs = nct7511_temp_attrs, + .is_visible = nct7511_temp_is_visible, +}; + + +static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_fan, NULL, 0x10); +static SENSOR_DEVICE_ATTR_2(fan1_min, S_IRUGO | S_IWUSR, show_fan_min, + store_fan_min, 0x49, 0x4c); +static SENSOR_DEVICE_ATTR_2(fan1_alarm, S_IRUGO, show_alarm, NULL, 0x1a, 0); +static SENSOR_DEVICE_ATTR_2(fan1_beep, S_IRUGO | S_IWUSR, show_beep, store_beep, + 0x5b, 0); + +/* 7.2.89 Fan Control Output Type */ +static SENSOR_DEVICE_ATTR(pwm1_mode, S_IRUGO, show_pwm_mode, NULL, 0); + +/* 7.2.91... Fan Control Output Value */ +static SENSOR_DEVICE_ATTR(pwm1, S_IRUGO | S_IWUSR, show_pwm, store_pwm, + REG_PWM(0)); + + +/* 7.2.95... Temperature to Fan mapping Relationships Register */ +static SENSOR_DEVICE_ATTR(pwm1_enable, S_IRUGO | S_IWUSR, show_pwm_enable, + store_pwm_enable, 0); + + +static struct attribute *nct7511_fan_attrs[] = { + &sensor_dev_attr_fan1_input.dev_attr.attr, + &sensor_dev_attr_fan1_min.dev_attr.attr, + &sensor_dev_attr_fan1_alarm.dev_attr.attr, + &sensor_dev_attr_fan1_beep.dev_attr.attr, + NULL +}; + +static umode_t nct7511_fan_is_visible(struct kobject *kobj, + struct attribute *attr, int index) +{ + struct device *dev = container_of(kobj, struct device, kobj); + struct nct7511_data *data = dev_get_drvdata(dev); + int fan = index / 4; /* 4 attributes per fan */ + unsigned int reg; + int err; + + err = regmap_read(data->regmap, REG_FAN_ENABLE, ®); + if (err < 0 || !(reg & (1 << fan))) + return 0; + + return attr->mode; +} + +static struct attribute_group nct7511_fan_group = { + .attrs = nct7511_fan_attrs, + .is_visible = nct7511_fan_is_visible, +}; + +static struct attribute *nct7511_pwm_attrs[] = { + &sensor_dev_attr_pwm1_enable.dev_attr.attr, + &sensor_dev_attr_pwm1_mode.dev_attr.attr, + &sensor_dev_attr_pwm1.dev_attr.attr, + NULL +}; + +static struct attribute_group nct7511_pwm_group = { + .attrs = nct7511_pwm_attrs, +}; + +/* 7.2.115... 0x80-0x83, 0x84 Temperature (X-axis) transition */ +static SENSOR_DEVICE_ATTR_2(pwm1_auto_point1_temp, S_IRUGO | S_IWUSR, + show_temp, store_temp, 0x80, 0); +static SENSOR_DEVICE_ATTR_2(pwm1_auto_point2_temp, S_IRUGO | S_IWUSR, + show_temp, store_temp, 0x81, 0); +static SENSOR_DEVICE_ATTR_2(pwm1_auto_point3_temp, S_IRUGO | S_IWUSR, + show_temp, store_temp, 0x82, 0); +static SENSOR_DEVICE_ATTR_2(pwm1_auto_point4_temp, S_IRUGO | S_IWUSR, + show_temp, store_temp, 0x83, 0); +static SENSOR_DEVICE_ATTR_2(pwm1_auto_point5_temp, S_IRUGO | S_IWUSR, + show_temp, store_temp, 0x84, 0); + +/* 7.2.120... 0x85-0x88 PWM (Y-axis) transition */ +static SENSOR_DEVICE_ATTR(pwm1_auto_point1_pwm, S_IRUGO | S_IWUSR, + show_pwm, store_pwm, 0x85); +static SENSOR_DEVICE_ATTR(pwm1_auto_point2_pwm, S_IRUGO | S_IWUSR, + show_pwm, store_pwm, 0x86); +static SENSOR_DEVICE_ATTR(pwm1_auto_point3_pwm, S_IRUGO | S_IWUSR, + show_pwm, store_pwm, 0x87); +static SENSOR_DEVICE_ATTR(pwm1_auto_point4_pwm, S_IRUGO | S_IWUSR, + show_pwm, store_pwm, 0x88); +static SENSOR_DEVICE_ATTR(pwm1_auto_point5_pwm, S_IRUGO, show_pwm, NULL, 0); + + +static struct attribute *nct7511_auto_point_attrs[] = { + &sensor_dev_attr_pwm1_auto_point1_temp.dev_attr.attr, + &sensor_dev_attr_pwm1_auto_point2_temp.dev_attr.attr, + &sensor_dev_attr_pwm1_auto_point3_temp.dev_attr.attr, + &sensor_dev_attr_pwm1_auto_point4_temp.dev_attr.attr, + &sensor_dev_attr_pwm1_auto_point5_temp.dev_attr.attr, + + &sensor_dev_attr_pwm1_auto_point1_pwm.dev_attr.attr, + &sensor_dev_attr_pwm1_auto_point2_pwm.dev_attr.attr, + &sensor_dev_attr_pwm1_auto_point3_pwm.dev_attr.attr, + &sensor_dev_attr_pwm1_auto_point4_pwm.dev_attr.attr, + &sensor_dev_attr_pwm1_auto_point5_pwm.dev_attr.attr, + + NULL +}; + +static struct attribute_group nct7511_auto_point_group = { + .attrs = nct7511_auto_point_attrs, +}; + +static const struct attribute_group *nct7511_groups[] = { + &nct7511_temp_group, + &nct7511_fan_group, + &nct7511_pwm_group, + &nct7511_auto_point_group, + NULL +}; + +static int nct7511_detect(struct i2c_client *client, + struct i2c_board_info *info) +{ + int reg; + + reg = i2c_smbus_read_byte_data(client, REG_VENDOR_ID); + if (reg != 0x50) + return -ENODEV; + + reg = i2c_smbus_read_byte_data(client, REG_CHIP_ID); + if (reg != 0xc3) + return -ENODEV; + + reg = i2c_smbus_read_byte_data(client, REG_VERSION_ID); + if (reg < 0 || (reg & 0xf0) != 0x20) + return -ENODEV; + + /* Also validate lower bits of voltage and temperature registers */ + reg = i2c_smbus_read_byte_data(client, REG_TEMP_LSB); + if (reg < 0 || (reg & 0x1f)) + return -ENODEV; + + strlcpy(info->type, "nct7511", I2C_NAME_SIZE); + return 0; +} + +static bool nct7511_regmap_is_volatile(struct device *dev, unsigned int reg) +{ + return (reg != REG_BANK && reg <= 0x20) || + (reg >= REG_PWM(0) && reg <= REG_PWM(2)); +} + +static const struct regmap_config nct7511_regmap_config = { + .reg_bits = 8, + .val_bits = 8, + .cache_type = REGCACHE_RBTREE, + .volatile_reg = nct7511_regmap_is_volatile, +}; + +static int nct7511_init_chip(struct nct7511_data *data) +{ + int err; + + /* Enable ADC */ + err = regmap_update_bits(data->regmap, REG_START, 0x01, 0x01); + if (err) + return err; + /* Enable local temperature sensor */ + return regmap_update_bits(data->regmap, REG_MODE, 0x40, 0x40); +} + +static int nct7511_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct device *dev = &client->dev; + struct nct7511_data *data; + struct device *hwmon_dev; + int ret; + + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + if (data == NULL) + return -ENOMEM; + + data->regmap = devm_regmap_init_i2c(client, &nct7511_regmap_config); + if (IS_ERR(data->regmap)) + return PTR_ERR(data->regmap); + + mutex_init(&data->access_lock); + + ret = nct7511_init_chip(data); + if (ret < 0) + return ret; + + hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name, + data, + nct7511_groups); + return PTR_ERR_OR_ZERO(hwmon_dev); +} + + +static const struct i2c_device_id nct7511_idtable[] = { + { "nct7511", 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, nct7511_idtable); + +static struct i2c_driver nct7511_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = DRVNAME, + }, + .detect = nct7511_detect, + .probe = nct7511_probe, + .id_table = nct7511_idtable, +}; + +module_i2c_driver(nct7511_driver); + +MODULE_AUTHOR("Cameo "); +MODULE_DESCRIPTION("NCT7511Y Hardware Monitoring Driver"); +MODULE_LICENSE("GPL v2"); diff --git a/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/modules/nct7511.mod.c b/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/modules/nct7511.mod.c new file mode 100644 index 0000000000..01d8c4b362 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/modules/nct7511.mod.c @@ -0,0 +1,52 @@ +#include +#include +#include + +MODULE_INFO(vermagic, VERMAGIC_STRING); + +__visible struct module __this_module +__attribute__((section(".gnu.linkonce.this_module"))) = { + .name = KBUILD_MODNAME, + .init = init_module, +#ifdef CONFIG_MODULE_UNLOAD + .exit = cleanup_module, +#endif + .arch = MODULE_ARCH_INIT, +}; + +#ifdef RETPOLINE +MODULE_INFO(retpoline, "Y"); +#endif + +static const struct modversion_info ____versions[] +__used +__attribute__((section("__versions"))) = { + { 0xd1a11d1c, __VMLINUX_SYMBOL_STR(module_layout) }, + { 0x8308dcad, __VMLINUX_SYMBOL_STR(i2c_del_driver) }, + { 0x851c3bfc, __VMLINUX_SYMBOL_STR(i2c_register_driver) }, + { 0xbba4aa3a, __VMLINUX_SYMBOL_STR(devm_hwmon_device_register_with_groups) }, + { 0x888680a0, __VMLINUX_SYMBOL_STR(__mutex_init) }, + { 0x2daa70fe, __VMLINUX_SYMBOL_STR(__devm_regmap_init_i2c) }, + { 0x32a81c89, __VMLINUX_SYMBOL_STR(devm_kmalloc) }, + { 0x5792f848, __VMLINUX_SYMBOL_STR(strlcpy) }, + { 0x14c72286, __VMLINUX_SYMBOL_STR(i2c_smbus_read_byte_data) }, + { 0xa46f2f1b, __VMLINUX_SYMBOL_STR(kstrtouint) }, + { 0x60ea2d6, __VMLINUX_SYMBOL_STR(kstrtoull) }, + { 0x783815ef, __VMLINUX_SYMBOL_STR(regmap_update_bits_base) }, + { 0x94218140, __VMLINUX_SYMBOL_STR(mutex_unlock) }, + { 0x86b8d7be, __VMLINUX_SYMBOL_STR(mutex_lock) }, + { 0x1b17e06c, __VMLINUX_SYMBOL_STR(kstrtoll) }, + { 0xaee034fd, __VMLINUX_SYMBOL_STR(regmap_write) }, + { 0x5a5a94a6, __VMLINUX_SYMBOL_STR(kstrtou8) }, + { 0x91715312, __VMLINUX_SYMBOL_STR(sprintf) }, + { 0xdb7305a1, __VMLINUX_SYMBOL_STR(__stack_chk_fail) }, + { 0x12872e73, __VMLINUX_SYMBOL_STR(regmap_read) }, + { 0xbdfb6dbb, __VMLINUX_SYMBOL_STR(__fentry__) }, +}; + +static const char __module_depends[] +__used +__attribute__((section(".modinfo"))) = +"depends="; + +MODULE_ALIAS("i2c:nct7511"); diff --git a/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/modules/x86-64-cameo-esqc610-56sq.c b/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/modules/x86-64-cameo-esqc610-56sq.c new file mode 100644 index 0000000000..24ba464f01 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/modules/x86-64-cameo-esqc610-56sq.c @@ -0,0 +1,2426 @@ +/* An hwmon driver for Cameo ESQC610-56SQ Innovium i2c Module */ +#pragma GCC diagnostic ignored "-Wformat-zero-length" +#include "x86-64-cameo-esqc610-56sq.h" + +/* Addresses scanned */ +static const unsigned short normal_i2c[] = { 0x30, 0x31, 0x32, I2C_CLIENT_END }; + +#if (defined THEMAL_WANTED)|| (defined ASPEED_BMC_WANTED) +int read_8bit_temp(u8 sign,u8 value) +{ + int result = 0; + if(sign) + { + //printf("read_8bit_temp UP %d\n", value & 0x80); + value = ~(value)+1; + result = value; + return result; + } + else + { + //printf("read_8bit_temp DOWN %d\n", value & 0x80); + result = value; + return result; + } +} +#endif + +/* i2c-0 function */ + +static ssize_t psu_status_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 bmc_present = -EPERM; + u8 status = -EPERM; + u8 mask = 0x1; + u8 res = 0x1; + int i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + bmc_present = i2c_smbus_read_byte_data(ESQC_610_i2c_client, BMC_PRESENT_OFFSET); + if (bmc_present & mask) + { + status = i2c_smbus_read_byte_data(Cameo_BMC_client, 0xc0); //BMC 0x14 0xc0 + } + else + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_5_client, 0xa0); //CPLD 0x35 0xa0 + } + debug_print((KERN_DEBUG "DEBUG : PSU_PRESENT status = %x\n",status)); + sprintf(buf, ""); + switch (attr->index) + { + case PSU_PRESENT: + for (i = 1; i <= 2; i++) + { + if (status & res) + { + sprintf(buf, "%sPSU %d is present\n", buf, i); + } + else + { + sprintf(buf, "%sPSU %d is not present\n", buf, i); + } + res = res << 1; + } + break; + case PSU_STATUS: + res = 0x1; + res = res << 2; + if (status & res) + { + sprintf(buf, "%sPSU 1 is not power Good\n", buf); + } + else + { + sprintf(buf, "%sPSU 1 is power Good\n", buf); + } + res = 0x1; + res = res << 3; + if (status & res) + { + sprintf(buf, "%sPSU 2 is not power Good\n", buf); + } + else + { + sprintf(buf, "%sPSU 2 is power Good\n", buf); + } + break; + } + return sprintf(buf, "%s\n", buf); +} + +#ifdef THEMAL_WANTED +static long read_reg_linear(s32 data) +{ + s16 exponent; + s32 mantissa; + long val; + + exponent = ((s16)data) >> 11; + mantissa = ((s16)((data & 0x7ff) << 5)) >> 5; + + val = mantissa; + val = val * 1000L; + + if (exponent >= 0) + val <<= exponent; + else + val >>= -exponent; + + return val/1000; +} + +static long read_reg_linear_1000(s32 data) +{ + s16 exponent; + s32 mantissa; + long val; + + exponent = ((s16)data) >> 11; + mantissa = ((s16)((data & 0x7ff) << 5)) >> 5; + + val = mantissa; + val = val * 1000L; + + if (exponent >= 0) + val <<= exponent; + else + val >>= -exponent; + + return val; +} + +static long read_reg_linear_auto(s8 mode, u16 data) +{ + s16 exponent; + s32 mantissa; + long val; + + exponent = ((s8)(mode << 3)) >> 3; + mantissa = ((u16)data); + + val = mantissa; + + /*printk(KERN_ALERT "exponent= %d, mantissa= %d, val= %d\n",exponent,mantissa,val);*/ + + if (exponent >= 0) + val <<= exponent; + else + val >>= -exponent; + + return val*1000; +} +#endif + +#ifdef PSU_DEBUG +static long read_reg_vid(s32 data) +{ + long val; + val = (((data-1)*5)+250)*1000L; + return val/1000; +} + +static long read_reg_vid_10mv(s32 data) +{ + long val; + val = (((data-1)*10)+500)*1000L; + return val/1000; +} + +static long read_reg_vid_13mv(s32 data) +{ + long val; + val = ((((data-1)*1333)+65000)/100)*1000L; + return val/1000; +} +#endif + +#ifdef PSU_STAT_WANTED +static int two_complement_to_int(u16 data, u8 valid_bit, int mask) +{ + u16 valid_data = data & mask; + bool is_negative = valid_data >> (valid_bit - 1); + + return is_negative ? (-(((~valid_data) & mask) + 1)) : valid_data; +} + +static ssize_t psu_module_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 bmc_present = -EPERM; + u8 module_num = 0; + u8 psu_table [3][11] = + { + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + {0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a}, + {0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a} + }; + u32 psu_status [11] = {0}; + u8 mask = 0x1; + u8 i = 0; + u16 u16_val = 0; + int exponent = 0, mantissa = 0; + int multiplier = 1000; // lm-sensor uint: mV, mA, mC + + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + sprintf(buf, "\n"); + + bmc_present = i2c_smbus_read_byte_data(ESQC_610_i2c_client, BMC_PRESENT_OFFSET); + if (bmc_present & mask) + { + switch(attr->index) + { + case PSU_MODULE_1: + module_num = 1; + break; + case PSU_MODULE_2: + module_num = 2; + break; + } + for(i = 0; i < 10; i ++) + { + u16_val = i2c_smbus_read_word_data(Cameo_BMC_client, psu_table[module_num][i]); + /* word data with linear format */ + if (i != 2 && i != 8) { + multiplier = 1000; + if (i == 6 || i == 7) /* pin, pout */ + multiplier = 1000000; // lm-sensor unit: uW + if ( i == 5 ) /* fan_speed */ + multiplier = 1; + + exponent = two_complement_to_int(u16_val >> 11, 5, 0x1f); + mantissa = two_complement_to_int(u16_val & 0x7ff, 11, 0x7ff); + psu_status[i] = (exponent >= 0) ? ((mantissa << exponent)*multiplier) : \ + (mantissa*multiplier / (1 << -exponent)); + } + } + /* vout mode */ + multiplier = 1000; + u16_val = i2c_smbus_read_byte_data(Cameo_BMC_client, psu_table[module_num][10]); + psu_status[10] = u16_val; + exponent = two_complement_to_int(u16_val & 0x1f, 5, 0x1f); + /* vout */ + u16_val = i2c_smbus_read_word_data(Cameo_BMC_client, psu_table[module_num][2]); + psu_status[2] = (exponent >= 0) ? ((u16_val << exponent)*multiplier) : \ + (u16_val*multiplier / (1 << -exponent)); + + sprintf(buf, "%sPSU %d VIN is %d\n", buf, module_num, psu_status[0]); + sprintf(buf, "%sPSU %d IIN is %d\n", buf, module_num, psu_status[1]); + sprintf(buf, "%sPSU %d VOUT is %d\n", buf, module_num, psu_status[2]); + sprintf(buf, "%sPSU %d IOUT is %d\n", buf, module_num, psu_status[3]); + sprintf(buf, "%sPSU %d TEMP_1 is %d\n", buf, module_num, psu_status[4]); + sprintf(buf, "%sPSU %d FAN_SPEED is %d\n", buf, module_num, psu_status[5]); + sprintf(buf, "%sPSU %d POUT is %d\n", buf, module_num, psu_status[6]); + sprintf(buf, "%sPSU %d PIN is %d\n", buf, module_num, psu_status[7]); + sprintf(buf, "%sPSU %d MFR_MODEL is %d\n", buf, module_num, psu_status[8]); + sprintf(buf, "%sPSU %d MFR_IOUT_MAX is %d\n", buf, module_num, psu_status[9]); + sprintf(buf, "%sPSU %d VMODE is %d\n", buf, module_num, psu_status[10]); + } + else + { + sprintf(buf, "%sBMC Module is not present\n", buf); + } + return sprintf(buf, "%s", buf); +} + +static ssize_t dc_chip_switch_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 bmc_present = -EPERM; + u8 dc_table [12] = {0x90, 0x91, 0x92, 0x94, 0x95, 0x96, 0x98, 0x99, 0x9a, 0x9c, 0x9d, 0x9e}; + u16 dc_status [12] = {0}; + u8 mask = 0x1; + u8 i = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + sprintf(buf, "\n"); + if (attr->index == DC_CHIP_SWITCH) + { + bmc_present = i2c_smbus_read_byte_data(ESQC_610_i2c_client, BMC_PRESENT_OFFSET); //CPLD 0x30 0xa4 + if (bmc_present & mask) + { + for(i = 0; i < 12; i ++) + { + dc_status[i] = i2c_smbus_read_word_data(Cameo_BMC_client, dc_table[i]); + } + sprintf(buf, "%sTPS53681 0x6e page 0 Vin 0x%x\n", buf, dc_status[0]); + sprintf(buf, "%sTPS53681 0x6e page 0 Iout 0x%x\n", buf, dc_status[1]); + sprintf(buf, "%sTPS53681 0x6e page 0 Pout 0x%x\n", buf, dc_status[2]); + sprintf(buf, "%sTPS53681 0x6e page 1 Vin 0x%x\n", buf, dc_status[3]); + sprintf(buf, "%sTPS53681 0x6e page 1 Iout 0x%x\n", buf, dc_status[4]); + sprintf(buf, "%sTPS53681 0x6e page 1 Pout 0x%x\n", buf, dc_status[5]); + sprintf(buf, "%sTPS53681 0x70 page 0 Vin 0x%x\n", buf, dc_status[6]); + sprintf(buf, "%sTPS53681 0x70 page 0 Iout 0x%x\n", buf, dc_status[7]); + sprintf(buf, "%sTPS53681 0x70 page 0 Pout 0x%x\n", buf, dc_status[8]); + sprintf(buf, "%sTPS53681 0x70 page 1 Vin 0x%x\n", buf, dc_status[9]); + sprintf(buf, "%sTPS53681 0x70 page 1 Iout 0x%x\n", buf, dc_status[10]); + sprintf(buf, "%sTPS53681 0x70 page 1 Pout 0x%x\n", buf, dc_status[11]); + } + else + { + sprintf(buf, "%sBMC Module is not present\n", buf); + } + } + return sprintf(buf, "%s\n", buf); +} + +#endif + +#ifdef USB_CTRL_WANTED +static ssize_t usb_power_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 res = 0x1; + int i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + status = i2c_smbus_read_byte_data(ESQC_610_i2c_client, 0xa0); + debug_print((KERN_DEBUG "DEBUG : USB_POWER status = %x\n",status)); + sprintf(buf, ""); + if (attr->index == USB_POWER) + { + for (i = 1; i <= 2; i++) + { + if (i == GET_USB) + { + if (status & res) + { + sprintf(buf, "%sUSB Power is ON\n", buf); + } + else + { + sprintf(buf, "%sUSB Power is OFF\n", buf); + } + } + res = res << 1; + } + } + return sprintf(buf, "%s\n", buf); +} + +static ssize_t usb_power_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 status = -EPERM; + u8 value = -EPERM; + u8 result = -EPERM; + u16 i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *data = i2c_get_clientdata(ESQC_610_i2c_client); + + mutex_lock(&data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_lock\n")); + status = i2c_smbus_read_byte_data(ESQC_610_i2c_client, 0xa0); + debug_print((KERN_DEBUG "DEBUG : USB_POWER status = %x\n",status)); + if (attr->index == USB_POWER) + { + i = simple_strtol(buf, NULL, 10); + if (i == TURN_ON) + { + value = status | USB_ON; + debug_print((KERN_DEBUG "DEBUG : USB_POWER value = %x\n",value)); + result = i2c_smbus_write_byte_data(ESQC_610_i2c_client, 0xa0, value); + debug_print((KERN_DEBUG "DEBUG : USB_POWER result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: usb_ctrl_set ON FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "USB Power is ON\n")); + } + } + else if (i == TURN_OFF) + { + value = status & USB_OFF; + debug_print((KERN_DEBUG "DEBUG : USB_POWER value = %x\n",value)); + result = i2c_smbus_write_byte_data(ESQC_610_i2c_client, 0xa0, value); + debug_print((KERN_DEBUG "DEBUG : USB_POWER result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: usb_power_set OFF FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "USB Power is OFF\n")); + } + } + else + { + printk(KERN_ALERT "USB_POWER set wrong Value\n"); + } + } + mutex_unlock(&data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_unlock\n")); + return count; +} +#endif + +#ifdef LED_CTRL_WANTED +static ssize_t led_ctrl_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 res = 0x1; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + if (attr->index == LED_CTRL) + { + status = i2c_smbus_read_byte_data(ESQC_610_i2c_client, 0xa0); + debug_print((KERN_DEBUG "DEBUG : LED_CTRL status = %x\n",status)); + sprintf(buf, ""); + if (status & res) + { + sprintf(buf, "%sFiber LED is set to ON\n", buf); + } + else + { + sprintf(buf, "%sFiber LED is set to OFF\n", buf); + } + } + return sprintf(buf, "%s\n", buf); +} + +static ssize_t led_ctrl_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 status = 0; + u8 value = 0; + u8 result = 0; + u16 i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *data = i2c_get_clientdata(ESQC_610_i2c_client); + + mutex_lock(&data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_lock\n")); + if (attr->index == LED_CTRL) + { + i = simple_strtol(buf, NULL, 10); + if (i == TURN_ON) + { + status = i2c_smbus_read_byte_data(ESQC_610_i2c_client, 0xa0); + debug_print((KERN_DEBUG "DEBUG : LED_CTRL status = %x\n",status)); + value = status | LED_ON; + debug_print((KERN_DEBUG "DEBUG : LED_CTRL value = %x\n",value)); + result = i2c_smbus_write_byte_data(ESQC_610_i2c_client, 0xa0, value); + debug_print((KERN_DEBUG "DEBUG : LED_CTRL result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: led_ctrl_set on FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "DEBUG : Fiber LED is set to ON\n")); + } + } + else if (i == TURN_OFF) + { + status = i2c_smbus_read_byte_data(ESQC_610_i2c_client, 0xa0); + debug_print((KERN_DEBUG "DEBUG : LED_CTRL status = %x\n",status)); + value = status & LED_OFF; + debug_print((KERN_DEBUG "DEBUG : LED_CTRL value = %x\n",value)); + result = i2c_smbus_write_byte_data(ESQC_610_i2c_client, 0xa0, value); + debug_print((KERN_DEBUG "DEBUG : LED_CTRL result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: led_ctrl_set off FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "DEBUG : Fiber LED is set to OFF\n")); + } + } + else + { + printk(KERN_ALERT "LED set wrong Value\n"); + } + } + mutex_unlock(&data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_unlock\n")); + return count; +} +#endif + +static ssize_t sys_led_ctrl_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 res = 0x1; + int i; + int led_a_status = 0; + int led_g_status = 0; + int led_b_status = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + status = i2c_smbus_read_byte_data(ESQC_610_i2c_client, 0xa2); //to get register 0x30 0xa2 + debug_print((KERN_DEBUG "DEBUG : sys_led_ctrl_get led status = %x\n",status)); + sprintf(buf, ""); + + for (i = 1; i <= 4; i++) + { + if ( i == attr->index) + { + if (status & res) + { + led_a_status = TURN_ON; + } + else + { + led_a_status = TURN_OFF; + } + } + res = res << 1; + if( i == (attr->index + 1) ) + { + if (status & res) + { + led_g_status = TURN_ON; + } + else + { + led_g_status = TURN_OFF; + } + } + res = res << 1; + } + res = 0x1; + + status = i2c_smbus_read_byte_data(ESQC_610_i2c_client, 0xa3); //to get register 0x30 0xa3 + debug_print((KERN_DEBUG "DEBUG : sys_led_ctrl_get blk status = %x\n",status)); + for (i = 1; i <= 4; i++) + { + if ( i == attr->index) + { + if (status & res) + { + led_b_status = TURN_ON; + } + else + { + led_b_status = TURN_OFF; + } + } + res = res << 1; + } + + if(attr->index == 1) + { + sprintf(buf, "%sSYS LED is set to ", buf); + } + else if(attr->index == 2) + { + sprintf(buf, "%sFLOW LED is set to ", buf); + } + else if(attr->index == 3) + { + sprintf(buf, "%sSwitch LED 1 is set to ", buf); + } + else if(attr->index == 4) + { + sprintf(buf, "%sSwitch LED 2 is set to ", buf); + } + + if(led_a_status == TURN_ON && led_b_status == TURN_ON) + { + sprintf(buf, "%samber and blink\n", buf); + } + else if(led_a_status == TURN_ON && led_b_status == TURN_OFF) + { + sprintf(buf, "%samber\n", buf); + } + else if(led_g_status == TURN_ON && led_b_status == TURN_ON) + { + sprintf(buf, "%sgreen and blink\n", buf); + } + else if(led_g_status == TURN_ON && led_b_status == TURN_OFF) + { + sprintf(buf, "%sgreen\n", buf); + } + else + { + sprintf(buf, "%sOFF\n", buf); + } + return sprintf(buf, "%s", buf); +} +static ssize_t sys_led_ctrl_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 led_value = -EPERM; + u8 blk_value = -EPERM; + u8 result = -EPERM; + u8 offset = 0; + u16 i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *data = i2c_get_clientdata(ESQC_610_i2c_client); + + mutex_lock(&data->update_lock); + debug_print((KERN_DEBUG "DEBUG : sys_led_ctrl_set lock\n")); + led_value = i2c_smbus_read_byte_data(ESQC_610_i2c_client, 0xa2); + debug_print((KERN_DEBUG "DEBUG : sys_led_ctrl_set led_value = %x\n",led_value)); + blk_value = i2c_smbus_read_byte_data(ESQC_610_i2c_client, 0xa3); + debug_print((KERN_DEBUG "DEBUG : sys_led_ctrl_set blk_value = %x\n",blk_value)); + if (attr->index != 0) + { + i = simple_strtol(buf, NULL, 10); + debug_print((KERN_DEBUG "DEBUG : sys_led_ctrl_set value = %d\n",i)); + debug_print((KERN_DEBUG "DEBUG : sys_led_ctrl_set led attr->index = %d\n",attr->index)); + if(attr->index == 1) + { + offset = 0; + } + else + { + offset = 2*((attr->index)-1); + } + switch(i) + { + case SWITCH_LED_OFF: //i=0 + led_value &= ~(0x03 << offset); + blk_value &= ~(1 << ((attr->index)-1)); + break; + case SWITCH_LED_A_N: //i=1 + led_value &= ~(0x03 << offset); + led_value |= (0x01 << offset); + blk_value &= ~(1 << ((attr->index)-1)); + break; + case SWITCH_LED_A_B: //i=2 + led_value &= ~(0x03 << offset); + led_value |= (0x01 << offset); + blk_value |= (1 << ((attr->index)-1)); + break; + case SWITCH_LED_G_N: //i=3 + led_value &= ~(0x03 << offset); + led_value |= (0x02 << offset); + blk_value &= ~(1 << ((attr->index)-1)); + break; + case SWITCH_LED_G_B: //i=4 + led_value &= ~(0x03 << offset); + led_value |= (0x02 << offset); + blk_value |= (1 << ((attr->index)-1)); + break; + default: + printk(KERN_ALERT "Switch LED set wrong Value\n"); + } + debug_print((KERN_DEBUG "DEBUG : sys_led_ctrl_set led_value = %x\n",led_value)); + debug_print((KERN_DEBUG "DEBUG : sys_led_ctrl_set blk_value = %x\n",blk_value)); + result = i2c_smbus_write_byte_data(ESQC_610_i2c_client, 0xa2, led_value); + result |= i2c_smbus_write_byte_data(ESQC_610_i2c_client, 0xa3, blk_value); + debug_print((KERN_DEBUG "DEBUG : sys_led_ctrl_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: sys_led_ctrl_set SYS_LED_OFF FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "Switch LED is set Success\n")); + } + } + mutex_unlock(&data->update_lock); + debug_print((KERN_DEBUG "DEBUG : sys_led_ctrl_set unlock\n")); + return count; +} + +static ssize_t reset_mac_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 status = 0; + u8 value = 0; + u8 result = 0; + u16 i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *data = i2c_get_clientdata(ESQC_610_i2c_client); + + mutex_lock(&data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_lock\n")); + status = i2c_smbus_read_byte_data(ESQC_610_i2c_client, 0xa1); + debug_print((KERN_DEBUG "DEBUG : RESET_MAC status = %x\n",status)); + if (attr->index == RESET_MAC) + { + i = simple_strtol(buf, NULL, 10); + if (i == 0) + { + value = 0x0; + debug_print((KERN_DEBUG "DEBUG : RESET_MAC value = %x\n",value)); + result = i2c_smbus_write_byte_data(ESQC_610_i2c_client, 0xa1, value); + debug_print((KERN_DEBUG "DEBUG : RESET_MAC result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: RESET_MAC set FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "Switch MAC chip is reset\n")); + } + } + else + { + printk(KERN_ALERT "RESET_MAC set wrong Value\n"); + } + } + mutex_unlock(&data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_unlock\n")); + return count; +} + +static ssize_t shutdown_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 status = 0; + u8 value = 0; + u8 result = 0; + u16 i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *data = i2c_get_clientdata(ESQC_610_i2c_client); + + mutex_lock(&data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_lock\n")); + status = i2c_smbus_read_byte_data(ESQC_610_i2c_client, 0xa1); + debug_print((KERN_DEBUG "DEBUG : shutdown_set status = %x\n",status)); + if (attr->index == SHUTDOWN_DUT) + { + i = simple_strtol(buf, NULL, 10); + if (i == 1) + { + value = status & 0xef; + debug_print((KERN_DEBUG "DEBUG : shutdown_set value = %x\n",value)); + result = i2c_smbus_write_byte_data(ESQC_610_i2c_client, 0xa1, value); + debug_print((KERN_DEBUG "DEBUG : shutdown_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: shutdown_set set FAILED!\n"); + } + else + { + debug_print((KERN_DEBUG "Switch is shutdown\n")); + } + } + else + { + printk(KERN_ALERT "shutdown_set set wrong Value\n"); + } + } + mutex_unlock(&data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_unlock\n")); + return count; +} + +static ssize_t themal_status_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 res = 0x1; + int i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + status = i2c_smbus_read_byte_data(ESQC_610_i2c_client, 0xc0); + debug_print((KERN_DEBUG "DEBUG : SENSOR_STATUS status = %x\n",status)); + sprintf(buf, ""); + if (attr->index == SENSOR_STATUS) + { + for (i = 1; i <= 4; i++) + { + if (status & res) + { + sprintf(buf, "%sSensor %d is OK\n", buf, i); + } + else + { + sprintf(buf, "%sSensor %d is NG\n", buf, i); + } + res = res << 1; + } + } + return sprintf(buf, "%s\n", buf); +} + +#ifdef THEMAL_WANTED +static ssize_t themal_temp_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 channel_status = -EPERM; + int i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *Switch_2_data = i2c_get_clientdata(Cameo_Switch_2_client); + struct Cameo_i2c_data *Sensor_data = i2c_get_clientdata(Cameo_Sensor_client); + + i = attr->index; + debug_print((KERN_DEBUG "DEBUG : themal_temp_get %d\n", i)); + mutex_lock(&Switch_2_data->update_lock); + mutex_lock(&Sensor_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : themal_temp_get mutex_lock\n")); + sprintf(buf, ""); + if (attr->index == SENSOR_TEMP) + { + channel_status = i2c_smbus_write_byte(Cameo_Switch_2_client, 0x02); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: themal_temp_get set channel 2 FAILED\n"); + } + status = i2c_smbus_read_byte_data(Cameo_Sensor_client, 0X0); + debug_print((KERN_DEBUG "DEBUG : Sensor 1 status = %x\n",status)); + if(status & 0x80) + { + sprintf(buf, "%sSensor 1 temp is -%d degrees (C)\n", buf, read_8bit_temp((status & 0x80),status)); + } + else + { + sprintf(buf, "%sSensor 1 temp is %d degrees (C)\n", buf, read_8bit_temp((status & 0x80),status)); + } + + channel_status = i2c_smbus_write_byte(Cameo_Switch_2_client, 0x04); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: themal_temp_get set channel 3 FAILED\n"); + } + status = i2c_smbus_read_byte_data(Cameo_Sensor_client, 0X0); + debug_print((KERN_DEBUG "DEBUG : Sensor 2 status = %x\n",status)); + if(status & 0x80) + { + sprintf(buf, "%sSensor 2 temp is -%d degrees (C)\n", buf, read_8bit_temp((status & 0x80),status)); + } + else + { + sprintf(buf, "%sSensor 2 temp is %d degrees (C)\n", buf, read_8bit_temp((status & 0x80),status)); + } + + channel_status = i2c_smbus_write_byte(Cameo_Switch_2_client, 0x08); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: themal_temp_get set channel 4 FAILED\n"); + } + status = i2c_smbus_read_byte_data(Cameo_Sensor_client, 0X0); + debug_print((KERN_DEBUG "DEBUG : Sensor 3 status = %x\n",status)); + if(status & 0x80) + { + sprintf(buf, "%sSensor 3 temp is -%d degrees (C)\n", buf, read_8bit_temp((status & 0x80),status)); + } + else + { + sprintf(buf, "%sSensor 3 temp is %d degrees (C)\n", buf, read_8bit_temp((status & 0x80),status)); + } + + channel_status = i2c_smbus_write_byte(Cameo_Switch_2_client, 0x01); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: themal_temp_get set channel 1 FAILED\n"); + } + status = i2c_smbus_read_byte_data(Cameo_Sensor_fan_client, 0X1); + debug_print((KERN_DEBUG "DEBUG : Sensor 4 status = %x\n",status)); + if(status & 0x80) + { + sprintf(buf, "%sSensor 4 temp is -%d degrees (C)\n", buf, read_8bit_temp((status & 0x80),status)); + } + else + { + sprintf(buf, "%sSensor 4 temp is %d degrees (C)\n", buf, read_8bit_temp((status & 0x80),status)); + } + } + channel_status = i2c_smbus_write_byte(Cameo_Switch_2_client, 0x0); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: themal_temp_get reset channel FAILED\n"); + } + mutex_unlock(&Switch_2_data->update_lock); + mutex_unlock(&Sensor_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_unlock\n")); + return sprintf(buf, "%s\n", buf); +} + +#endif + +static ssize_t themal_mask_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 res = 0x1; + int i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + status = i2c_smbus_read_byte_data(ESQC_610_i2c_client, 0xc1); + debug_print((KERN_DEBUG "DEBUG : SENSOR_INT_MASK status = %x\n",status)); + sprintf(buf, ""); + if (attr->index == SENSOR_INT_MASK) + { + for (i = 1; i <= 4; i++) + { + if (status & res) + { + sprintf(buf, "%sSensor %d interrupt is enabled\n", buf, i); + } + else + { + sprintf(buf, "%sSensor %d interrupt is disabled\n", buf, i); + } + res = res << 1; + } + } + return sprintf(buf, "%s\n", buf); +} + +static ssize_t themal_mask_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 status = -EPERM; + u8 value = -EPERM; + u8 result = -EPERM; + u8 res = 0x1; + u16 i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *data = i2c_get_clientdata(ESQC_610_i2c_client); + + mutex_lock(&data->update_lock); + debug_print((KERN_DEBUG "DEBUG : themal_mask_set mutex_lock\n")); + i = simple_strtol(buf, NULL, 10); + debug_print((KERN_DEBUG "DEBUG : themal_mask_set input %d\n", i)); + status = i2c_smbus_read_byte_data(ESQC_610_i2c_client, 0xc1); + debug_print((KERN_DEBUG "DEBUG : themal_mask_set status = %x\n",status)); + if (attr->index == 1) + { + if (i == TURN_ON) + { + value = status | res; + + } + else if (i == TURN_OFF) + { + value = status & (~res); + } + else + { + printk(KERN_ALERT "themal_mask_set set wrong value\n"); + } + } + else if (attr->index == 2) + { + res = res << 1; + if (i == TURN_ON) + { + value = status | res; + + } + else if (i == TURN_OFF) + { + value = status & (~res); + } + else + { + printk(KERN_ALERT "themal_mask_set set wrong value\n"); + } + } + else if (attr->index == 3) + { + res = res << 2; + if (i == TURN_ON) + { + value = status | res; + + } + else if (i == TURN_OFF) + { + value = status & (~res); + } + else + { + printk(KERN_ALERT "themal_mask_set set wrong value\n"); + } + } + else if (attr->index == 4) + { + res = res << 3; + if (i == TURN_ON) + { + value = status | res; + + } + else if (i == TURN_OFF) + { + value = status & (~res); + } + else + { + printk(KERN_ALERT "themal_mask_set set wrong value\n"); + } + } + debug_print((KERN_DEBUG "DEBUG : themal_mask_set %d value = %x\n", attr->index, value)); + result = i2c_smbus_write_byte_data(ESQC_610_i2c_client, 0xc1, value); + debug_print((KERN_DEBUG "DEBUG : themal_mask_set %d result = %x\n", attr->index,result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: themal_mask_set %d FAILED!\n", attr->index); + } + else + { + debug_print((KERN_DEBUG "themal_mask_set %d : %x\n", attr->index, value)); + } + mutex_unlock(&data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_unlock\n")); + return count; +} + +static ssize_t int_status_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 res = 0x1; + int i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + res = 0x1; + status = i2c_smbus_read_byte_data(ESQC_610_i2c_client, 0xd0); + debug_print((KERN_DEBUG "DEBUG : INT_STATUS status = %x\n",status)); + sprintf(buf, ""); + if (attr->index == INT_STATUS) + { + for (i = 1; i <= 7; i++) + { + if ( i == PCIE_INT) + { + if (!(status & res)) + { + sprintf(buf, "%sInterrupt is triggered by PCIe\n", buf); + } + } + else if( i == QSFP_1_INT) + { + if (!(status & res)) + { + sprintf(buf, "%sInterrupt is triggered by QSFP\n", buf); + } + } + else if( i == QSFP_2_INT) + { + if (!(status & res)) + { + sprintf(buf, "%sInterrupt is triggered by QSFP\n", buf); + } + } + else if( i == FAN_INT) + { + if (!(status & res)) + { + sprintf(buf, "%sInterrupt is triggered by FAN\n", buf); + } + } + else if( i == PSU_INT) + { + if (!(status & res)) + { + sprintf(buf, "%sInterrupt is triggered by PSU\n", buf); + } + } + else if( i == SENSOR_INT) + { + if (!(status & res)) + { + sprintf(buf, "%sInterrupt is triggered by Sensor\n", buf); + } + } + else if( i == USB_INT) + { + if (!(status & res)) + { + sprintf(buf, "%sInterrupt is triggered by USB\n", buf); + } + } + res = res << 1; + } + if(status == 0xf) + { + sprintf(buf, "%sNo interrupt is triggered\n", buf); + } + } + return sprintf(buf, "%s\n", buf); +} + +static ssize_t sfp_status_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 present_reg[7] = {0x00, 0x80, 0x81, 0x82, 0x83, 0x80, 0x81}; //CPLD present register + u8 rx_loss_reg[7] = {0x00, 0x90, 0x91, 0x92, 0x93, 0x90, 0x91}; //CPLD present register + u8 tx_ctrl_reg[7] = {0x00, 0x70, 0x71, 0x72, 0x73, 0x70, 0x71}; //CPLD present register + u8 mask = 0x1; + u8 port_num; + u8 i,j; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + if (attr->index == SFP_PRESENT) + { + sprintf(buf, ""); + port_num = 1; + for (i = 1; i <= 6; i++) + { + if(i <= 4) //for 1~32 port read 0x31 CPLD + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_2_client, present_reg[i]); + } + else + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, present_reg[i]); + } + debug_print((KERN_DEBUG "DEBUG : SFP_PRESENT status = %x\n",status)); + for (j = 1; j <= 8; j++) + { + if (status & mask) + { + sprintf(buf, "%sSFP %02d is not present\n", buf, port_num); + } + else + { + sprintf(buf, "%sSFP %02d is present\n", buf, port_num); + } + port_num++; + mask = mask << 1; + } + mask = 0x1; + } + } + else if (attr->index == SFP_RX_LOSS) + { + sprintf(buf, ""); + port_num = 1; + for (i = 1; i <= 6; i++) + { + if(i <= 4) //for 1~32 port read 0x31 CPLD + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_2_client, rx_loss_reg[i]); + } + else + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, rx_loss_reg[i]); + } + debug_print((KERN_DEBUG "DEBUG : SFP_PRESENT status = %x\n",status)); + for (j = 1; j <= 8; j++) + { + if (status & mask) + { + sprintf(buf, "%sSFP %02d loss of signal\n", buf, port_num); + } + else + { + sprintf(buf, "%sSFP %02d signal detected\n", buf, port_num); + } + port_num++; + mask = mask << 1; + } + mask = 0x1; + } + } + else if (attr->index == SFP_TX_STAT) + { + sprintf(buf, ""); + port_num = 1; + for (i = 1; i <= 6; i++) + { + if(i <= 4) //for 1~32 port read 0x31 CPLD + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_2_client, tx_ctrl_reg[i]); + } + else + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, tx_ctrl_reg[i]); + } + debug_print((KERN_DEBUG "DEBUG : SFP_PRESENT status = %x\n",status)); + for (j = 1; j <= 8; j++) + { + if (status & mask) + { + sprintf(buf, "%sSFP %02d Disable TX\n", buf, port_num); + } + else + { + sprintf(buf, "%sSFP %02d Enable TX\n", buf, port_num); + } + port_num++; + mask = mask << 1; + } + mask = 0x1; + } + } + return sprintf(buf, "%s\n", buf); +} + +static ssize_t sfp_tx_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 status = -EPERM; + u8 result = -EPERM; + u8 input = 0; + u8 port_num = 0; + u8 offset = 0; + u8 reg = 0x0; + u8 tx_ctrl_reg[7] = {0x00, 0x70, 0x71, 0x72, 0x73, 0x70, 0x71}; //CPLD present register + + struct i2c_client *target_client = NULL; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *CPLD_2_data = i2c_get_clientdata(Cameo_CPLD_2_client); + struct Cameo_i2c_data *CPLD_3_data = i2c_get_clientdata(Cameo_CPLD_3_client); + + input = simple_strtol(buf, NULL, 10); //user input, 0 disable, 1 enable + port_num = attr->index; + if (port_num >= 1 && port_num <= 8) + { + target_client = Cameo_CPLD_2_client; + reg = tx_ctrl_reg[1]; + offset = port_num; + } + else if(port_num >= 9 && port_num <= 16) + { + target_client = Cameo_CPLD_2_client; + reg = tx_ctrl_reg[2]; + offset = port_num % 8; + } + else if(port_num >= 17 && port_num <= 24) + { + target_client = Cameo_CPLD_2_client; + reg = tx_ctrl_reg[3]; + offset = port_num % 8; + } + else if(port_num >= 25 && port_num <= 32) + { + target_client = Cameo_CPLD_2_client; + reg = tx_ctrl_reg[4]; + offset = port_num % 8; + } + else if(port_num >= 33 && port_num <= 40) + { + target_client = Cameo_CPLD_3_client; + reg = tx_ctrl_reg[5]; + offset = port_num % 8; + } + else if(port_num >= 41 && port_num <= 48) + { + target_client = Cameo_CPLD_3_client; + reg = tx_ctrl_reg[6]; + offset = port_num % 8; + } + else + { + printk(KERN_ALERT "sfp_tx_set wrong value\n"); + return count; + } + + status = i2c_smbus_read_byte_data(target_client, reg); + debug_print((KERN_DEBUG "DEBUG : sfp_tx_set status = %x\n",status)); + if(input == TURN_ON) + { + status &= ~(1 << (offset-1)); + } + else if(input == TURN_OFF) + { + status |= (1 << (offset-1)); + } + else + { + printk(KERN_ALERT "sfp_tx_set set wrong value\n"); + return count; + } + debug_print((KERN_DEBUG "DEBUG : sfp_tx_set value = %x\n",status)); + mutex_lock(&CPLD_2_data->update_lock); + mutex_lock(&CPLD_3_data->update_lock); + result = i2c_smbus_write_byte_data(target_client, reg, status); + mutex_unlock(&CPLD_2_data->update_lock); + mutex_unlock(&CPLD_3_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : sfp_tx_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: sfp_tx_set sfp %d FAILED!\n", port_num); + } + else + { + debug_print((KERN_DEBUG "sfp_tx_set port %02d : %d\n", port_num, input)); + } + return count; +} + +static ssize_t low_power_all_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; //Low power mode 01-08 port stat + + u8 res = 0x1; + int i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + + status = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0x62); //CPLD 0x32 0x62 + debug_print((KERN_DEBUG "DEBUG : low_power_all_get status = %x\n",status)); + + sprintf(buf, ""); + if (attr->index == QSFP_LOW_POWER_ALL) + { + for (i = 1; i <= 8; i++) + { + if (status & res) + { + sprintf(buf, "%sQSFP %02d low power mode: ON\n", buf, i); + } + else + { + sprintf(buf, "%sQSFP %02d low power mode: OFF\n", buf, i); + } + res = res << 1; + } + res = 0x1; + } + return sprintf(buf, "%s\n", buf); +} +static ssize_t low_power_all_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 value = 0x0; + u8 status = -EPERM; //Low power mode 01-08 port stat + u8 result = -EPERM; + u8 j = 0; + u16 i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *CPLD_3_data = i2c_get_clientdata(Cameo_CPLD_3_client); + + if (attr->index == QSFP_LOW_POWER_ALL) + { + i = simple_strtol(buf, NULL, 10); + status = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0x62); + debug_print((KERN_DEBUG "DEBUG : low_power_all_set status = %x\n",status)); + mutex_lock(&CPLD_3_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : low_power_all_set mutex_lock\n")); + if (i == TURN_ON) + { + value = 0xf; + debug_print((KERN_DEBUG "DEBUG : QSFP_LOW_POWER_ALL value = %x\n",value)); + result = i2c_smbus_write_byte_data(Cameo_CPLD_3_client, 0x62, value); + debug_print((KERN_DEBUG "DEBUG : QSFP_LOW_POWER_ALL result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: QSFP_LOW_POWER_ALL set ON FAILED!\n"); + } + else + { + for(j=1; j<=8; j++) + { + debug_print((KERN_DEBUG "QSFP %02d low power mode: ON\n", j)); + } + } + } + else if(i == TURN_OFF) + { + value = 0x0; + debug_print((KERN_DEBUG "DEBUG : QSFP_LOW_POWER_ALL value = %x\n",value)); + result = i2c_smbus_write_byte_data(Cameo_CPLD_3_client, 0x62, value); + debug_print((KERN_DEBUG "DEBUG : QSFP_LOW_POWER_ALL result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: QSFP_LOW_POWER_ALL set OFF FAILED!\n"); + } + else + { + for(j=1; j<=8; j++) + { + debug_print((KERN_DEBUG "QSFP %02d low power mode: OFF\n", j)); + } + } + } + else + { + printk(KERN_ALERT "QSFP_LOW_POWER_ALL set wrong value\n"); + } + mutex_unlock(&CPLD_3_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_unlock\n")); + } + return count; +} + +static ssize_t low_power_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; //Low power mode 01-08 port stat + u8 res = 0x1; + int i, j = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + i = attr->index; + sprintf(buf, ""); + debug_print((KERN_DEBUG "DEBUG : low_power_get port %d\n", i)); + + if (i >= 1 && i <= 8) + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0x62); + debug_print((KERN_DEBUG "DEBUG : low_power_get status = %x\n", status)); + for (j = 1; j <= 8; j++) + { + if (j == i) + { + if (status & res) + { + sprintf(buf, "%sQSFP %02d low power mode: ON\n", buf, i); + } + else + { + sprintf(buf, "%sQSFP %02d low power mode: OFF\n", buf, i); + } + } + res = res << 1; + } + } + else + { + printk(KERN_ALERT "low_power_get get %02d wrong value\n", i); + } + return sprintf(buf, "%s\n", buf); +} + +static ssize_t low_power_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 status = 0; + u8 result = 0; + int i = 0; + int j = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *CPLD_3_data = i2c_get_clientdata(Cameo_CPLD_3_client); + + i = attr->index; + j = simple_strtol(buf, NULL, 10); + debug_print((KERN_DEBUG "DEBUG : low_power_set port %d\n", i)); + mutex_lock(&CPLD_3_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : low_power_set mutex_lock\n")); + if (i >= 1 && i <= 8) + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0x62); + debug_print((KERN_DEBUG "DEBUG : low_power_set status = %x\n",status)); + if( j == TURN_ON) + { + status |= (1 << (i-1)); + debug_print((KERN_DEBUG "DEBUG : low_power_set value = %x\n",status)); + result = i2c_smbus_write_byte_data(Cameo_CPLD_3_client, 0x62, status); + debug_print((KERN_DEBUG "DEBUG : low_power_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: low_power_set qsfp %d ON FAILED!\n", i); + } + else + { + debug_print((KERN_DEBUG "QSFP %02d low power mode: ON\n", i)); + } + } + else if( j == TURN_OFF) + { + status &= ~(1 << (i-1)); + debug_print((KERN_DEBUG "DEBUG : low_power_set value = %x\n",status)); + result = i2c_smbus_write_byte_data(Cameo_CPLD_3_client, 0x62, status); + debug_print((KERN_DEBUG "DEBUG : low_power_set result = %x\n",result)); + if (result < 0) + { + printk(KERN_ALERT "ERROR: low_power_set qsfp %d OFF FAILED!\n", i); + } + else + { + debug_print((KERN_DEBUG "QSFP %02d low power mode: OFF\n", i)); + } + } + else + { + printk(KERN_ALERT "QSFP_low_power_%d set wrong value\n", i); + } + } + else + { + printk(KERN_ALERT "low_power_set wrong value\n"); + } + mutex_unlock(&CPLD_3_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_unlock\n")); + return count; +} + +static ssize_t qsfp_reset_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 status = 0; + u8 value = 0; + u16 i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *CPLD_3_data = i2c_get_clientdata(Cameo_CPLD_3_client); + + mutex_lock(&CPLD_3_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : qsfp_reset_set mutex_lock\n")); + if (attr->index == QSFP_RESET) + { + i = simple_strtol(buf, NULL, 10); + if (i >= 1 && i <= 8) + { + value = 0; + value = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0x72); + debug_print((KERN_DEBUG "DEBUG : qsfp_reset_set value = %x\n",value)); + value ^= (1 << (i - 1)); + debug_print((KERN_DEBUG "DEBUG : qsfp_reset_set set value = %x\n",value)); + status = i2c_smbus_write_byte_data(Cameo_CPLD_3_client, 0x72, value); + if (status < 0) + { + printk(KERN_ALERT "ERROR: QSFP_RESET port %02d FAILED!\n", i); + } + else + { + debug_print((KERN_DEBUG "QSFP %02d reset success\n", i)); + } + } + else + { + printk(KERN_ALERT "qsfp_reset_set wrong value\n"); + } + } + mutex_unlock(&CPLD_3_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_unlock\n")); + return count; +} + +static ssize_t qsfp_status_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; //qsfp_status 01-08 port stat + u8 res = 0x1; + u16 i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + if (attr->index == QSFP_PRESENT) + { + sprintf(buf, ""); + status = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0x82); + for (i = 1; i <= 8; i++) + { + if (status & res) + { + sprintf(buf, "%sQSFP %02d is not present\n", buf, i); + } + else + { + sprintf(buf, "%sQSFP %02d is present\n", buf, i); + } + res = res << 1; + } + res = 0x1; + } + if (attr->index == QSFP_INT) + { + sprintf(buf, ""); + status = i2c_smbus_read_byte_data(Cameo_CPLD_3_client, 0x92); + debug_print((KERN_DEBUG "DEBUG : QSFP_INT_1 status = %x\n",status)); + res = 0x1; + for (i = 1; i <= 8; i++) + { + if (status & res) + { + sprintf(buf, "%sQSFP %02d is OK\n", buf, i); + } + else + { + sprintf(buf, "%sQSFP %02d is abnormal\n", buf, i); + } + res = res << 1; + } + res = 0x1; + } + return sprintf(buf, "%s\n", buf); +} + +static ssize_t fan_status_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 res=0x1; + u16 fan_speed; + int i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *target_client = NULL; + + sprintf(buf, ""); + if (attr->index == FAN_STATUS) + { + if(i2c_smbus_read_byte_data(ESQC_610_i2c_client, 0xa4) == 0x1) //check BMC present + { + status = i2c_smbus_read_byte_data(Cameo_BMC_client, 0x80); + } + else + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_4_client, 0x0); + } + debug_print((KERN_DEBUG "DEBUG : FAN_STATUS status = %x\n",status)); + for(i=1; i<=4; i++) + { + if(status & res) + { + sprintf(buf, "%sFan %d is Good\n", buf, i); + } + else + { + sprintf(buf, "%sFan %d is Fail\n", buf, i); + } + res=res<<1; + } + } + else if (attr->index == FAN_PRESENT) + { + if(i2c_smbus_read_byte_data(ESQC_610_i2c_client, 0xa4) == 0x1) //check BMC present + { + status = i2c_smbus_read_byte_data(Cameo_BMC_client, 0x81); + } + else + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_4_client, 0x01); + } + debug_print((KERN_DEBUG "DEBUG : FAN_PRESENT status = %x\n",status)); + for(i=1; i<=4; i++) + { + if(status & res) + { + sprintf(buf, "%sFan %d is present\n", buf, i); + } + else + { + sprintf(buf, "%sFan %d is not present\n", buf, i); + } + res=res<<1; + } + } + else if (attr->index == FAN_POWER) + { + if(i2c_smbus_read_byte_data(ESQC_610_i2c_client, 0xa4) == 0x1) //check BMC present + { + status = i2c_smbus_read_byte_data(Cameo_BMC_client, 0x82); + } + else + { + status = i2c_smbus_read_byte_data(Cameo_CPLD_4_client, 0x02); + } + debug_print((KERN_DEBUG "DEBUG : FAN_POWER status = %x\n",status)); + for(i=1; i<=4; i++) + { + if(status & res) + { + sprintf(buf, "%sFan %d is power Good\n", buf, i); + } + else + { + sprintf(buf, "%sFan %d is not power Good\n", buf, i); + } + res=res<<1; + } + } + else if (attr->index == FAN_SPEED_RPM) + { + res = -EPERM; + if(i2c_smbus_read_byte_data(ESQC_610_i2c_client, 0xa4) == 0x1) //check BMC present + { + target_client = Cameo_BMC_client; + res = i2c_smbus_read_byte_data(Cameo_BMC_client, 0x81); //check Fan present + } + else + { + target_client = Cameo_CPLD_4_client; + res = i2c_smbus_read_byte_data(Cameo_CPLD_4_client, 0x01); //check Fan present + } + + if(res < 0) { + sprintf(buf, "%sCheck fan present error\n", buf); + return sprintf(buf, "%s\n",buf); + } + + // first fan of couple + for(i=0; iupdate_lock); + + sprintf(buf, ""); + if (attr->index == FAN_MODE) + { + channel_status = i2c_smbus_write_byte(Cameo_Switch_2_client, 0x01); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: fan_mode_get set channel 1 FAILED\n"); + } + + status = i2c_smbus_read_byte_data(Cameo_Sensor_fan_client, 0x64); + debug_print((KERN_DEBUG "DEBUG : FAN_MODE get status = %x\n",status)); + + channel_status = i2c_smbus_write_byte(Cameo_Switch_2_client, 0x00); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: fan_mode_get channel reset FAILED\n"); + } + sprintf(buf, "%s0x%x\n", buf, status); + } + mutex_unlock(&Switch_2_data->update_lock); + return sprintf(buf, "%s\n",buf); +} + +static ssize_t fan_mode_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 status = -EPERM; + u8 channel_status = -EPERM; + u16 i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *Switch_2_data = i2c_get_clientdata(Cameo_Switch_2_client); + struct Cameo_i2c_data *Sensor_fan_data = i2c_get_clientdata(Cameo_Sensor_fan_client); + mutex_lock(&Switch_2_data->update_lock); + mutex_lock(&Sensor_fan_data->update_lock); + if (attr->index == FAN_MODE) + { + i = simple_strtol(buf, NULL, 16); + channel_status = i2c_smbus_write_byte(Cameo_Switch_2_client, 0x01); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: fan_mode_get set channel 1 FAILED\n"); + } + + status = i2c_smbus_write_byte_data(Cameo_Sensor_fan_client, 0x64, i); + debug_print((KERN_DEBUG "DEBUG : FAN_MODE set status = %x\n", status)); + + channel_status = i2c_smbus_write_byte(Cameo_Switch_2_client, 0x00); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: fan_mode_get channel reset FAILED\n"); + } + } + mutex_unlock(&Switch_2_data->update_lock); + mutex_unlock(&Sensor_fan_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_unlock\n")); + return count; +} +static ssize_t fan_rpm_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u8 channel_status = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *Switch_2_data = i2c_get_clientdata(Cameo_Switch_2_client); + mutex_lock(&Switch_2_data->update_lock); + + sprintf(buf, ""); + if (attr->index == FAN_RPM) + { + channel_status = i2c_smbus_write_byte(Cameo_Switch_2_client, 0x01); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: fan_rpm_get set channel 1 FAILED\n"); + } + + status = i2c_smbus_read_byte_data(Cameo_Sensor_fan_client, 0x60); + debug_print((KERN_DEBUG "DEBUG : FAN_RPM status = %x\n",status)); + + channel_status = i2c_smbus_write_byte(Cameo_Switch_2_client, 0x00); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: fan_rpm_get channel reset FAILED\n"); + } + sprintf(buf, "%s0x%x\n", buf, status); + } + mutex_unlock(&Switch_2_data->update_lock); + return sprintf(buf, "%s\n",buf); +} + +static ssize_t fan_rpm_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + u8 status = -EPERM; + u8 channel_status = -EPERM; + u16 i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Cameo_i2c_data *Switch_2_data = i2c_get_clientdata(Cameo_Switch_2_client); + struct Cameo_i2c_data *Sensor_fan_data = i2c_get_clientdata(Cameo_Sensor_fan_client); + mutex_lock(&Switch_2_data->update_lock); + mutex_lock(&Sensor_fan_data->update_lock); + if (attr->index == FAN_RPM) + { + i = simple_strtol(buf, NULL, 16); + channel_status = i2c_smbus_write_byte(Cameo_Switch_2_client, 0x01); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: fan_mode_get set channel 1 FAILED\n"); + } + + status = i2c_smbus_write_byte_data(Cameo_Sensor_fan_client, 0x60, i); + debug_print((KERN_DEBUG "DEBUG : FAN_RPM set status = %x\n", status)); + + channel_status = i2c_smbus_write_byte(Cameo_Switch_2_client, 0x00); + if(channel_status < 0) + { + printk(KERN_ALERT "ERROR: fan_mode_get channel reset FAILED\n"); + } + } + mutex_unlock(&Switch_2_data->update_lock); + mutex_unlock(&Sensor_fan_data->update_lock); + debug_print((KERN_DEBUG "DEBUG : mutex_unlock\n")); + return count; +} +#endif + +#ifdef ASPEED_BMC_WANTED +static ssize_t bmc_register_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u32 reg = -EPERM; + u32 status = -EPERM; + u8 len = -EPERM; + u8 idex =0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + sprintf(buf, ""); + switch (attr->index) + { + case BMC_SERSOR_1: + reg = 0x10; + len = 1; + idex = 1; + break; + case BMC_SERSOR_2: + reg = 0x20; + len = 1; + idex = 2; + break; + case BMC_SERSOR_3: + reg = 0x30; + len = 1; + idex = 3; + break; + case BMC_SERSOR_4: + reg = 0x40; + len = 1; + idex = 4; + break; + } + if(len == 1) + { + status = i2c_smbus_read_byte_data(Cameo_BMC_client, reg); + debug_print((KERN_DEBUG "DEBUG : BMC byte status = 0x%x\n", status)); + } + else if (len == 2) + { + status = i2c_smbus_read_word_data(Cameo_BMC_client, reg); + debug_print((KERN_DEBUG "DEBUG : BMC word status = 0x%x\n", status)); + } + if(status == 0xfffffffa || status == 0xff || status == 0xffff) + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + else + { + + if(len == 1) + sprintf(buf, "%sSensor %d temp is %s%d degrees (C)\n", buf, idex,(status & 0x80)!=0 ? "-":"",read_8bit_temp((status & 0x80),status)); + else + sprintf(buf, "%s0x%x\n", buf, ((status&0xff)<<8)|((status&0xFF00)>>8)); + } + return sprintf(buf, "%s\n", buf); +} +static ssize_t bmc_module_detect(struct device *dev, struct device_attribute *da, char *buf) +{ + u32 status = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + sprintf(buf, ""); + if(attr->index == BMC_DETECT) + { + status = i2c_smbus_read_byte_data(ESQC_610_i2c_client, 0xa4); + debug_print((KERN_DEBUG "DEBUG : BMC byte status = 0x%x\n", status)); + } + if(status == 0x1) + { + sprintf(buf, "%sBMC module is present\n", buf); + } + else + { + sprintf(buf, "%sBMC module is not present\n", buf); + } + return sprintf(buf, "%s\n", buf); +} +#endif /*ASPEED_BMC_WANTED*/ + +#ifdef WDT_CTRL_WANTED +static ssize_t wdt_status_get(struct device *dev, struct device_attribute *da, char *buf) +{ + sprintf(buf, ""); + return sprintf(buf, "%s\n", buf); +} +static ssize_t wdt_status_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + return count; +} +#endif /*WDT_CTRL_WANTED*/ + +#ifdef EEPROM_WP_WANTED +static ssize_t eeprom_wp_status_get(struct device *dev, struct device_attribute *da, char *buf) +{ + sprintf(buf, ""); + return sprintf(buf, "%s\n", buf); +} +static ssize_t eeprom_wp_status_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + return count; +} +#endif /*EEPROM_WP_WANTED*/ + +static ssize_t hw_version_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u32 status = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + sprintf(buf, ""); + if(attr->index == HW_VER) + { + status = i2c_smbus_read_byte_data(ESQC_610_i2c_client, 0x20); + } + sprintf(buf, "%sHW version is 0x%x\n", buf, status); + return sprintf(buf, "%s\n", buf); +} + +/* end of function */ + +static int Cameo_i2c_probe(struct i2c_client *client, const struct i2c_device_id *dev_id) +{ + struct Cameo_i2c_data *data; + struct Cameo_i2c_data *CPLD_2_data; + struct Cameo_i2c_data *CPLD_3_data; + struct Cameo_i2c_data *CPLD_4_data; + struct Cameo_i2c_data *CPLD_5_data; +#ifdef I2C_SWITCH_WANTED + struct Cameo_i2c_data *Switch_1_data; + struct Cameo_i2c_data *Switch_2_data; +#endif +#ifdef THEMAL_WANTED + struct Cameo_i2c_data *Sensor_data; + struct Cameo_i2c_data *Sensor_fan_data; +#endif +#ifdef ASPEED_BMC_WANTED + struct Cameo_i2c_data *Cameo_BMC_data; +#endif + int status; + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA)) + { + status = -EIO; + goto exit; + } + data = kzalloc(sizeof(struct Cameo_i2c_data), GFP_KERNEL); + if (!data) + { + printk(KERN_ALERT "kzalloc fail\n"); + status = -ENOMEM; + goto exit; + } + CPLD_2_data = kzalloc(sizeof(struct Cameo_i2c_data), GFP_KERNEL); + if (!CPLD_2_data) + { + printk(KERN_ALERT "kzalloc fail\n"); + status = -ENOMEM; + goto exit; + } + CPLD_3_data = kzalloc(sizeof(struct Cameo_i2c_data), GFP_KERNEL); + if (!CPLD_3_data) + { + printk(KERN_ALERT "kzalloc fail\n"); + status = -ENOMEM; + goto exit; + } + CPLD_4_data = kzalloc(sizeof(struct Cameo_i2c_data), GFP_KERNEL); + if (!CPLD_4_data) + { + printk(KERN_ALERT "kzalloc fail\n"); + status = -ENOMEM; + goto exit; + } + CPLD_5_data = kzalloc(sizeof(struct Cameo_i2c_data), GFP_KERNEL); + if (!CPLD_5_data) + { + printk(KERN_ALERT "kzalloc fail\n"); + status = -ENOMEM; + goto exit; + } +#ifdef I2C_SWITCH_WANTED + Switch_1_data = kzalloc(sizeof(struct Cameo_i2c_data), GFP_KERNEL); + if (!Switch_1_data) + { + printk(KERN_ALERT "kzalloc fail\n"); + status = -ENOMEM; + goto exit; + } + Switch_2_data = kzalloc(sizeof(struct Cameo_i2c_data), GFP_KERNEL); + if (!Switch_2_data) + { + printk(KERN_ALERT "kzalloc fail\n"); + status = -ENOMEM; + goto exit; + } +#endif +#ifdef THEMAL_WANTED + Sensor_data = kzalloc(sizeof(struct Cameo_i2c_data), GFP_KERNEL); + if (!Sensor_data) + { + printk(KERN_ALERT "kzalloc fail\n"); + status = -ENOMEM; + goto exit; + } + Sensor_fan_data = kzalloc(sizeof(struct Cameo_i2c_data), GFP_KERNEL); + if (!Sensor_fan_data) + { + printk(KERN_ALERT "kzalloc fail\n"); + status = -ENOMEM; + goto exit; + } +#endif +#ifdef ASPEED_BMC_WANTED + Cameo_BMC_data = kzalloc(sizeof(struct Cameo_i2c_data), GFP_KERNEL); + if (!Cameo_BMC_data) + { + printk(KERN_ALERT "kzalloc fail\n"); + status = -ENOMEM; + goto exit; + } +#endif + i2c_set_clientdata(client, data); + i2c_set_clientdata(Cameo_CPLD_2_client, CPLD_2_data); + i2c_set_clientdata(Cameo_CPLD_3_client, CPLD_3_data); + i2c_set_clientdata(Cameo_CPLD_4_client, CPLD_4_data); + i2c_set_clientdata(Cameo_CPLD_5_client, CPLD_5_data); +#ifdef I2C_SWITCH_WANTED + i2c_set_clientdata(Cameo_Switch_1_client, Switch_1_data); + i2c_set_clientdata(Cameo_Switch_2_client, Switch_2_data); +#endif +#ifdef THEMAL_WANTED + i2c_set_clientdata(Cameo_Sensor_client, Sensor_data); + i2c_set_clientdata(Cameo_Sensor_fan_client, Sensor_fan_data); +#endif + mutex_init(&CPLD_2_data->update_lock); + mutex_init(&CPLD_3_data->update_lock); + mutex_init(&CPLD_4_data->update_lock); + mutex_init(&CPLD_5_data->update_lock); +#ifdef I2C_SWITCH_WANTED + mutex_init(&Switch_1_data->update_lock); + mutex_init(&Switch_2_data->update_lock); +#endif +#ifdef THEMAL_WANTED + mutex_init(&Sensor_data->update_lock); + mutex_init(&Sensor_fan_data->update_lock); +#endif +#ifdef ASPEED_BMC_WANTED + mutex_init(&Cameo_BMC_data->update_lock); +#endif + data->valid = 0; + mutex_init(&data->update_lock); + dev_info(&client->dev, "chip found\n"); + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &ESQC610_PSU_group); + if (status) + { + goto exit_free; + } +#ifdef USB_CTRL_WANTED + status = sysfs_create_group(&client->dev.kobj, &ESQC610_USB_group); + if (status) + { + goto exit_free; + } +#endif + status = sysfs_create_group(&client->dev.kobj, &ESQC610_LED_group); + if (status) + { + goto exit_free; + } + status = sysfs_create_group(&client->dev.kobj, &ESQC610_Reset_group); + if (status) + { + goto exit_free; + } + status = sysfs_create_group(&client->dev.kobj, &ESQC610_Sensor_group); + if (status) + { + goto exit_free; + } + status = sysfs_create_group(&client->dev.kobj, &ESQC610_INT_group); + if (status) + { + goto exit_free; + } + status = sysfs_create_group(&client->dev.kobj, &ESQC610_SFP_group); + if (status) + { + goto exit_free; + } + status = sysfs_create_group(&client->dev.kobj, &ESQC610_QSFP_group); + if (status) + { + goto exit_free; + } + status = sysfs_create_group(&client->dev.kobj, &ESQC610_FAN_group); + if (status) + { + goto exit_free; + } +#ifdef ASPEED_BMC_WANTED + status = sysfs_create_group(&client->dev.kobj, &ESQC610_BMC_group); + if (status) + { + goto exit_free; + } +#endif + status = sysfs_create_group(&client->dev.kobj, &ESQC610_SYS_group); + if (status) + { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) + { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + dev_info(&client->dev, "%s: '%s'\n", dev_name(data->hwmon_dev), client->name); + return 0; +exit_remove: + sysfs_remove_group(&client->dev.kobj, &ESQC610_PSU_group); +#ifdef USB_CTRL_WANTED + sysfs_remove_group(&client->dev.kobj, &ESQC610_USB_group); +#endif + sysfs_remove_group(&client->dev.kobj, &ESQC610_LED_group); + sysfs_remove_group(&client->dev.kobj, &ESQC610_Reset_group); + sysfs_remove_group(&client->dev.kobj, &ESQC610_Sensor_group); + sysfs_remove_group(&client->dev.kobj, &ESQC610_INT_group); + sysfs_remove_group(&client->dev.kobj, &ESQC610_SFP_group); + sysfs_remove_group(&client->dev.kobj, &ESQC610_QSFP_group); + sysfs_remove_group(&client->dev.kobj, &ESQC610_FAN_group); +#ifdef ASPEED_BMC_WANTED + sysfs_remove_group(&client->dev.kobj, &ESQC610_BMC_group); +#endif + sysfs_remove_group(&client->dev.kobj, &ESQC610_SYS_group); + +exit_free: + kfree(data); +exit: + return status; +} + +static int Cameo_i2c_remove(struct i2c_client *client) +{ + struct Cameo_i2c_data *data = i2c_get_clientdata(client); + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &ESQC610_PSU_group); +#ifdef USB_CTRL_WANTED + sysfs_remove_group(&client->dev.kobj, &ESQC610_USB_group); +#endif + sysfs_remove_group(&client->dev.kobj, &ESQC610_LED_group); + sysfs_remove_group(&client->dev.kobj, &ESQC610_Reset_group); + sysfs_remove_group(&client->dev.kobj, &ESQC610_Sensor_group); + sysfs_remove_group(&client->dev.kobj, &ESQC610_INT_group); + sysfs_remove_group(&client->dev.kobj, &ESQC610_SFP_group); + sysfs_remove_group(&client->dev.kobj, &ESQC610_QSFP_group); + sysfs_remove_group(&client->dev.kobj, &ESQC610_FAN_group); +#ifdef ASPEED_BMC_WANTED + sysfs_remove_group(&client->dev.kobj, &ESQC610_BMC_group); +#endif + sysfs_remove_group(&client->dev.kobj, &ESQC610_SYS_group); + + kfree(data); + return 0; +} + +static const struct i2c_device_id Cameo_i2c_id[] = +{ + { "ESQC_610_i2c", 0 }, + {}, +}; +MODULE_DEVICE_TABLE(i2c, Cameo_i2c_id); + +static struct i2c_driver Cameo_i2c_driver = +{ + .class = I2C_CLASS_HWMON, + .driver = + { + .name = "ESQC_610_i2c", + }, + .probe = Cameo_i2c_probe, + .remove = Cameo_i2c_remove, + .id_table = Cameo_i2c_id, + .address_list = normal_i2c, +}; + +/*For main Switch board*/ +static struct i2c_board_info ESQC_610_i2c_info[] __initdata = +{ + { + I2C_BOARD_INFO("ESQC_610_i2c", 0x30), + .platform_data = NULL, + }, +}; + +/*For QSFP Port 01 - 16*/ +static struct i2c_board_info Cameo_CPLD_2_info[] __initdata = +{ + { + I2C_BOARD_INFO("Cameo_CPLD_2", 0x31), + .platform_data = NULL, + }, +}; +/*For QSFP Port 17 - 32*/ +static struct i2c_board_info Cameo_CPLD_3_info[] __initdata = +{ + { + I2C_BOARD_INFO("Cameo_CPLD_3", 0x32), + .platform_data = NULL, + }, +}; +/*For Fan status*/ +static struct i2c_board_info Cameo_CPLD_4_info[] __initdata = +{ + { + I2C_BOARD_INFO("Cameo_CPLD_4", 0x23), + .platform_data = NULL, + }, +}; +/*For Power status*/ +static struct i2c_board_info Cameo_CPLD_5_info[] __initdata = +{ + { + I2C_BOARD_INFO("Cameo_CPLD_5", 0x35), + .platform_data = NULL, + }, +}; +#ifdef I2C_SWITCH_WANTED +/*0x73*/ +static struct i2c_board_info Cameo_Switch_1_info[] __initdata = +{ + { + I2C_BOARD_INFO("Cameo_Switch_1", 0x73), + .platform_data = NULL, + }, +}; + +/*0x75*/ +static struct i2c_board_info Cameo_Switch_2_info[] __initdata = +{ + { + I2C_BOARD_INFO("Cameo_Switch_2", 0x75), + .platform_data = NULL, + }, +}; +#endif +#ifdef THEMAL_WANTED +/*0x4c*/ +static struct i2c_board_info Cameo_Sensor_info[] __initdata = +{ + { + I2C_BOARD_INFO("Cameo_Sensor", 0x4c), + .platform_data = NULL, + }, +}; + +/*0x2e*/ +static struct i2c_board_info Cameo_Sensor_fan_info[] __initdata = +{ + { + I2C_BOARD_INFO("Cameo_Sensor_fan", 0x2e), + .platform_data = NULL, + }, +}; +#endif +#ifdef ASPEED_BMC_WANTED +static struct i2c_board_info Cameo_BMC_info[] __initdata = +{ + { + I2C_BOARD_INFO("Cameo_BMC", 0x14), + .platform_data = NULL, + }, +}; +#endif +static int __init Cameo_i2c_init(void) +{ + int ret; + int cmp; + char keyword[] = "SMBus I801"; + char buf1[128]; + struct i2c_adapter *i2c_adap; + struct file *fp; + mm_segment_t fs; + loff_t pos; + + printk("Open file...\n"); + fp = filp_open("/sys/class/i2c-dev/i2c-0/name", O_RDONLY , 0644); + if (IS_ERR(fp)) { + printk("Open file FAILED\n"); + return -1; + } + + fs = get_fs(); + set_fs(KERNEL_DS); + pos = 0; + vfs_read(fp, buf1, sizeof(buf1), &pos); + printk("Detect %s\n", buf1); + cmp = strncmp(keyword, buf1, sizeof(keyword)-1); + set_fs(fs); + + filp_close(fp, NULL); + + if(cmp == 0) + { + i2c_adap = i2c_get_adapter(0); + printk("SMBus I801 is at bus 0\n"); + } + else + { + i2c_adap = i2c_get_adapter(1); + printk("SMBus I801 is at bus 1\n"); + } + + debug_print((KERN_DEBUG "Cameo_i2c_init\n")); + if (i2c_adap == NULL) + { + printk("ERROR: i2c_get_adapter FAILED!\n"); + return -1; + } + ESQC_610_i2c_client = i2c_new_device(i2c_adap, &ESQC_610_i2c_info[0]); + Cameo_CPLD_2_client = i2c_new_device(i2c_adap, &Cameo_CPLD_2_info[0]); + Cameo_CPLD_3_client = i2c_new_device(i2c_adap, &Cameo_CPLD_3_info[0]); + Cameo_CPLD_4_client = i2c_new_device(i2c_adap, &Cameo_CPLD_4_info[0]); + Cameo_CPLD_5_client = i2c_new_device(i2c_adap, &Cameo_CPLD_5_info[0]); +#ifdef I2C_SWITCH_WANTED + Cameo_Switch_1_client = i2c_new_device(i2c_adap, &Cameo_Switch_1_info[0]); + Cameo_Switch_2_client = i2c_new_device(i2c_adap, &Cameo_Switch_2_info[0]); +#endif +#ifdef THEMAL_WANTED + Cameo_Sensor_client = i2c_new_device(i2c_adap, &Cameo_Sensor_info[0]); + Cameo_Sensor_fan_client = i2c_new_device(i2c_adap, &Cameo_Sensor_fan_info[0]); +#endif +#ifdef ASPEED_BMC_WANTED + Cameo_BMC_client = i2c_new_device(i2c_adap, &Cameo_BMC_info[0]); +#endif + + if (ESQC_610_i2c_client == NULL || Cameo_CPLD_2_client == NULL || Cameo_CPLD_3_client == NULL + || Cameo_CPLD_4_client == NULL || Cameo_CPLD_5_client == NULL) + { + printk("ERROR: ESQC_610_i2c_client FAILED!\n"); + return -1; + } +#ifdef I2C_SWITCH_WANTED + if (Cameo_Switch_1_client == NULL || Cameo_Switch_2_client == NULL ) + { + printk("ERROR: Cameo_Switch_client FAILED!\n"); + return -1; + } +#endif +#ifdef THEMAL_WANTED + if (Cameo_Sensor_client == NULL || Cameo_Sensor_fan_client == NULL ) + { + printk("ERROR: Cameo_Sensor_client FAILED!\n"); + return -1; + } +#endif +#ifdef ASPEED_BMC_WANTED + if (Cameo_BMC_client == NULL ) + { + printk("ERROR: Cameo_BMC_client FAILED!\n"); + return -1; + } +#endif + i2c_put_adapter(i2c_adap); + ret = i2c_add_driver(&Cameo_i2c_driver); + printk(KERN_ALERT "ESQC610-56SQ i2c Driver Version: %s\n", DRIVER_VERSION); + printk(KERN_ALERT "ESQC610-56SQ i2c Driver INSTALL SUCCESS\n"); + return ret; +} + +static void __exit Cameo_i2c_exit(void) +{ + i2c_unregister_device(ESQC_610_i2c_client); + i2c_unregister_device(Cameo_CPLD_2_client); + i2c_unregister_device(Cameo_CPLD_3_client); + i2c_unregister_device(Cameo_CPLD_4_client); + i2c_unregister_device(Cameo_CPLD_5_client); +#ifdef I2C_SWITCH_WANTED + i2c_unregister_device(Cameo_Switch_1_client); + i2c_unregister_device(Cameo_Switch_2_client); +#endif +#ifdef THEMAL_WANTED + i2c_unregister_device(Cameo_Sensor_client); + i2c_unregister_device(Cameo_Sensor_fan_client); +#endif +#ifdef ASPEED_BMC_WANTED + i2c_unregister_device(Cameo_BMC_client); +#endif + i2c_del_driver(&Cameo_i2c_driver); + printk(KERN_ALERT "ESQC610-56SQ i2c Driver UNINSTALL SUCCESS\n"); +} + +MODULE_AUTHOR("Cameo Inc."); +MODULE_DESCRIPTION("Cameo ESQC610-56SQ i2c Driver"); +MODULE_LICENSE("GPL"); + +module_init(Cameo_i2c_init); +module_exit(Cameo_i2c_exit); diff --git a/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/modules/x86-64-cameo-esqc610-56sq.h b/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/modules/x86-64-cameo-esqc610-56sq.h new file mode 100644 index 0000000000..e539a411e5 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/modules/x86-64-cameo-esqc610-56sq.h @@ -0,0 +1,591 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRIVER_VERSION "1.4.1" + +#define TURN_OFF 0 +#define TURN_ON 1 +#define GET_USB 2 +#define GET_LOC 3 +#define LOC_OFF 0 +#define LOC_BLINK 1 +#define ALARM_OFF 0 +#define ALARM_AMBER 1 +#define ALARM_GREEN 2 +#define PSU_1_GOOD 3 +#define PSU_2_GOOD 4 +#define PCIE_INT 1 +#define QSFP_1_INT 2 +#define QSFP_2_INT 3 +#define FAN_INT 4 +#define PSU_INT 5 +#define SENSOR_INT 6 +#define USB_INT 7 +#define USB_ON 0x2 +#define USB_OFF 0xfd +#define DIAG_G_ON 0x2 +#define DIAG_G_OFF 0xfd +#define LED_ON 0x1 +#define LED_OFF 0xfe +#define DIAG_A_ON 0x1 +#define DIAG_A_OFF 0xfe +#define LOC_LED_OFF 0x4 +#define LOC_LED_BLINK 0xfb +#define SWITCH_LED_OFF 0 +#define SWITCH_LED_A_N 1 +#define SWITCH_LED_A_B 2 +#define SWITCH_LED_G_N 3 +#define SWITCH_LED_G_B 4 + +#define BMC_PRESENT_OFFSET 0xa4 + +#define SYSFAN_MAX_NUM 4 + +struct i2c_adap { + int nr; + char *name; + const char *funcs; + const char *algo; +}; + +struct i2c_adap *gather_i2c_busses(void); +void free_adapters(struct i2c_adap *adapters); + +/* compiler conditional */ +#define LED_CTRL_WANTED +#define USB_CTRL_WANTED +#define ASPEED_BMC_WANTED +#define PSU_STAT_WANTED +//#define WDT_CTRL_WANTED +//#define EEPROM_WP_WANTED +//#define I2C_SWITCH_WANTED +//#define THEMAL_WANTED +//#define FAN_CTRL_WANTED + +//#define DEBUG_MSG +#ifdef DEBUG_MSG + #define debug_print(s) printk s +#else + #define debug_print(s) +#endif + +/* end of compiler conditional */ + +/* i2c_client Declaration */ +static struct i2c_client *ESQC_610_i2c_client; //0x30 for other device +static struct i2c_client *Cameo_CPLD_2_client; //0x31 for Port 01-32 +static struct i2c_client *Cameo_CPLD_3_client; //0x32 for Port 33-48 QSFP 1-8 +static struct i2c_client *Cameo_CPLD_4_client; //0x23 for Fan Status +static struct i2c_client *Cameo_CPLD_5_client; //0x35 for Power Status +#ifdef I2C_SWITCH_WANTED +static struct i2c_client *Cameo_Switch_1_client; //0x73 +static struct i2c_client *Cameo_Switch_2_client; //0x77 +#endif +#ifdef THEMAL_WANTED +static struct i2c_client *Cameo_Sensor_client; //0x4c themal sensor +static struct i2c_client *Cameo_Sensor_fan_client; //0x2e themal sensor +#endif +#ifdef ASPEED_BMC_WANTED +static struct i2c_client *Cameo_BMC_client; //0x14 ASPEED BMC +#endif +/* end of i2c_client Declaration */ + +/* Function Declaration */ +/* i2c-0 */ +static ssize_t psu_status_get(struct device *dev, struct device_attribute *da, char *buf); +#ifdef PSU_STAT_WANTED +static ssize_t psu_module_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t dc_chip_switch_get(struct device *dev, struct device_attribute *da, char *buf); +#endif +#ifdef USB_CTRL_WANTED +static ssize_t usb_power_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t usb_power_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +#endif +#ifdef LED_CTRL_WANTED +static ssize_t led_ctrl_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t led_ctrl_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +#endif +static ssize_t sys_led_ctrl_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t sys_led_ctrl_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t reset_mac_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t shutdown_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t themal_status_get(struct device *dev, struct device_attribute *da, char *buf); +#ifdef THEMAL_WANTED +static ssize_t themal_temp_get(struct device *dev, struct device_attribute *da, char *buf); +#endif +static ssize_t themal_mask_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t themal_mask_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t int_status_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t sfp_status_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t sfp_tx_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t low_power_all_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t low_power_all_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t low_power_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t low_power_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t qsfp_reset_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t qsfp_status_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t fan_status_get(struct device *dev, struct device_attribute *da, char *buf); +#ifdef FAN_CTRL_WANTED +static ssize_t fan_mode_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t fan_mode_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t fan_rpm_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t fan_rpm_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +#endif +#ifdef ASPEED_BMC_WANTED +static ssize_t bmc_register_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t bmc_module_detect(struct device *dev, struct device_attribute *da, char *buf); +#endif +#ifdef WDT_CTRL_WANTED +static ssize_t wdt_status_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t wdt_status_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +#endif +#ifdef EEPROM_WP_WANTED +static ssize_t eeprom_wp_status_get(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t eeprom_wp_status_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +#endif +static ssize_t hw_version_get(struct device *dev, struct device_attribute *da, char *buf); +/* end of Function Declaration */ + +/* struct i2c_data */ +struct Cameo_i2c_data +{ + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 status; /* Status register read from CPLD */ +}; + +/* struct i2c_sysfs_attributes */ +enum Cameo_i2c_sysfs_attributes +{ + /* i2c-0 */ + /*CPLD 0X30*/ + PSU_PRESENT, + PSU_STATUS, +#ifdef PSU_STAT_WANTED + PSU_MODULE_1, + PSU_MODULE_2, + DC_CHIP_SWITCH, +#endif +#ifdef USB_CTRL_WANTED + USB_POWER, +#endif +#ifdef LED_CTRL_WANTED + LED_CTRL, +#endif + SYS_LED, + FLOW_LED, + SW_LED_1, + SW_LED_2, + RESET_MAC, + SHUTDOWN_DUT, + SENSOR_STATUS, +#ifdef THEMAL_WANTED + SENSOR_TEMP, +#endif + SENSOR_INT_MASK, + INT_STATUS, + /*CPLD 0X31 & 0X32*/ + SFP_PRESENT, + SFP_RX_LOSS, + SFP_TX_STAT, + QSFP_LOW_POWER_ALL, + QSFP_RESET, + QSFP_PRESENT, + QSFP_INT, + FAN_STATUS, + FAN_PRESENT, + FAN_POWER, + FAN_SPEED_RPM, +#ifdef FAN_CTRL_WANTED + FAN_MODE, + FAN_RPM, +#endif +#ifdef ASPEED_BMC_WANTED + BMC_SERSOR_1, + BMC_SERSOR_2, + BMC_SERSOR_3, + BMC_SERSOR_4, + BMC_DETECT, +#endif +#ifdef WDT_CTRL_WANTED + WDT_CTRL, +#endif +#ifdef EEPROM_WP_WANTED + EEPROM_WP_CTRL, +#endif + HW_VER, +}; +/* end of struct i2c_sysfs_attributes */ + +/* sysfs attributes for SENSOR_DEVICE_ATTR */ +/* i2c-0 */ +/*CPLD 0X30*/ +static SENSOR_DEVICE_ATTR(psu_present , S_IRUGO , psu_status_get , NULL , PSU_PRESENT); +static SENSOR_DEVICE_ATTR(psu_status , S_IRUGO , psu_status_get , NULL , PSU_STATUS); +#ifdef PSU_STAT_WANTED +static SENSOR_DEVICE_ATTR(psu_module_1 , S_IRUGO , psu_module_get , NULL , PSU_MODULE_1); +static SENSOR_DEVICE_ATTR(psu_module_2 , S_IRUGO , psu_module_get , NULL , PSU_MODULE_2); +static SENSOR_DEVICE_ATTR(dc_chip_switch , S_IRUGO , dc_chip_switch_get, NULL , DC_CHIP_SWITCH); +#endif +#ifdef USB_CTRL_WANTED +static SENSOR_DEVICE_ATTR(usb_power , S_IRUGO | S_IWUSR , usb_power_get , usb_power_set , USB_POWER); +#endif +#ifdef LED_CTRL_WANTED +static SENSOR_DEVICE_ATTR(led_ctrl , S_IRUGO | S_IWUSR , led_ctrl_get , led_ctrl_set , LED_CTRL); +#endif +static SENSOR_DEVICE_ATTR(led_sys , S_IRUGO | S_IWUSR , sys_led_ctrl_get , sys_led_ctrl_set , SYS_LED); +static SENSOR_DEVICE_ATTR(led_flow , S_IRUGO | S_IWUSR , sys_led_ctrl_get , sys_led_ctrl_set , FLOW_LED); +static SENSOR_DEVICE_ATTR(led_sw1 , S_IRUGO | S_IWUSR , sys_led_ctrl_get , sys_led_ctrl_set , SW_LED_1); +static SENSOR_DEVICE_ATTR(led_sw2 , S_IRUGO | S_IWUSR , sys_led_ctrl_get , sys_led_ctrl_set , SW_LED_2); +static SENSOR_DEVICE_ATTR(reset_mac , S_IRUGO | S_IWUSR , NULL , reset_mac_set , RESET_MAC); +static SENSOR_DEVICE_ATTR(shutdown_set , S_IRUGO | S_IWUSR , NULL , shutdown_set , SHUTDOWN_DUT); +static SENSOR_DEVICE_ATTR(sensor_status , S_IRUGO , themal_status_get , NULL , SENSOR_STATUS); +#ifdef THEMAL_WANTED +static SENSOR_DEVICE_ATTR(sensor_temp , S_IRUGO , themal_temp_get , NULL , SENSOR_TEMP); +#endif +static SENSOR_DEVICE_ATTR(sensor_int_mask , S_IRUGO , themal_mask_get , NULL , SENSOR_INT_MASK); +static SENSOR_DEVICE_ATTR(sensor_int_mask_1 , S_IRUGO | S_IWUSR , NULL , themal_mask_set , 1); +static SENSOR_DEVICE_ATTR(sensor_int_mask_2 , S_IRUGO | S_IWUSR , NULL , themal_mask_set , 2); +static SENSOR_DEVICE_ATTR(sensor_int_mask_3 , S_IRUGO | S_IWUSR , NULL , themal_mask_set , 3); +static SENSOR_DEVICE_ATTR(sensor_int_mask_4 , S_IRUGO | S_IWUSR , NULL , themal_mask_set , 4); +static SENSOR_DEVICE_ATTR(int_status , S_IRUGO , int_status_get , NULL , INT_STATUS); +/*CPLD 0X31 & 0X32*/ +static SENSOR_DEVICE_ATTR(SFP_present , S_IRUGO , sfp_status_get , NULL , SFP_PRESENT); +static SENSOR_DEVICE_ATTR(SFP_rx_loss , S_IRUGO , sfp_status_get , NULL , SFP_RX_LOSS); +static SENSOR_DEVICE_ATTR(SFP_tx_stat , S_IRUGO , sfp_status_get , NULL , SFP_TX_STAT); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_1 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 1); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_2 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 2); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_3 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 3); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_4 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 4); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_5 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 5); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_6 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 6); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_7 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 7); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_8 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 8); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_9 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 9); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_10 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 10); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_11 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 11); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_12 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 12); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_13 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 13); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_14 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 14); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_15 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 15); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_16 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 16); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_17 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 17); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_18 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 18); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_19 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 19); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_20 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 20); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_21 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 21); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_22 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 22); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_23 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 23); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_24 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 24); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_25 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 25); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_26 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 26); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_27 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 27); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_28 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 28); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_29 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 29); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_30 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 30); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_31 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 31); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_32 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 32); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_33 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 33); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_34 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 34); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_35 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 35); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_36 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 36); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_37 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 37); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_38 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 38); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_39 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 39); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_40 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 40); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_41 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 41); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_42 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 42); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_43 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 43); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_44 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 44); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_45 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 45); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_46 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 46); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_47 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 47); +static SENSOR_DEVICE_ATTR(SFP_tx_ctrl_48 , S_IRUGO | S_IWUSR , NULL , sfp_tx_set , 48); +static SENSOR_DEVICE_ATTR(QSFP_low_power_all, S_IRUGO | S_IWUSR , low_power_all_get , low_power_all_set , QSFP_LOW_POWER_ALL); +static SENSOR_DEVICE_ATTR(QSFP_low_power_1 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 1); +static SENSOR_DEVICE_ATTR(QSFP_low_power_2 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 2); +static SENSOR_DEVICE_ATTR(QSFP_low_power_3 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 3); +static SENSOR_DEVICE_ATTR(QSFP_low_power_4 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 4); +static SENSOR_DEVICE_ATTR(QSFP_low_power_5 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 5); +static SENSOR_DEVICE_ATTR(QSFP_low_power_6 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 6); +static SENSOR_DEVICE_ATTR(QSFP_low_power_7 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 7); +static SENSOR_DEVICE_ATTR(QSFP_low_power_8 , S_IRUGO | S_IWUSR , low_power_get , low_power_set , 8); +static SENSOR_DEVICE_ATTR(QSFP_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , QSFP_RESET); +static SENSOR_DEVICE_ATTR(QSFP_present , S_IRUGO , qsfp_status_get , NULL , QSFP_PRESENT); +static SENSOR_DEVICE_ATTR(QSFP_int , S_IRUGO , qsfp_status_get , NULL , QSFP_INT); +static SENSOR_DEVICE_ATTR(fan_status , S_IRUGO , fan_status_get , NULL , FAN_STATUS); +static SENSOR_DEVICE_ATTR(fan_present , S_IRUGO , fan_status_get , NULL , FAN_PRESENT); +static SENSOR_DEVICE_ATTR(fan_power , S_IRUGO , fan_status_get , NULL , FAN_POWER); +static SENSOR_DEVICE_ATTR(fan_speed_rpm , S_IRUGO , fan_status_get , NULL , FAN_SPEED_RPM); +#ifdef FAN_CTRL_WANTED +static SENSOR_DEVICE_ATTR(fan_mode , S_IRUGO | S_IWUSR , fan_mode_get , fan_mode_set , FAN_MODE); +static SENSOR_DEVICE_ATTR(fan_rpm , S_IRUGO | S_IWUSR , fan_rpm_get , fan_rpm_set , FAN_RPM); +#endif +#ifdef ASPEED_BMC_WANTED +static SENSOR_DEVICE_ATTR(bmc_sersor_1 , S_IRUGO , bmc_register_get , NULL , BMC_SERSOR_1); +static SENSOR_DEVICE_ATTR(bmc_sersor_2 , S_IRUGO , bmc_register_get , NULL , BMC_SERSOR_2); +static SENSOR_DEVICE_ATTR(bmc_sersor_3 , S_IRUGO , bmc_register_get , NULL , BMC_SERSOR_3); +static SENSOR_DEVICE_ATTR(bmc_sersor_4 , S_IRUGO , bmc_register_get , NULL , BMC_SERSOR_4); +static SENSOR_DEVICE_ATTR(bmc_present , S_IRUGO , bmc_module_detect , NULL , BMC_DETECT); +#endif +#ifdef WDT_CTRL_WANTED +static SENSOR_DEVICE_ATTR(wdt_ctrl , S_IRUGO | S_IWUSR , wdt_status_get , wdt_status_set , WDT_CTRL); +#endif +static SENSOR_DEVICE_ATTR(hw_version , S_IRUGO , hw_version_get , NULL , HW_VER); +#ifdef EEPROM_WP_WANTED +static SENSOR_DEVICE_ATTR(eeprom_wp_ctrl , S_IRUGO | S_IWUSR , eeprom_wp_status_get , eeprom_wp_status_set , EEPROM_WP_CTRL); +#endif +/* end of sysfs attributes for SENSOR_DEVICE_ATTR */ + +/* sysfs attributes for hwmon */ +/* i2c-0 */ +static struct attribute *ESQC610_SYS_attributes[] = +{ + &sensor_dev_attr_hw_version.dev_attr.attr, +#ifdef WDT_CTRL_WANTED + &sensor_dev_attr_wdt_ctrl.dev_attr.attr, +#endif +#ifdef EEPROM_WP_WANTED + &sensor_dev_attr_eeprom_wp_ctrl.dev_attr.attr, +#endif + NULL +}; + +static struct attribute *ESQC610_PSU_attributes[] = +{ + &sensor_dev_attr_psu_present.dev_attr.attr, + &sensor_dev_attr_psu_status.dev_attr.attr, +#ifdef PSU_STAT_WANTED + &sensor_dev_attr_psu_module_1.dev_attr.attr, + &sensor_dev_attr_psu_module_2.dev_attr.attr, + &sensor_dev_attr_dc_chip_switch.dev_attr.attr, +#endif + NULL +}; +#ifdef USB_CTRL_WANTED +static struct attribute *ESQC610_USB_attributes[] = +{ + &sensor_dev_attr_usb_power.dev_attr.attr, + NULL +}; +#endif +static struct attribute *ESQC610_LED_attributes[] = +{ +#ifdef LED_CTRL_WANTED + &sensor_dev_attr_led_ctrl.dev_attr.attr, +#endif + &sensor_dev_attr_led_sys.dev_attr.attr, + &sensor_dev_attr_led_flow.dev_attr.attr, + &sensor_dev_attr_led_sw1.dev_attr.attr, + &sensor_dev_attr_led_sw2.dev_attr.attr, + NULL +}; + +static struct attribute *ESQC610_Reset_attributes[] = +{ + &sensor_dev_attr_reset_mac.dev_attr.attr, + &sensor_dev_attr_shutdown_set.dev_attr.attr, + NULL +}; + +static struct attribute *ESQC610_Sensor_attributes[] = +{ + &sensor_dev_attr_sensor_status.dev_attr.attr, +#ifdef THEMAL_WANTED + &sensor_dev_attr_sensor_temp.dev_attr.attr, +#endif + NULL +}; + +static struct attribute *ESQC610_INT_attributes[] = +{ + &sensor_dev_attr_int_status.dev_attr.attr, + &sensor_dev_attr_QSFP_int.dev_attr.attr, + &sensor_dev_attr_sensor_int_mask.dev_attr.attr, + &sensor_dev_attr_sensor_int_mask_1.dev_attr.attr, + &sensor_dev_attr_sensor_int_mask_2.dev_attr.attr, + &sensor_dev_attr_sensor_int_mask_3.dev_attr.attr, + &sensor_dev_attr_sensor_int_mask_4.dev_attr.attr, + NULL +}; + +static struct attribute *ESQC610_SFP_attributes[] = +{ + &sensor_dev_attr_SFP_present.dev_attr.attr, + &sensor_dev_attr_SFP_rx_loss.dev_attr.attr, + &sensor_dev_attr_SFP_tx_stat.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_1.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_2.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_3.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_4.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_5.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_6.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_7.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_8.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_9.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_10.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_11.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_12.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_13.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_14.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_15.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_16.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_17.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_18.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_19.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_20.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_21.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_22.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_23.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_24.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_25.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_26.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_27.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_28.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_29.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_30.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_31.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_32.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_33.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_34.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_35.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_36.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_37.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_38.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_39.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_40.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_41.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_42.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_43.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_44.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_45.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_46.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_47.dev_attr.attr, + &sensor_dev_attr_SFP_tx_ctrl_48.dev_attr.attr, + NULL +}; + +static struct attribute *ESQC610_QSFP_attributes[] = +{ + &sensor_dev_attr_QSFP_present.dev_attr.attr, + &sensor_dev_attr_QSFP_reset.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_all.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_1.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_2.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_3.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_4.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_5.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_6.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_7.dev_attr.attr, + &sensor_dev_attr_QSFP_low_power_8.dev_attr.attr, + NULL +}; + +static struct attribute *ESQC610_FAN_attributes[] = { + &sensor_dev_attr_fan_status.dev_attr.attr, + &sensor_dev_attr_fan_present.dev_attr.attr, + &sensor_dev_attr_fan_power.dev_attr.attr, + &sensor_dev_attr_fan_speed_rpm.dev_attr.attr, +#ifdef FAN_CTRL_WANTED + &sensor_dev_attr_fan_mode.dev_attr.attr, + &sensor_dev_attr_fan_rpm.dev_attr.attr, +#endif + NULL +}; + +#ifdef ASPEED_BMC_WANTED +static struct attribute *ESQC610_BMC_attributes[] = { + &sensor_dev_attr_bmc_sersor_1.dev_attr.attr, + &sensor_dev_attr_bmc_sersor_2.dev_attr.attr, + &sensor_dev_attr_bmc_sersor_3.dev_attr.attr, + &sensor_dev_attr_bmc_sersor_4.dev_attr.attr, + &sensor_dev_attr_bmc_present.dev_attr.attr, + NULL +}; +#endif +/* end of sysfs attributes for hwmon */ + +/* struct attribute_group */ +static const struct attribute_group ESQC610_SYS_group = +{ + .name = "ESQC610_SYS", + .attrs = ESQC610_SYS_attributes, +}; + +static const struct attribute_group ESQC610_PSU_group = +{ + .name = "ESQC610_PSU", + .attrs = ESQC610_PSU_attributes, +}; + +#ifdef USB_CTRL_WANTED +static const struct attribute_group ESQC610_USB_group = +{ + .name = "ESQC610_USB", + .attrs = ESQC610_USB_attributes, +}; +#endif + +static const struct attribute_group ESQC610_LED_group = +{ + .name = "ESQC610_LED", + .attrs = ESQC610_LED_attributes, +}; + +static const struct attribute_group ESQC610_Reset_group = +{ + .name = "ESQC610_Reset", + .attrs = ESQC610_Reset_attributes, +}; + +static const struct attribute_group ESQC610_Sensor_group = +{ + .name = "ESQC610_Sensor", + .attrs = ESQC610_Sensor_attributes, +}; + +static const struct attribute_group ESQC610_INT_group = +{ + .name = "ESQC610_INT", + .attrs = ESQC610_INT_attributes, +}; + +static const struct attribute_group ESQC610_SFP_group = +{ + .name = "ESQC610_SFP", + .attrs = ESQC610_SFP_attributes, +}; + +static const struct attribute_group ESQC610_QSFP_group = +{ + .name = "ESQC610_QSFP", + .attrs = ESQC610_QSFP_attributes, +}; + +static const struct attribute_group ESQC610_FAN_group = +{ + .name = "ESQC610_FAN", + .attrs = ESQC610_FAN_attributes, +}; + +#ifdef ASPEED_BMC_WANTED +static const struct attribute_group ESQC610_BMC_group = +{ + .name = "ESQC610_BMC", + .attrs = ESQC610_BMC_attributes, +}; +#endif +/* end of struct attribute_group */ diff --git a/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/modules/zrh2800k2.c b/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/modules/zrh2800k2.c new file mode 100644 index 0000000000..3a8fbb408c --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/modules/zrh2800k2.c @@ -0,0 +1,686 @@ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DEBUG_MSG +#ifdef DEBUG_MSG + #define debug_print(s) printk s +#else + #define debug_print(s) +#endif + +//#define SYMBOL_FOR_LM_SENSOR + +enum power_modules{ zrh2800k2, zrh2ab0k2 }; + +struct zrh2800k2_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u64 last_energy_value_EIN; + u64 last_smaple_count_EIN; + u64 last_energy_value_EOUT; + u64 last_smaple_count_EOUT; +}; + +typedef enum _access_type_{ + READ_BYTE, + READ_WORD, + READ_BLOCK +}ACCESS_TYPE; + +typedef enum _value_format_{ + FORMAT_NORMAL, + FORMAT_DIRECT, + FORMAT_LINEAR +}VALUE_FORMAT; + +typedef enum _zrh2800k2_regs_ { + REG_CAPABILITY = 0x19, + REG_QUERY = 0X1A, + REG_VOUT_MODE = 0x20, + REG_COEFFICIENTS = 0X30, + REG_FAN_CONFIG_1_2 = 0x3A, + REG_STATUS_WORD = 0x79, + REG_STATUS_VOUT = 0x7A, + REG_STATUS_IOUT = 0x7B, + REG_STATUS_INPUT = 0x7C, + REG_STATUS_TEMPERATURE = 0x7D, + REG_STATUS_FANS_1_2 = 0x81, + REG_READ_EIN = 0x86, /* direct data format */ + REG_READ_EOUT = 0x87, /* direct data format */ + REG_READ_VIN = 0x88, + REG_READ_IIN = 0x89, + REG_READ_VOUT = 0x8B, /* linear data format */ + REG_READ_IOUT = 0x8C, /* linear data format */ + REG_READ_TEMPERATURE1 = 0x8D, /* linear data format */ + REG_READ_FAN_SPEED_1 = 0x90, /* linear data format */ + REG_READ_POUT = 0x96, /* linear data format */ + REG_READ_PIN = 0x97, /* linear data format */ + REG_READ_PMBUS_REVISION = 0x98, + REG_READ_MFR_ID = 0x99, /* ZIPPY 5 BYTES */ + REG_READ_MFR_MODEL = 0x9A, + REG_READ_MFR_VIN_MAX = 0xA4, /* linear data format */ + REG_READ_MFR_IOUT_MAX = 0xA6 /* lineat data format */ +}ZRH2800K2_REGS; + +enum zrh2800k2_sysfs_attributes { + PSU_CAPABILITY, /* 0 */ + PSU_QUERY, + PSU_VOUT_MODE, + PSU_COEFFICIENTS, + PSU_FAN_CONFIG_1_2, + PSU_STATUS_WORD, /* 5 */ + PSU_STATUS_VOUT, + PSU_STATUS_IOUT, + PSU_STATUS_INPUT, + PSU_STATUS_TEMPERATURE, + PSU_STATUS_FANS_1_2, /* 10 */ + PSU_EIN, + PSU_EOUT, + PSU_VIN, + PSU_IIN, + PSU_VOUT, /* 15 */ + PSU_IOUT, + PSU_TEMPERATURE_1, + PSU_FAN_SPEED_1, + PSU_POUT, + PSU_PIN, /* 20 */ + PSU_PMBUS_REVISION, + PSU_MFR_ID, + PSU_MFR_MODEL, + PSU_MFR_VIN_MAX, + PSU_MFR_IOUT_MAX +}; + +struct _OPERATION_SET_ { + ZRH2800K2_REGS reg; + ACCESS_TYPE type; + u8 data_size; // unit: byte, only used for block read +}; + +/* the index of operations are mapping to the zrh2800k2_sysfs_attributes */ +static struct _OPERATION_SET_ operation_set[] = { + { REG_CAPABILITY, READ_BYTE, 1 }, // 0 + { REG_QUERY, READ_BYTE, 1}, // 1 + { REG_VOUT_MODE, READ_BYTE, 1 }, // 2 + { REG_COEFFICIENTS, READ_BLOCK, 5 }, // 3 + { REG_FAN_CONFIG_1_2 , READ_BYTE, 1 }, // 4 + { REG_STATUS_WORD, READ_WORD, 2 }, // 5 + { REG_STATUS_VOUT, READ_BYTE, 1 }, // 6 + { REG_STATUS_IOUT, READ_BYTE, 1 }, // 7 + { REG_STATUS_INPUT, READ_BYTE, 1 }, // 8 + { REG_STATUS_TEMPERATURE, READ_BYTE, 1 }, //9 + { REG_STATUS_FANS_1_2, READ_BYTE, 1 }, // 10 + { REG_READ_EIN, READ_BLOCK, 6 }, // 11 + { REG_READ_EOUT, READ_BLOCK, 6 }, // 12 + { REG_READ_VIN, READ_WORD, 2 }, // 13 + { REG_READ_IIN, READ_WORD, 2 }, // 14 + { REG_READ_VOUT, READ_WORD, 2 }, // 15 + { REG_READ_IOUT, READ_WORD, 2 }, // 16 + { REG_READ_TEMPERATURE1, READ_WORD, 2 }, // 17 + { REG_READ_FAN_SPEED_1, READ_WORD, 2 }, // 18 + { REG_READ_POUT, READ_WORD, 2 }, // 19 + { REG_READ_PIN, READ_WORD, 2 }, // 20 + { REG_READ_PMBUS_REVISION, READ_BYTE, 1 }, //21 + { REG_READ_MFR_ID, READ_BLOCK, 5 }, // 22 + { REG_READ_MFR_MODEL, READ_BLOCK, 9 }, // 23 + { REG_READ_MFR_VIN_MAX, READ_WORD, 2 }, // 24 + { REG_READ_MFR_IOUT_MAX, READ_WORD, 2 } // 25 +}; + + +static int zrh2800k2_remove(struct i2c_client *client); +static int zrh2800k2_probe(struct i2c_client *client, const struct i2c_device_id *dev_id); +static ssize_t show_value(struct device *dev, struct device_attribute *da, char *buf); + +static ssize_t show_capability(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t psu_pm_query(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t psu_coefficient(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t set_fan_config(struct device *dev, struct device_attribute *da, const char *buf, size_t count); + + +/* Addresses scanned */ +static const unsigned short normal_i2c[] = { 0x58, 0x59, I2C_CLIENT_END }; + +/* sysfs attributes for hwmon */ +static SENSOR_DEVICE_ATTR(psu_query, S_IRUGO, psu_pm_query, NULL, PSU_QUERY); +static SENSOR_DEVICE_ATTR(psu_coeff, S_IRUGO, psu_coefficient,NULL, PSU_COEFFICIENTS); +static SENSOR_DEVICE_ATTR(psu_fan_config_1_2, S_IRUGO|S_IWUSR, show_value, set_fan_config, PSU_FAN_CONFIG_1_2); +static SENSOR_DEVICE_ATTR(psu_capability, S_IRUGO, show_capability, NULL, PSU_CAPABILITY); +static SENSOR_DEVICE_ATTR(psu_vout_mode, S_IRUGO, show_value, NULL, PSU_VOUT_MODE); +static SENSOR_DEVICE_ATTR(psu_status_word, S_IRUGO, show_value, NULL, PSU_STATUS_WORD); +static SENSOR_DEVICE_ATTR(psu_status_vout, S_IRUGO, show_value, NULL, PSU_STATUS_VOUT); +static SENSOR_DEVICE_ATTR(psu_status_iout, S_IRUGO, show_value, NULL, PSU_STATUS_IOUT); +static SENSOR_DEVICE_ATTR(psu_status_input, S_IRUGO, show_value, NULL, PSU_STATUS_INPUT); +static SENSOR_DEVICE_ATTR(psu_status_temp, S_IRUGO, show_value, NULL, PSU_STATUS_TEMPERATURE); +static SENSOR_DEVICE_ATTR(psu_status_fan_1_2, S_IRUGO, show_value, NULL, PSU_STATUS_FANS_1_2); +static SENSOR_DEVICE_ATTR(psu_ein, S_IRUGO, show_value, NULL, PSU_EIN); +static SENSOR_DEVICE_ATTR(psu_eout, S_IRUGO, show_value, NULL, PSU_EOUT); +static SENSOR_DEVICE_ATTR(psu_pmbus_rev,S_IRUGO, show_value, NULL, PSU_PMBUS_REVISION); +static SENSOR_DEVICE_ATTR(psu_mfr_id, S_IRUGO, show_value, NULL, PSU_MFR_ID); +static SENSOR_DEVICE_ATTR(psu_mfr_model,S_IRUGO, show_value, NULL, PSU_MFR_MODEL); + +static SENSOR_DEVICE_ATTR(psu_vin, S_IRUGO, show_value, NULL, PSU_VIN); +static SENSOR_DEVICE_ATTR(psu_vout, S_IRUGO, show_value, NULL, PSU_VOUT); +static SENSOR_DEVICE_ATTR(psu_iin, S_IRUGO, show_value, NULL, PSU_IIN); +static SENSOR_DEVICE_ATTR(psu_iout, S_IRUGO, show_value, NULL, PSU_IOUT); +static SENSOR_DEVICE_ATTR(psu_iout_max, S_IRUGO, show_value, NULL, PSU_MFR_IOUT_MAX); +static SENSOR_DEVICE_ATTR(psu_pin, S_IRUGO, show_value, NULL, PSU_PIN); +static SENSOR_DEVICE_ATTR(psu_pout, S_IRUGO, show_value, NULL, PSU_POUT); + +static SENSOR_DEVICE_ATTR(psu_temp_1, S_IRUGO, show_value, NULL, PSU_TEMPERATURE_1); +static SENSOR_DEVICE_ATTR(psu_fan_speed_1, S_IRUGO, show_value, NULL, PSU_FAN_SPEED_1); + +/* section for lm-sensor */ +#ifdef SYMBOL_FOR_LM_SENSOR +static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_value, NULL, PSU_VIN); +// static SENSOR_DEVICE_ATTR(in1_max, S_IRUGO, show_value, NULL, PSU_MFR_VIN_MAX); -> not support +static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_value, NULL, PSU_VOUT); +static SENSOR_DEVICE_ATTR(curr1_input, S_IRUGO, show_value, NULL, PSU_IIN); +static SENSOR_DEVICE_ATTR(curr2_input, S_IRUGO, show_value, NULL, PSU_IOUT); +static SENSOR_DEVICE_ATTR(curr2_max, S_IRUGO, show_value, NULL, PSU_MFR_IOUT_MAX); +static SENSOR_DEVICE_ATTR(power1_input, S_IRUGO, show_value, NULL, PSU_PIN); +static SENSOR_DEVICE_ATTR(power2_input, S_IRUGO, show_value, NULL, PSU_POUT); + +static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_value, NULL, PSU_TEMPERATURE_1); +static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_value, NULL, PSU_FAN_SPEED_1); +#endif + +static struct attribute *zrh2800k2_attributes[] = { + &sensor_dev_attr_psu_query.dev_attr.attr, + &sensor_dev_attr_psu_coeff.dev_attr.attr, + &sensor_dev_attr_psu_fan_config_1_2.dev_attr.attr, + &sensor_dev_attr_psu_capability.dev_attr.attr, + &sensor_dev_attr_psu_vout_mode.dev_attr.attr, + &sensor_dev_attr_psu_status_word.dev_attr.attr, + &sensor_dev_attr_psu_status_vout.dev_attr.attr, + &sensor_dev_attr_psu_status_iout.dev_attr.attr, + &sensor_dev_attr_psu_status_input.dev_attr.attr, + &sensor_dev_attr_psu_status_temp.dev_attr.attr, + &sensor_dev_attr_psu_status_fan_1_2.dev_attr.attr, + &sensor_dev_attr_psu_ein.dev_attr.attr, + &sensor_dev_attr_psu_eout.dev_attr.attr, + &sensor_dev_attr_psu_pmbus_rev.dev_attr.attr, + &sensor_dev_attr_psu_mfr_id.dev_attr.attr, + &sensor_dev_attr_psu_mfr_model.dev_attr.attr, + &sensor_dev_attr_psu_vin.dev_attr.attr, + &sensor_dev_attr_psu_vout.dev_attr.attr, + &sensor_dev_attr_psu_iin.dev_attr.attr, + &sensor_dev_attr_psu_iout.dev_attr.attr, + &sensor_dev_attr_psu_iout_max.dev_attr.attr, + &sensor_dev_attr_psu_pin.dev_attr.attr, + &sensor_dev_attr_psu_pout.dev_attr.attr, + &sensor_dev_attr_psu_temp_1.dev_attr.attr, + &sensor_dev_attr_psu_fan_speed_1.dev_attr.attr, +#ifdef SYMBOL_FOR_LM_SENSOR + &sensor_dev_attr_in1_input.dev_attr.attr, + &sensor_dev_attr_in2_input.dev_attr.attr, + &sensor_dev_attr_curr1_input.dev_attr.attr, + &sensor_dev_attr_curr2_input.dev_attr.attr, + &sensor_dev_attr_curr2_max.dev_attr.attr, + &sensor_dev_attr_power1_input.dev_attr.attr, + &sensor_dev_attr_power2_input.dev_attr.attr, + &sensor_dev_attr_temp1_input.dev_attr.attr, + &sensor_dev_attr_fan1_input.dev_attr.attr, +#endif + NULL +}; + +static const struct attribute_group zrh2800k2_group = { + .attrs = zrh2800k2_attributes, +}; + +static u32 easy_pow(u32 num, u32 power) +{ + if(power == 0) + return 1; + + power--; + + while(power) { + num = num*num; + power--; + } + return num; +} + +static int two_complement_to_int(u16 data, u8 valid_bit, int mask) +{ + u16 valid_data = data & mask; + bool is_negative = valid_data >> (valid_bit - 1); + + return is_negative ? (-(((~valid_data) & mask) + 1)) : valid_data; +} + + +static int zrh2800k2_read(struct device *dev, ACCESS_TYPE rtype , ZRH2800K2_REGS reg) +{ + + struct i2c_client *client = to_i2c_client(dev); + struct zrh2800k2_data *data = i2c_get_clientdata(client); + + int result; + + mutex_lock(&data->update_lock); + + if (rtype == READ_BYTE) { + result = i2c_smbus_read_byte_data(client, (u8)reg); + }else if(rtype == READ_WORD) { + result = i2c_smbus_read_word_data(client, (u8)reg); + }else{ + printk(KERN_ALERT "ERROR: unknown read type"); + } + + mutex_unlock(&data->update_lock); + + return result; + +} + + +static int zrh2800k2_read_block(struct device *dev, ZRH2800K2_REGS reg, u8* block_data, int block_data_len) +{ + + struct i2c_client *client = to_i2c_client(dev); + struct zrh2800k2_data *data = i2c_get_clientdata(client); + + int result; + + mutex_lock(&data->update_lock); + + result = i2c_smbus_read_i2c_block_data(client, (u8)reg, block_data_len, block_data); + + mutex_unlock(&data->update_lock); + + if (unlikely(result < 0)) { + goto read_block_exit; + } + + if (result != block_data_len) { + result = -EIO; + goto read_block_exit; + } + + result = 0; + +read_block_exit: + return result; + +} + +static int get_coefficient(struct device* dev, u16* m, u16* b, u8* R) +{ + u8 buf_block[6] = {0}; + int ret = zrh2800k2_read_block(dev, REG_COEFFICIENTS, buf_block, 6); + + + // [ byte_count,m-l,m-h,b-l,b-h,R ] + if (ret < 0) { + printk(KERN_ALERT "get coefficient fail(%d)\n", ret); + return -1; + } + + *R = buf_block[5]; + *m = buf_block[2]; + *m = ((*m)<<8 )+ buf_block[1]; + *b = buf_block[4]; + *b = ((*b)<<8 )+ buf_block[3]; + + debug_print((KERN_DEBUG " coefficient read : 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x \n", buf_block[0], buf_block[1], buf_block[2], + buf_block[3], buf_block[4], buf_block[5])); + debug_print((KERN_DEBUG " coefficient r m b: 0x%x, 0x%x, 0x%x \n", *R, *m, *b)); + + return 0; + +} + + +/* read a byte or word value and show*/ +static ssize_t show_value(struct device *dev, struct device_attribute *da, char *buf) +{ + + u16 u16_val = 0; + int exponent = 0, mantissa = 0; + int multiplier = 1000; // lm-sensor uint: mV, mA, mC + + u8 buf_block[11] = {0}; // used to save enough data from read block. + + char *ascii = NULL; + int ret = 0; + + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + debug_print((KERN_DEBUG "show value op[%d]: reg %d\n", attr->index, + operation_set[attr->index].reg )); + + switch (operation_set[attr->index].type) { + + case READ_BYTE: + case READ_WORD: + ret = zrh2800k2_read(dev, operation_set[attr->index].type , operation_set[attr->index].reg); + break; + + case READ_BLOCK: + ret = zrh2800k2_read_block(dev, operation_set[attr->index].reg, buf_block, operation_set[attr->index].data_size + 1); + break; + + default: + printk(KERN_ALERT "unknown access type\n"); + return 0; + + } + + if (ret < 0) { + printk(KERN_ALERT "ERROR: Read fail ret(%d)\n", ret); + return 0; + } + + /* arrange return buf */ + switch (attr->index) { + + /* case directly return */ + case PSU_STATUS_WORD: + case PSU_VOUT_MODE: + return sprintf(buf, "%d\n", ret); + + case PSU_STATUS_VOUT: + return sprintf(buf, + "VOUT Over Voltage Fault : %d \nVOUT Over Voltage Warning : %d \nVOUT Under Voltage Warning : %d \nVOUT Under Voltage Fault : %d \n", + (ret>>7)&0x1,(ret>>6)&0x1, + (ret>>5)&0x1,(ret>>4)&0x1); + + case PSU_STATUS_IOUT: + return sprintf(buf, + "IOUT Overcurrent Fault : %d \nIOUT Overcurrent Warnning : %d \nPOUT Overcurrent Fault : %d \nPOUT Overcurrent Warnning : %d \n", + (ret>>7)&0x1, (ret>>5)&0x1, + (ret>>1)&0x1, ret&0x1); + + case PSU_STATUS_INPUT: + return sprintf(buf, + "PIN Overpower Warning : %d \n", (ret&0x1)); + + case PSU_STATUS_TEMPERATURE: + return sprintf(buf, + "Overtemperature Fault : %d \nOvertemperature Warning : %d \nUbdertemperature Warning : %d \nUbdertemperature Fault : %d \n", + (ret>>7)&0x1,(ret>>6)&0x1, + (ret>>5)&0x1,(ret>>4)&0x1); + + case PSU_STATUS_FANS_1_2: + return sprintf(buf, + "Fan Fault : %d \nFan Warning : %d \n", + (ret>>7)&0x1, (ret>>5)&0x1); + + case PSU_FAN_CONFIG_1_2: + debug_print((KERN_DEBUG "PSU_FAN_CONFIG_1_2: 0x%X\n",ret)); + return sprintf(buf, + "Fan is installed in Position1: %s\n" \ + "Fan1 speed Unit: %s\n" \ + "Fan1 Tachometer Pulses Per Revolution 0x%x\n" \ + "Fan install in Position2: %s\n" \ + "Fan2 speed Unit: %s\n" \ + "Fan2 Tachometer Pulses Per Revolution 0x%x\n", + (ret>>7)?"YES":"NONE", + ((ret>>6)&0x1)?"RPM":"Duty Cycle", + (ret>>4)&0x3, + (ret>>3&0x01)?"YES":"NONE", + ((ret>>2)&0x1)?"RPM":"Duty Cycle", + ret&0x3); + + /* special case for READ_VOUT */ + case PSU_VOUT: + /* save mantissa */ + mantissa = ret; + + debug_print((KERN_DEBUG "PSU_VOUT: mantissa 0x%X\n",mantissa)); + + /* read the exponent from REG_READ_VMODE */ + ret = zrh2800k2_read(dev, READ_BYTE , REG_VOUT_MODE); + if (ret < 0) { + printk(KERN_ALERT "Error: Read fail ret(%d)\n", ret); + return 0; + } + exponent = two_complement_to_int(ret & 0x1f, 5, 0x1f); + + debug_print((KERN_DEBUG "PSU_VOUT: VOUT_MODE 0x%X\n",ret)); + debug_print((KERN_DEBUG "PSU_VOUT: exponent 0x%X\n",exponent)); + + return (exponent >= 0) ? sprintf(buf, "%d\n", (mantissa << exponent)*multiplier ) : \ + sprintf(buf, "%d\n", (mantissa*multiplier / (1 << -exponent))); + + /* word data with linear format */ + case PSU_POUT: + case PSU_PIN: + multiplier = 1000000; // lm-sensor unit: uW + case PSU_VIN: + case PSU_IIN: + case PSU_IOUT: + case PSU_TEMPERATURE_1: + case PSU_FAN_SPEED_1: + case PSU_MFR_VIN_MAX: + case PSU_MFR_IOUT_MAX: + + if (attr->index == PSU_FAN_SPEED_1) + multiplier = 1; + + u16_val = ret; + exponent = two_complement_to_int(u16_val >> 11, 5, 0x1f); + mantissa = two_complement_to_int(u16_val & 0x7ff, 11, 0x7ff); + + debug_print((KERN_DEBUG "REG(%d): ret 0x%X, u16_val: 0x%x\n", attr->index, ret, u16_val)); + debug_print((KERN_DEBUG "REG(%d): exponent 0x%X\n", attr->index, exponent)); + debug_print((KERN_DEBUG "REG(%d): mantissa 0x%X\n", attr->index, mantissa)); + + return (exponent >= 0) ? sprintf(buf, "%d\n", (mantissa << exponent)*multiplier ) : \ + sprintf(buf, "%d\n", (mantissa*multiplier / (1 << -exponent))); + + case PSU_EIN: + case PSU_EOUT: { + + u16 m,b; + u8 R; + + u64 ev = buf_block[2]; + u8 rc = buf_block[3]; + u64 sc = buf_block[6]; + u32 sc_mid = buf_block[5]; + u64 average_value = 0; + + struct i2c_client *client = to_i2c_client(dev); + struct zrh2800k2_data *data = i2c_get_clientdata(client); + + if (get_coefficient(dev, &m, &b, &R) < 0) { + return sprintf(buf, "ERROR, fail to get coefficient\n"); + } + + // [ bytecount, energy_count-l, energy_count-h, ROLLOVER_count , + // sample_count-l, sample_count-mid, sample_count-h ] + // maximum_direct_format_value = (m*32767+b)*(10)^R + // energy_value = Rollover_count * maximum_direct_format_value + energy_count + + debug_print((KERN_DEBUG "[ec-l,ec-h,rc,sc-l,sc-,sc-h]: [0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x]\n", buf_block[0], buf_block[1], buf_block[2], + buf_block[3], buf_block[4], buf_block[5], buf_block[6])); + + ev = rc * (m*32767+b)*easy_pow(10,R) + ((ev<<8) + buf_block[1]); + sc = (sc<<16) + (sc_mid<<8) + buf_block[4]; + + if(attr->index == PSU_EIN) { + average_value = ((ev - data->last_energy_value_EIN)*1000) / (sc - data->last_smaple_count_EIN); + data->last_energy_value_EIN = ev; + data->last_smaple_count_EIN = sc; + } else { + average_value = ((ev - data->last_energy_value_EOUT)*1000) / (sc - data->last_smaple_count_EOUT); + data->last_energy_value_EOUT = ev; + data->last_smaple_count_EOUT = sc; + } + return sprintf(buf, "%llu.%llu\n", average_value/1000, average_value%1000); + + } + + case PSU_MFR_ID: + case PSU_MFR_MODEL: + debug_print((KERN_DEBUG "[0x%x,0x%x,0x%x,0x%x,0x%x,0x%x]\n", buf_block[0], buf_block[1], buf_block[2], + buf_block[3], buf_block[4], buf_block[5])); + + ascii = &buf_block[1]; + return sprintf(buf, "%s\n", ascii); + + + case PSU_PMBUS_REVISION: + return sprintf(buf, "Part1 Revision: 1.%d, Part2 Revision: 1.%d\n", + (ret>>5), (ret&0x7) ); + + /* not implement yet */ + default: + return sprintf(buf, "not implement yet\n"); + + } + + /* should not goto here */ + return sprintf(buf, "unknown case\n"); + +} + + +static ssize_t show_capability(struct device *dev, struct device_attribute *da, char *buf) +{ + /* todo */ + return sprintf(buf, "not implement yet\n"); +} + +static ssize_t psu_pm_query(struct device *dev, struct device_attribute *da, char *buf) +{ + /* todo */ + return sprintf(buf, "not implement yet\n"); +} + +static ssize_t psu_coefficient(struct device *dev, struct device_attribute *da, char *buf) +{ + /* todo */ + return sprintf(buf, "not implement yet\n"); +} + +static ssize_t set_fan_config(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct zrh2800k2_data *data = i2c_get_clientdata(client); + + int result; + u8 input_val; + + mutex_lock(&data->update_lock); + + input_val = simple_strtol(buf, NULL, 10); + + result = i2c_smbus_write_byte_data(client, REG_FAN_CONFIG_1_2, input_val); + + mutex_unlock(&data->update_lock); + + if (result < 0) { + printk(KERN_ALERT "ERROR: SET_FAN_CONFIG %s fail\n", buf); + } else { + debug_print((KERN_DEBUG "SET_FAN_CONFIG %s success\n", buf)); + } + + + return count; + +} + + +static const struct i2c_device_id zrh2800k2_id[] = { + { "zrh2800k2", zrh2800k2 }, + { "zrh2ab0k2", zrh2ab0k2 }, + {} +}; + +static struct i2c_driver zrh2800k2_driver = { + .class = I2C_CLASS_HWMON, + .driver = + { + .name = "ZRH2xxxK2", + }, + .probe = zrh2800k2_probe, + .remove = zrh2800k2_remove, + .id_table = zrh2800k2_id, + .address_list = normal_i2c, +}; + +static int zrh2800k2_remove(struct i2c_client *client) +{ + struct zrh2800k2_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &zrh2800k2_group); + kfree(data); + return 0; + +} + +static int zrh2800k2_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + + struct zrh2800k2_data *data; + int status; + + if(!i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_BYTE_DATA | + I2C_FUNC_SMBUS_WORD_DATA)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct zrh2800k2_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &zrh2800k2_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: psu '%s'\n", dev_name(data->hwmon_dev), + client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &zrh2800k2_group); + +exit_free: + kfree(data); + +exit: + return status; + +} + + +module_i2c_driver(zrh2800k2_driver); +MODULE_AUTHOR("Cameo Inc."); +MODULE_DESCRIPTION("Power Supply zrh-2800k2 driver"); +MODULE_LICENSE("GPL"); + diff --git a/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/modules/zrh2800k2.mod.c b/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/modules/zrh2800k2.mod.c new file mode 100644 index 0000000000..867ad83530 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/modules/zrh2800k2.mod.c @@ -0,0 +1,54 @@ +#include +#include +#include + +MODULE_INFO(vermagic, VERMAGIC_STRING); + +__visible struct module __this_module +__attribute__((section(".gnu.linkonce.this_module"))) = { + .name = KBUILD_MODNAME, + .init = init_module, +#ifdef CONFIG_MODULE_UNLOAD + .exit = cleanup_module, +#endif + .arch = MODULE_ARCH_INIT, +}; + +#ifdef RETPOLINE +MODULE_INFO(retpoline, "Y"); +#endif + +static const struct modversion_info ____versions[] +__used +__attribute__((section("__versions"))) = { + { 0xd1a11d1c, __VMLINUX_SYMBOL_STR(module_layout) }, + { 0x8308dcad, __VMLINUX_SYMBOL_STR(i2c_del_driver) }, + { 0x851c3bfc, __VMLINUX_SYMBOL_STR(i2c_register_driver) }, + { 0xdb7305a1, __VMLINUX_SYMBOL_STR(__stack_chk_fail) }, + { 0x91715312, __VMLINUX_SYMBOL_STR(sprintf) }, + { 0x14c72286, __VMLINUX_SYMBOL_STR(i2c_smbus_read_byte_data) }, + { 0x4f6e1ac4, __VMLINUX_SYMBOL_STR(i2c_smbus_read_word_data) }, + { 0xfa119060, __VMLINUX_SYMBOL_STR(hwmon_device_register) }, + { 0xae59a99, __VMLINUX_SYMBOL_STR(sysfs_create_group) }, + { 0x4b82759, __VMLINUX_SYMBOL_STR(_dev_info) }, + { 0x888680a0, __VMLINUX_SYMBOL_STR(__mutex_init) }, + { 0xe52cb2e9, __VMLINUX_SYMBOL_STR(kmem_cache_alloc_trace) }, + { 0x660b9bcf, __VMLINUX_SYMBOL_STR(kmalloc_caches) }, + { 0x2ea2c95c, __VMLINUX_SYMBOL_STR(__x86_indirect_thunk_rax) }, + { 0x27e1a049, __VMLINUX_SYMBOL_STR(printk) }, + { 0x50eb70fa, __VMLINUX_SYMBOL_STR(i2c_smbus_write_byte_data) }, + { 0xb742fd7, __VMLINUX_SYMBOL_STR(simple_strtol) }, + { 0x94218140, __VMLINUX_SYMBOL_STR(mutex_unlock) }, + { 0xd0b0d91b, __VMLINUX_SYMBOL_STR(i2c_smbus_read_i2c_block_data) }, + { 0x86b8d7be, __VMLINUX_SYMBOL_STR(mutex_lock) }, + { 0x37a0cba, __VMLINUX_SYMBOL_STR(kfree) }, + { 0x9b242c96, __VMLINUX_SYMBOL_STR(sysfs_remove_group) }, + { 0x81e2daa3, __VMLINUX_SYMBOL_STR(hwmon_device_unregister) }, + { 0xbdfb6dbb, __VMLINUX_SYMBOL_STR(__fentry__) }, +}; + +static const char __module_depends[] +__used +__attribute__((section(".modinfo"))) = +"depends="; + diff --git a/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/scripts/sensors b/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/scripts/sensors new file mode 100755 index 0000000000..99512ade28 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/scripts/sensors @@ -0,0 +1,8 @@ +#!/bin/bash +docker exec -i pmon sensors "$@" + +#To probe sensors not part of lm-sensors +if [ -r /usr/local/bin/cameo_esqc610_sensors.py ]; then + python /usr/local/bin/cameo_esqc610_sensors.py fan_status + python /usr/local/bin/cameo_esqc610_sensors.py sensor_status +fi diff --git a/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/service/esqc610-platform-init.service b/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/service/esqc610-platform-init.service new file mode 100644 index 0000000000..cb98965d25 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/service/esqc610-platform-init.service @@ -0,0 +1,13 @@ +[Unit] +Description=Cameo Esqc610-56sq Platform initialization service +After=local-fs.target innovium_platform_driver.service +Before=pmon.service + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/cameo_esqc610_startup start +ExecStop=/usr/local/bin/cameo_esqc610_startup stop +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/templates/cameo_esqc610_util.py.j2 b/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/templates/cameo_esqc610_util.py.j2 new file mode 100644 index 0000000000..ce4313c133 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/templates/cameo_esqc610_util.py.j2 @@ -0,0 +1,816 @@ +#!/usr/bin/env python +# +# Copyright (C) 2019 Cameo Networks, Inc. + + +""" +Usage: %(scriptName)s [options] command object + +options: + -h | --help : this help message + -d | --debug : run with debug mode + -f | --force : ignore error during installation or clean +command: + install : install drivers and generate related sysfs nodes + clean : uninstall drivers and remove related sysfs nodes + show : show all systen status + sff : dump SFP eeprom + set : change board setting with fan|led|sfp +""" + +import os +import commands +import sys, getopt +import logging +import re +import time +import json + +PROJECT_NAME = 'esqc610_56sq' +verbose = False +DEBUG = False +FORCE = 0 + +PLATFORM_DRIVER_VER = {{ env("PLATFORM_DRIVER_VER") }} + +PLATFORM_INSTALL_INFO_FILE="/etc/sonic/platform_install.json" + +# default is 'i2c-0', we will choose the correct one from 'i2c-0' and 'i2c-1'. +DEFAULT_BASE_BUS = 'i2c-0' +BASE_BUS = 'i2c-0' + +I2C_BASE_BUS = { + 'i2c-0':{ + 'path':'/sys/bus/i2c/devices/i2c-0', + 'status':'INSTALLED' + }, + 'i2c-1':{ + 'path':'/sys/bus/i2c/devices/i2c-1', + 'status':'INSTALLED' + } +} + +switch_install_order = [ +'PCA9548_0x73', +'PCA9548_0x71_1', +'PCA9548_0x71_2', +'PCA9548_0x71_3', +'PCA9548_0x71_4', +'PCA9548_0x71_5', +'PCA9548_0x71_6', +'PCA9548_0x71_7', +'PCA9548_0x75' +] + +I2C_SWITCH_LIST = { + # i2c switches + 'PCA9548_0x73': { + 'parent':'base', + 'driver':'pca9548', + 'i2caddr': '0x73', + 'path': ' ', + 'bus_map': [0,0,0,0,0,0,0,0], + 'status':'NOTINST' + }, + 'PCA9548_0x75': { + 'parent':'base', + 'driver':'pca9548', + 'i2caddr': '0x75', + 'path': ' ', + 'bus_map': [0,0,0,0,0,0,0,0], + 'status':'NOTINST' + }, + 'PCA9548_0x71_1': { + 'parent':'PCA9548_0x73', + 'parent_ch': 0, + 'driver':'pca9548', + 'i2caddr': '0x71', + 'path': ' ', + 'bus_map': [0,0,0,0,0,0,0,0], + 'status':'NOTINST' + }, + 'PCA9548_0x71_2': { + 'parent':'PCA9548_0x73', + 'parent_ch': 1, + 'driver':'pca9548', + 'i2caddr': '0x71', + 'path': ' ', + 'bus_map': [0,0,0,0,0,0,0,0], + 'status':'NOTINST' + }, + 'PCA9548_0x71_3': { + 'parent':'PCA9548_0x73', + 'parent_ch': 2, + 'driver':'pca9548', + 'i2caddr': '0x71', + 'path': ' ', + 'bus_map': [0,0,0,0,0,0,0,0], + 'status':'NOTINST' + }, + 'PCA9548_0x71_4': { + 'parent':'PCA9548_0x73', + 'parent_ch': 3, + 'driver':'pca9548', + 'i2caddr': '0x71', + 'path': ' ', + 'bus_map': [0,0,0,0,0,0,0,0], + 'status':'NOTINST' + }, + 'PCA9548_0x71_5': { + 'parent':'PCA9548_0x73', + 'parent_ch': 4, + 'driver':'pca9548', + 'i2caddr': '0x71', + 'path': ' ', + 'bus_map': [0,0,0,0,0,0,0,0], + 'status':'NOTINST' + }, + 'PCA9548_0x71_6': { + 'parent':'PCA9548_0x73', + 'parent_ch': 5, + 'driver':'pca9548', + 'i2caddr': '0x71', + 'path': ' ', + 'bus_map': [0,0,0,0,0,0,0,0], + 'status':'NOTINST' + }, + 'PCA9548_0x71_7': { + 'parent':'PCA9548_0x73', + 'parent_ch': 6, + 'driver':'pca9548', + 'i2caddr': '0x71', + 'path': ' ', + 'bus_map': [0,0,0,0,0,0,0,0], + 'status':'NOTINST' + } +} + +I2C_DEVICES = { + # sys eeprom + 'SYS_EEPROM': { + 'parent':'base', + 'driver':'24c64smbus', + 'i2caddr': '0x56', + 'path': ' ', + 'status':'NOTINST' + }, + # NCT7511Y sensor & fan control + 'NCT7511Y(U73)': { + 'parent':'PCA9548_0x75', + 'parent_ch': 0, + 'driver':'nct7511', + 'i2caddr': '0x2e', + 'path': ' ', + 'status':'NOTINST' + }, + # G781 sensors + 'G781(U94)': { + 'parent':'PCA9548_0x75', + 'parent_ch': 1, + 'driver':'g781', + 'i2caddr': '0x4c', + 'path': ' ', + 'status':'NOTINST' + }, + 'G781(U4)': { + 'parent':'PCA9548_0x75', + 'parent_ch': 2, + 'driver':'g781', + 'i2caddr': '0x4c', + 'path': ' ', + 'status':'NOTINST' + }, + 'G781(U34)': { + 'parent':'PCA9548_0x75', + 'parent_ch': 3, + 'driver':'g781', + 'i2caddr': '0x4c', + 'path': ' ', + 'status':'NOTINST' + }, + # PSU + 'PSU1': { + 'parent':'PCA9548_0x75', + 'parent_ch': 4, + 'driver':'zrh2800k2', + 'i2caddr': '0x58', + 'path': ' ', + 'status':'NOTINST' + }, + 'PSU2': { + 'parent':'PCA9548_0x75', + 'parent_ch': 4, + 'driver':'zrh2800k2', + 'i2caddr': '0x59', + 'path': ' ', + 'status':'NOTINST' + }, + 'TPS53681(0x6E)': { + 'parent':'PCA9548_0x75', + 'parent_ch': 5, + 'driver':'tps53679', + 'i2caddr': '0x6e', + 'path': ' ', + 'status':'NOTINST' + }, + 'TPS53681(0x70)': { + 'parent':'PCA9548_0x75', + 'parent_ch': 5, + 'driver':'tps53679', + 'i2caddr': '0x70', + 'path': ' ', + 'status':'NOTINST' + } +} + +SFP_GROUPS = { + 'SFP-G01' :{ + 'number': 8, + 'parent':'PCA9548_0x71_1', + 'channels':[0,1,2,3,4,5,6,7], + 'driver':'optoe2', + 'i2caddr': '0x50', + 'paths': [], + 'status':'NOTINST' + }, + 'SFP-G02' :{ + 'number': 8, + 'parent':'PCA9548_0x71_2', + 'channels':[0,1,2,3,4,5,6,7], + 'driver':'optoe2', + 'i2caddr': '0x50', + 'paths': [], + 'status':'NOTINST' + }, + 'SFP-G03' :{ + 'number': 8, + 'parent':'PCA9548_0x71_3', + 'channels':[0,1,2,3,4,5,6,7], + 'driver':'optoe2', + 'i2caddr': '0x50', + 'paths': [], + 'status':'NOTINST' + }, + 'SFP-G04' :{ + 'number': 8, + 'parent':'PCA9548_0x71_4', + 'channels':[0,1,2,3,4,5,6,7], + 'driver':'optoe2', + 'i2caddr': '0x50', + 'paths': [], + 'status':'NOTINST' + }, + 'SFP-G05' :{ + 'number': 8, + 'parent':'PCA9548_0x71_5', + 'channels':[0,1,2,3,4,5,6,7], + 'driver':'optoe2', + 'i2caddr': '0x50', + 'paths': [], + 'status':'NOTINST' + }, + 'SFP-G06' :{ + 'number': 8, + 'parent':'PCA9548_0x71_6', + 'channels':[0,1,2,3,4,5,6,7], + 'driver':'optoe2', + 'i2caddr': '0x50', + 'paths': [], + 'status':'NOTINST' + }, + 'SFP-G07' :{ + 'number': 8, + 'parent':'PCA9548_0x71_7', + 'channels':[0,1,2,3,4,5,6,7], + 'driver':'optoe1', + 'i2caddr': '0x50', + 'paths': [], + 'status':'NOTINST' + } +} + + + +if DEBUG == True: + print sys.argv[0] + print 'ARGV :', sys.argv[1:] + + +def main(): + global DEBUG + global args + global FORCE + + if len(sys.argv) < 2: + show_help() + + options, args = getopt.getopt(sys.argv[1:], 'hdf', ['help', + 'debug', + 'force', + ]) + if DEBUG == True: + print options + print args + print len(sys.argv) + + for opt, arg in options: + if opt in ('-h', '--help'): + show_help() + elif opt in ('-d', '--debug'): + DEBUG = True + logging.basicConfig(level=logging.INFO) + elif opt in ('-f', '--force'): + FORCE = 1 + else: + logging.info('no option') + for arg in args: + if arg == 'install': + do_install() + elif arg == 'clean': + do_uninstall() + elif arg == 'show': + devices_info() + elif arg == 'version': + show_version() + else: + show_help() + + return 0 + +def show_version(): + print("platform driver version: {}\n".format(PLATFORM_DRIVER_VER)) + +def show_help(): + print __doc__ % {'scriptName': sys.argv[0].split("/")[-1]} + sys.exit(0) + + +def show_set_help(): + cmd = sys.argv[0].split("/")[-1] + " " + args[0] + print cmd + " [led|sfp|fan]" + print " use \"" + cmd + " led 0-4 \" to set led color" + print " use \"" + cmd + " fan 0-100\" to set fan duty percetage" + print " use \"" + cmd + " sfp 1-54 {0|1}\" to set sfp# tx_disable" + sys.exit(0) + +def log_os_system(cmd, show): + logging.info('Run :' + cmd) + status, output = commands.getstatusoutput(cmd) + logging.info(cmd + "with result:" + str(status)) + logging.info(" output:" + output) + if status: + logging.info('Failed :' + cmd) + if show: + print('Failed ({}):'.format(status) + cmd) + return status, output + + +def driver_check(): + ret, lsmod = log_os_system("lsmod| grep cameo", 0) + logging.info('mods:' + lsmod) + if len(lsmod) == 0: + return False + return True + + +kos = [ + 'depmod -a', + 'modprobe i2c_dev', + 'modprobe x86-64-cameo-esqc610-56sq', + 'modprobe i2c_mux_pca954x force_deselect_on_exit=1', + 'modprobe nct7511', + 'modprobe at24', + 'modprobe zrh2800k2' +] + + +def driver_install(): + global FORCE + for i in range(0, len(kos)): + status, output = log_os_system(kos[i], 1) + if status: + if FORCE == 0: + return status + return 0 + + +def driver_uninstall(): + global FORCE + for i in range(0, len(kos)): + rm = kos[-(i + 1)].replace("modprobe", "modprobe -rq") + rm = rm.replace("insmod", "rmmod") + rm = rm.replace("force_deselect_on_exit=1", " ") + status, output = log_os_system(rm, 1) + if status: + if FORCE == 0: + return status + return 0 + +def check_base_bus(): + global I2C_SWITCH_LIST + global I2C_DEVICES + global SFP_GROUPS + global BASE_BUS + # we start check with the first i2c switch to install which on base bus + switch = I2C_SWITCH_LIST[switch_install_order[0]] + for bbus in I2C_BASE_BUS.keys(): + install_path = I2C_BASE_BUS[bbus]['path'] + cmd = "echo {} {} > {}/new_device".format(switch['driver'], switch['i2caddr'], install_path) + log_os_system(cmd, 1) + time.sleep(1) + cmd = "ls /sys/bus/i2c/devices/{}-00{}/channel-0".format(bbus[-1],switch['i2caddr'][-2:]) + result = log_os_system(cmd, 1)[0] + #uninstall + cmd = "echo {} > {}/delete_device".format(switch['i2caddr'], install_path) + log_os_system(cmd, 1) + if result == 0: + BASE_BUS = bbus + break + + logging.info('Base bus is {}'.format(BASE_BUS)) + + #exchange all base bus + for dev_name in I2C_SWITCH_LIST.keys(): + if I2C_SWITCH_LIST[dev_name]['parent'] == 'base': + I2C_SWITCH_LIST[dev_name]['parent'] = BASE_BUS + for dev_name in I2C_DEVICES.keys(): + if I2C_DEVICES[dev_name]['parent'] == 'base': + I2C_DEVICES[dev_name]['parent'] = BASE_BUS + for dev_name in SFP_GROUPS.keys(): + if SFP_GROUPS[dev_name]['parent'] == 'base': + SFP_GROUPS[dev_name]['parent'] = BASE_BUS + + +def get_next_bus_num(): + num_list = [] + device_list = os.listdir("/sys/bus/i2c/devices") + for x in device_list: + t = re.match(r'i2c-(\d+)', x) + if t: + num_list.append(int(t.group(1))) + logging.info('next_bus_id is {}'.format(max(num_list)+1)) + return max(num_list)+1 + +def install_i2c_switch(): + + for switch_name in switch_install_order: + next_bus_id = get_next_bus_num() + switch = I2C_SWITCH_LIST[switch_name] + if switch['parent'] in I2C_BASE_BUS: + install_path = I2C_BASE_BUS[switch['parent']]['path'] + else: + install_path = I2C_SWITCH_LIST[switch['parent']]['path'] + + if 'parent_ch' in switch: + install_path = install_path+"/channel-{}".format(switch['parent_ch']) + if I2C_SWITCH_LIST[switch['parent']]['status'] != 'INSTALLED': + continue + + cmd = "echo {} {} > {}/new_device".format(switch['driver'], switch['i2caddr'], install_path) + status, output = log_os_system(cmd, 1) + if status != 0: + switch['status'] = 'FAILED' + continue + + if switch['parent'] in I2C_BASE_BUS: + switch['path'] = "/sys/bus/i2c/devices/{}-00{}".format(switch['parent'][-1],switch['i2caddr'][-2:]) + else: + switch['path'] = "/sys/bus/i2c/devices/{}-00{}".format(I2C_SWITCH_LIST[switch['parent']]['bus_map'][switch['parent_ch']],switch['i2caddr'][-2:]) + + # add delay to make sure the root switch for sfp is installed completely, + # so we can start the installation of next switch + if switch_name == 'PCA9548_0x73': + time.sleep(1) + + #Check if bus are actually created + for busid in range(next_bus_id,next_bus_id+8): + if not os.path.exists("/sys/bus/i2c/devices/i2c-{}".format(busid)): + print("Fail to create bus when install {}".format(switch_name)) + switch['status'] = 'FAILED' + break + else: + # exit loop normally; not breakout + switch['bus_map'] = list(range(next_bus_id,next_bus_id+8)) + switch['status'] = 'INSTALLED' + +def remove_install_status(): + if os.path.exists(PLATFORM_INSTALL_INFO_FILE): + os.remove(PLATFORM_INSTALL_INFO_FILE) + +def restore_install_status(): + output = [] + output.append(I2C_SWITCH_LIST) + output.append(I2C_DEVICES) + output.append(SFP_GROUPS) + jsondata = json.dumps(output) + with open(PLATFORM_INSTALL_INFO_FILE,'w') as fd: + fd.write(jsondata) + +def update_hwmon(): + for dev_name in I2C_DEVICES.keys(): + dev = I2C_DEVICES[dev_name] + if dev['status'] == 'INSTALLED': + if os.path.exists(dev['path']+'/hwmon'): + dev['hwmon_path'] = os.path.join(dev['path']+'/hwmon', os.listdir(dev['path']+'/hwmon')[0]) + + +def install_i2c_device(): + for dev_name in I2C_DEVICES.keys(): + dev = I2C_DEVICES[dev_name] + if dev['parent'] in I2C_BASE_BUS: + install_path = I2C_BASE_BUS[dev['parent']]['path'] + else: + install_path = I2C_SWITCH_LIST[dev['parent']]['path'] + + if 'parent_ch' in dev: + install_path = install_path+"/channel-{}".format(dev['parent_ch']) + if I2C_SWITCH_LIST[dev['parent']]['status'] != 'INSTALLED': + continue + + cmd = "echo {} {} > {}/new_device".format(dev['driver'], dev['i2caddr'], install_path) + status, output = log_os_system(cmd, 1) + if status != 0: + dev['status'] = 'FAILED' + continue + + if dev['parent'] in I2C_BASE_BUS: + dev['path'] = "/sys/bus/i2c/devices/{}-00{}".format(dev['parent'][-1],dev['i2caddr'][-2:]) + else: + dev['path'] = "/sys/bus/i2c/devices/{}-00{}".format(I2C_SWITCH_LIST[dev['parent']]['bus_map'][dev['parent_ch']],dev['i2caddr'][-2:]) + + dev['status'] = 'INSTALLED' + + +def install_sfp(): + for sfp_group_name in SFP_GROUPS.keys(): + sfp_group = SFP_GROUPS[sfp_group_name] + if sfp_group['parent'] in I2C_BASE_BUS: + install_path = I2C_BASE_BUS[sfp_group['parent']]['path'] + else: + install_path = I2C_SWITCH_LIST[sfp_group['parent']]['path'] + + # parent switch is not installed, skip this sfp group + if I2C_SWITCH_LIST[sfp_group['parent']]['status'] != 'INSTALLED': + sfp_group['paths'] = ['n/a']*sfp_group['number'] + continue + + for n in range(0,sfp_group['number']): + sfp_install_path = install_path+"/channel-{}".format(sfp_group['channels'][n]) + cmd = "echo {} {} > {}/new_device".format(sfp_group['driver'], sfp_group['i2caddr'], sfp_install_path) + status, output = log_os_system(cmd, 1) + if status != 0: + sfp_group['status'] = 'FAILED' + sfp_group['paths'].append("n/a") + continue + + if sfp_group['parent'] in I2C_BASE_BUS: + sfp_group['paths'].append("/sys/bus/i2c/devices/{}-00{}".format(sfp_group['parent'][-1],sfp_group['i2caddr'][-2:])) + else: + sfp_group['paths'].append("/sys/bus/i2c/devices/{}-00{}".format(I2C_SWITCH_LIST[sfp_group['parent']]['bus_map'][sfp_group['channels'][n]],sfp_group['i2caddr'][-2:])) + + # if all sfps in a group are success + if len(sfp_group['paths']) == sfp_group['number']: + sfp_group['status'] = "INSTALLED" + +def uninstall_sfp(): + for sfp_group_name in SFP_GROUPS.keys(): + sfp_group = SFP_GROUPS[sfp_group_name] + if sfp_group['parent'] in I2C_BASE_BUS: + uninst_path = I2C_BASE_BUS[sfp_group['parent']]['path'] + else: + uninst_path = I2C_SWITCH_LIST[sfp_group['parent']]['path'] + + # sfp is not installed, skip this sfp group + if sfp_group['status'] != 'INSTALLED': + continue + + for n in range(0,sfp_group['number']): + sfp_uninst_path = uninst_path+"/channel-{}".format(sfp_group['channels'][n]) + cmd = "echo {} > {}/delete_device".format(sfp_group['i2caddr'], sfp_uninst_path) + log_os_system(cmd, 1) + +def uninstall_i2c_device(): + for dev_name in I2C_DEVICES.keys(): + dev = I2C_DEVICES[dev_name] + if dev['parent'] in I2C_BASE_BUS: + uninst_path = I2C_BASE_BUS[dev['parent']]['path'] + else: + uninst_path = I2C_SWITCH_LIST[dev['parent']]['path'] + + # device is not installed, skip this device + if dev['status'] != 'INSTALLED': + continue + + if 'parent_ch' in dev: + uninst_path = uninst_path+"/channel-{}".format(dev['parent_ch']) + + cmd = "echo {} > {}/delete_device".format(dev['i2caddr'], uninst_path) + log_os_system(cmd, 1) + +def uninstall_i2c_switch(): + for switch_name in reversed(switch_install_order): + switch = I2C_SWITCH_LIST[switch_name] + if switch['parent'] in I2C_BASE_BUS: + uninst_path = I2C_BASE_BUS[switch['parent']]['path'] + else: + uninst_path = I2C_SWITCH_LIST[switch['parent']]['path'] + + # switch is not installed, skip this switch + if switch['status'] != 'INSTALLED': + continue + + if 'parent_ch' in switch: + uninst_path = uninst_path+"/channel-{}".format(switch['parent_ch']) + + cmd = "echo {} > {}/delete_device".format(switch['i2caddr'], uninst_path) + log_os_system(cmd, 1) + +def hw_adjustment(): + global SFP_GROUPS + global I2C_DEVICES + global switch_install_order + global I2C_SWITCH_LIST + if bmc_is_exist(): + switch_install_order.remove('PCA9548_0x75') + for device_name in I2C_DEVICES.keys(): + device = I2C_DEVICES[device_name] + if device['parent'] == 'PCA9548_0x75': + device['status'] = 'viaBMC' + + hw_ver = get_hw_version() + if hw_ver is not None: + print("HW version: {}".format(hw_ver)) + hw_ver = int(hw_ver, 16) + else: + print("Failed to get HW version") + hw_ver = 0x0 + + if hw_ver == 0x06: + I2C_SWITCH_LIST['PCA9548_0x71_7']['i2caddr'] = '0x74' + + + +def set_led_control(): + cmd = "echo 1 > /sys/class/hwmon/hwmon2/device/ESQC610_LED/led_ctrl" + status, output = log_os_system(cmd, 1) + if status: + print output + +def device_install(): + remove_install_status() + hw_adjustment() + check_base_bus() + set_led_control() + install_i2c_switch() + # add delay to make sure all switch is installed completely, + # so we can start install other slave device safely. + time.sleep(1) + install_i2c_device() + install_sfp() + update_hwmon() + restore_install_status() + return 0 + +def device_uninstall(): + global SFP_GROUPS + global I2C_DEVICES + global I2C_SWITCH_LIST + try: + with open(PLATFORM_INSTALL_INFO_FILE) as fd: + install_info = json.load(fd) + SFP_GROUPS = install_info[2] + I2C_DEVICES = install_info[1] + I2C_SWITCH_LIST = install_info[0] + uninstall_sfp() + uninstall_i2c_device() + uninstall_i2c_switch() + remove_install_status() + return 0 + except IOError as e: + print(e) + print("Platform install information file is not exist, please do install first") + return 1 + +i2c_prefix = '/sys/bus/i2c/devices/' + +def get_attr_value(attr_path): + retval = 'ERR' + if not os.path.isfile(attr_path): + return retval + + try: + with open(attr_path, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", attr_path, " file !") + + retval = retval.rstrip('\r\n') + fd.close() + return retval + +def get_hw_version(): + value = '' + filePath = '/sys/class/hwmon/hwmon2/device/ESQC610_SYS/hw_version' + if os.path.exists(filePath): + value = get_attr_value(filePath).split() + return value[-1] + else: + return None + + + +def bmc_is_exist(): + value = '' + bmc_filePath = '/sys/class/hwmon/hwmon2/device/ESQC610_BMC/bmc_present' + if os.path.exists(bmc_filePath): + value = get_attr_value(bmc_filePath) + if value.find('not') < 0: + return True + else: + return False + else: + return False + +def do_install(): + print "Checking system...." + if driver_check() == False: + print "No driver, installing...." + status = driver_install() + if status: + if FORCE == 0: + return status + else: + print PROJECT_NAME.upper() + " drivers detected...." + if not device_exist(): + print "No device, installing...." + status = device_install() + if status: + if FORCE == 0: + return status + else: + print PROJECT_NAME.upper() + " devices detected...." + return + + +def do_uninstall(): + print "Checking system...." + if not device_exist(): + print PROJECT_NAME.upper() + " has no device installed...." + else: + print "Removing device...." + status = device_uninstall() + if status: + + if FORCE == 0: + return status + + if driver_check() == False: + print PROJECT_NAME.upper() + " has no driver installed...." + else: + print "Removing installed driver...." + status = driver_uninstall() + if status: + if FORCE == 0: + return status + + return + +def devices_info(): + bus_list = [] + with open(PLATFORM_INSTALL_INFO_FILE) as fd: + install_info = json.load(fd) + for i in range(0,2): + for device_name in install_info[i].keys(): + device = install_info[i][device_name] + print("{} :".format(device_name)) + if device['parent'] in I2C_BASE_BUS: + print(" On Bus: {}".format(device['parent'])) + else: + print(" On Bus: i2c-{}".format(install_info[0][device['parent']]['bus_map'][device['parent_ch']])) + print(" i2c Address: {}".format(device['i2caddr'])) + print(" status: {}".format(device['status'])) + if device['status'] == 'INSTALLED': + print(" install path: {}".format(device['path'])) + if device.get('hwmon_path'): + print(" hwmon_path: {}".format(device['hwmon_path'])) + print(' ') + + for sfp_group_name in install_info[2].keys(): + bus_list = [] + sfp_group = install_info[2][sfp_group_name] + print("{} :".format(sfp_group_name)) + print(" sfp number: {}".format(sfp_group['number'])) + for n in range(0,sfp_group['number']): + bus_list.append("i2c-{}".format(install_info[0][sfp_group['parent']]['bus_map'][sfp_group['channels'][n]])) + print(" On Bus: {}".format(bus_list)) + print(" status: {}".format(sfp_group['status'])) + print(" install path: {}".format(', '.join(sfp_group['paths']))) + print(' ') + +def device_exist(): + ret1, log = log_os_system("ls " + i2c_prefix + "*0056", 0) + return not ret1 + + +if __name__ == "__main__": + main() diff --git a/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/utils/README b/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/utils/README new file mode 100755 index 0000000000..70b8653bc9 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/utils/README @@ -0,0 +1,2 @@ +Copyright (C) 2019 Cameo Networks, Inc. + diff --git a/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/utils/cameo_esqc610_sensors.py b/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/utils/cameo_esqc610_sensors.py new file mode 100755 index 0000000000..9a1e12ed1c --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/utils/cameo_esqc610_sensors.py @@ -0,0 +1,283 @@ +#!/usr/bin/python + +from __future__ import print_function +import os +import sys +import logging +import json + +MAX_FAN_NUM = 4 +MAX_PSU_NUM = 2 +PSU_LIST = ['PSU1','PSU2'] #0x58, 0x59 + +PLATFORM_INSTALL_INFO_FILE = '/etc/sonic/platform_install.json' + +FAN_SYSFILE_PATH = '/sys/class/hwmon/hwmon2/device/ESQC610_FAN/' +THERMAL_SYSFILE_PATH = '/sys/class/hwmon/hwmon2/device/ESQC610_Sensor/' +POWER_SYSFILE_PATH = '/sys/class/hwmon/hwmon2/device/ESQC610_PSU/' +BMC_SYSFILE_PATH = '/sys/class/hwmon/hwmon2/device/ESQC610_BMC/' + +def get_psu_path(): + """ + get psu path when without BMC control + """ + psu_path = [] + try: + with open(PLATFORM_INSTALL_INFO_FILE) as fd: + install_info = json.load(fd) + for psu_name in PSU_LIST: + psu = install_info[1][psu_name] + psu_path.append(psu['path']+'/') + return psu_path + except Exception: + print("Fail to get psu sysfsfile path") + + return psu_path + +def get_thermal_sensor_path(): + sensor_path = [] + try: + with open(PLATFORM_INSTALL_INFO_FILE) as fd: + install_info = json.load(fd) + for sensor_name in THERMAL_SENSOR_LIST: + sensor = install_info[1][sensor_name] + sensor_path.append(sensor['path']+'/') + return sensor_path + except Exception: + print("Fail to get sensor sysfsfile path") + + return sensor_path + +# Get sysfs attribute +def get_attr_value(attr_path): + retval = 'ERR' + if not os.path.isfile(attr_path): + return retval + + try: + with open(attr_path, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", attr_path, " file !") + + retval = retval.rstrip('\r\n') + fd.close() + return retval + +def bmc_is_exist(): + value = '' + if os.path.exists(BMC_SYSFILE_PATH+"bmc_present"): + value = get_attr_value(BMC_SYSFILE_PATH+"bmc_present") + if value.find('not') < 0: + return True + else: + return False + else: + return False + +def print_attr_value_lines(sys_path): + retval = 'ERR' + if not os.path.isfile(sys_path): + return retval + try: + fo = open(sys_path, "r") + except Exception as error: + logging.error("Unable to open ", sys_path, " file !") + for line in fo.readlines(): + line = line.strip() + print (" %s" % line) + fo.close() + return retval + +def sensors_status(): + if bmc_is_exist(): + print ('SENSOR STATUS:') + sys_path = THERMAL_SYSFILE_PATH + 'sensor_status' + print_attr_value_lines(sys_path) + + return + +def sensors_temp(): + if bmc_is_exist(): + print ('SENSOR TEMPERATURE:') + sys_path = BMC_SYSFILE_PATH + 'bmc_sersor_1' + print_attr_value_lines(sys_path) + sys_path = BMC_SYSFILE_PATH + 'bmc_sersor_2' + print_attr_value_lines(sys_path) + sys_path = BMC_SYSFILE_PATH + 'bmc_sersor_3' + print_attr_value_lines(sys_path) + sys_path = BMC_SYSFILE_PATH + 'bmc_sersor_4' + print_attr_value_lines(sys_path) + return + +def get_voltage(): + return + +def fan_status(): + sys_path = FAN_SYSFILE_PATH + 'fan_status' + print ('FAN STATUS:') + print_attr_value_lines(sys_path) + return + +def fan_present(): + sys_path = FAN_SYSFILE_PATH + 'fan_present' + print ('FAN PRESENT:') + print_attr_value_lines(sys_path) + return + +def fan_power(): + sys_path = FAN_SYSFILE_PATH + 'fan_power' + print ('FAN POWER:') + print_attr_value_lines(sys_path) + return + +def fan_speed(): + sys_path = FAN_SYSFILE_PATH + 'fan_speed_rpm' + print ('FAN SPEED:') + print_attr_value_lines(sys_path) + return + + +def is_psu_present(psu_number): + sys_path = POWER_SYSFILE_PATH + 'psu_present' + search_str = "PSU {} is present".format(psu_number) + if os.path.exists(sys_path): + value = get_attr_value(sys_path) + if search_str in value: + return True + else: + return False + + return False + +def show_psu_status(path): + # [model, vin, vout, fan_speed, temperature, pin, pout, iin, iout, max_iout] + result_list = [0]*10 + if bmc_is_exist(): + try: + reg_file = open(path, 'r') + except IOError as e: + print( "Error: unable to open file: %s" % str(e)) + return False + + text_lines = reg_file.readlines() + reg_file.close() + + for line in text_lines: + spline = line.split(' ') + if "MFR_MODEL" in spline: + result_list[0] = spline[-1] + if "VIN" in spline: + result_list[1] = spline[-1] + if "VOUT" in spline: + result_list[2] = spline[-1] + if "FAN_SPEED" in spline: + result_list[3] = spline[-1] + if "TEMP_1" in spline: + result_list[4] = spline[-1] + if "PIN" in spline: + result_list[5] = spline[-1] + if "POUT" in spline: + result_list[6] = spline[-1] + if "IIN" in spline: + result_list[7] = spline[-1] + if "IOUT" in spline: + result_list[8] = spline[-1] + if "MFR_IOUT_MAX" in spline: + result_list[9] = spline[-1] + + else: + result_list[0] = get_attr_value(path+"psu_mfr_model") + result_list[1] = get_attr_value(path+"psu_vin") + result_list[2] = get_attr_value(path+"psu_vout") + result_list[3] = get_attr_value(path+"psu_fan_speed_1") + result_list[4] = get_attr_value(path+"psu_temp_1") + result_list[5] = get_attr_value(path+"psu_pin") + result_list[6] = get_attr_value(path+"psu_pout") + result_list[7] = get_attr_value(path+"psu_iin") + result_list[8] = get_attr_value(path+"psu_iout") + result_list[9] = get_attr_value(path+"psu_iout_max") + if result_list[0] != 'ERR': + print (' model: {}'.format(result_list[0])) + + if result_list[1] != 'ERR': + vin = int(result_list[1])/1000.0 + print (' Input Voltage: {:+3.2f} V'.format(vin)) + + if result_list[2] != 'ERR': + vout = int(result_list[2])/1000.0 + print (' Output Voltage: {:+3.2f} V'.format(vout)) + + if result_list[3] != 'ERR': + fan_speed = int(result_list[3]) + print (' Fan Speed: {:3d} RPM'.format(fan_speed)) + + if result_list[4] != 'ERR': + temperature = int(result_list[4])/1000.0 + print (' Temperature: {:+3.1f} C'.format(temperature)) + + if result_list[5] != 'ERR': + pin = int(result_list[5])/1000000.0 + print (' Input Power: {:3.2f} W'.format(pin)) + + if result_list[6] != 'ERR': + pout = int(result_list[6])/1000000.0 + print (' Output Power: {:3.2f} W'.format(pout)) + + if result_list[7] != 'ERR': + iin = int(result_list[7])/1000.0 + print (' Input Current: {:+3.2f} A'.format(iin)) + + if result_list[8] != 'ERR': + iout = int(result_list[8])/1000.0 + print (' Output Current: {:+3.2f} A'.format(iout),end='') + + if result_list[9] != 'ERR': + max_iout = int(result_list[9])/1000.0 + print (' (max = {:+3.2f} A)'.format(max_iout)) + + print('') + return + +def psu_status(): + psu_path = [] + for x in range(0,MAX_PSU_NUM): + if is_psu_present(x+1): + print("PSU{} present".format(x+1)) + if bmc_is_exist(): + show_psu_status(POWER_SYSFILE_PATH + 'psu_module_{}'.format(x+1)) + else: + psu_path = get_psu_path() + show_psu_status(psu_path[x]) + + return + + +def main(): + """ + Usage: %(scriptName)s command object + + command: + fan_status : display fans status(present/power good) + """ + + if len(sys.argv)<2: + print (main.__doc__) + + for arg in sys.argv[1:]: + if arg == 'fan_status': + fan_status() + fan_present() + fan_power() + fan_speed() + elif arg == 'sensor_status': + sensors_temp() + sensors_status() + psu_status() + + + else: + print (main.__doc__) + +if __name__ == "__main__": + main() diff --git a/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/utils/cameo_esqc610_startup b/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/utils/cameo_esqc610_startup new file mode 100755 index 0000000000..c6474c7594 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/utils/cameo_esqc610_startup @@ -0,0 +1,17 @@ +#!/bin/bash + +start() { + # load platform driver, native drivers + /usr/local/bin/cameo_esqc610_util.py install + +} + +stop() { + /usr/local/bin/cameo_esqc610_util.py clean +} + + +case $1 in + start|stop) "$1" ;; +esac + diff --git a/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/utils/coldreboot b/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/utils/coldreboot new file mode 100755 index 0000000000..ec06c2897a --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/utils/coldreboot @@ -0,0 +1,9 @@ +#!/bin/sh +NOKEXECFILE=/no-kexec-reboot + +/bin/rm -f $NOKEXECFILE +touch $NOKEXECFILE + +rmmod x86-64-cameo-esqc610-56sq +i2cset -y 0 0x30 0xa1 0 + diff --git a/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/utils/halt b/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/utils/halt new file mode 100755 index 0000000000..868d7402c5 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/utils/halt @@ -0,0 +1,19 @@ +#!/bin/sh + +mr_reboot() { + + sudo rmmod x86-64-cameo-esqc610-56sq + sudo i2cset -y 0 0x30 0xa1 0 + +} + +if [ $# -eq 0 ] || [ $@ = "--halt" ] || [ $@ = "-f" ] || [ $@ = "--force" ]; then + #echo halt + sudo /sbin/halt +elif [ $@ = "-p" ] || [ $@ = "--reboot" ] || [ $@ = "--poweroff" ]; then + sync;sync + mr_reboot +else + echo "unsupported option" +fi + diff --git a/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/utils/poweroff b/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/utils/poweroff new file mode 100755 index 0000000000..5b1569702b --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/utils/poweroff @@ -0,0 +1,18 @@ +#!/bin/sh + +mr_reboot() { + + sudo rmmod x86-64-cameo-esqc610-56sq + sudo i2cset -y 0 0x30 0xa1 0 + +} + +if [ $# -eq 0 ] || [ $@ = "-p" ] || [ $@ = "--reboot" ] || [ $@ = "--poweroff" ] || [ $@ = "-f" ] || [ $@ = "--force" ]; then + sync;sync + mr_reboot +elif [ $@ = "--halt" ]; then + sudo halt +else + echo "unsupported option" +fi + diff --git a/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/utils/shutdown b/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/utils/shutdown new file mode 100755 index 0000000000..a0a29e4260 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cameo/esqc610-56sq/utils/shutdown @@ -0,0 +1,18 @@ +#!/bin/sh + +mr_reboot() { + + sudo rmmod x86-64-cameo-esqc610-56sq + sudo i2cset -y 0 0x30 0xa1 0 + +} + +if [ $# -eq 0 ] || [ $@ = "-r" ] || [ $@ = "--reboot" ] || [ $@ = "-h" ] || [ $@ = "-P" ] || [ $@ = "--poweroff" ]; then + sync;sync + mr_reboot +elif [ $@ = "-H" ] || [ $@ = "--halt" ]; then + sudo halt +else + echo "unsupported option" +fi + diff --git a/platform/innovium/sonic-platform-modules-wistron/LICENSE b/platform/innovium/sonic-platform-modules-wistron/LICENSE new file mode 100644 index 0000000000..c14238424a --- /dev/null +++ b/platform/innovium/sonic-platform-modules-wistron/LICENSE @@ -0,0 +1,16 @@ +Copyright (C) 2016 Microsoft, Inc +Copyright (C) 2019 Wistron Corporation + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/cfg/sw-to3200k-modules.conf b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/cfg/sw-to3200k-modules.conf new file mode 100644 index 0000000000..9c1102dfad --- /dev/null +++ b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/cfg/sw-to3200k-modules.conf @@ -0,0 +1,18 @@ +# /etc/modules: kernel modules to load at boot time. +# +# This file contains the names of kernel modules that should be loaded +# at boot time, one per line. Lines beginning with "#" are ignored. + +ipmi_msghandler +ipmi_si +ipmi_devintf +i2c_dev +at24 +wistron_i2c_psu +wistron_sw_to3200k_cpld +wistron_sw_to3200k_fan +wistron_sw_to3200k_leds +wistron_sw_to3200k_psu +wistron_sw_to3200k_oom +wistron_sw_to3200k_thermal + diff --git a/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/classes/__init__.py b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/classes/__init__.py new file mode 100755 index 0000000000..e69de29bb2 diff --git a/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/modules/Makefile b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/modules/Makefile new file mode 100644 index 0000000000..8303304141 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/modules/Makefile @@ -0,0 +1,20 @@ +ifneq ($(KERNELRELEASE),) +obj-m:= wistron_sw_to3200k_cpld.o wistron_sw_to3200k_fan.o \ + wistron_sw_to3200k_oom.o wistron_sw_to3200k_psu.o \ + wistron_sw_to3200k_thermal.o wistron_i2c_psu.o \ + wistron_sw_to3200k_leds.o +else +ifeq (,$(KERNEL_SRC)) +#$(error KERNEL_SRC is not defined) +KVERSION=3.16.0-8-amd64 +KERNEL_DIR = /usr/src/linux-headers-$(KVERSION)/ +KERNELDIR:=$(KERNEL_DIR) +else +KERNELDIR:=$(KERNEL_SRC) +endif +PWD:=$(shell pwd) +default: + $(MAKE) -C $(KERNELDIR) M=$(PWD) modules +clean: + rm -rf *.o *.mod.o *.mod.o *.ko .*cmd *.mod.c .tmp_versions Module.markers Module.symvers modules.order +endif diff --git a/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/modules/wistron_i2c_psu.c b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/modules/wistron_i2c_psu.c new file mode 100644 index 0000000000..746e581486 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/modules/wistron_i2c_psu.c @@ -0,0 +1,469 @@ +/* + * An hwmon driver for the Wistron Redundant Power Module + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRIVER_DESCRIPTION_NAME "wistron i2c psu driver" +#define MAX_FAN_DUTY_CYCLE 100 + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { I2C_CLIENT_END }; + +/* Each client has this additional data + */ +struct wistron_i2c_psu_data { + struct device *hwmon_dev; + struct mutex lock; + int v_in; + int v_out; + int i_in; + int i_out; + int p_in; + int p_out; + int temp_input; + int fan_fault; + int fan_duty_cycle; + int fan_speed; + int pmbus_revision; + u8 mfr_id[16]; + u8 mfr_model[16]; + u8 mfr_revsion[4]; + u8 mfr_serial[32]; +}; + +static ssize_t get_value(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t set_value(struct device *dev, struct device_attribute *da, const char *buf, size_t count); + +enum wistron_i2c_psu_sysfs_attributes { + PSU_V_IN, + PSU_V_OUT, + PSU_I_IN, + PSU_I_OUT, + PSU_P_IN, + PSU_P_OUT, + PSU_PMBUS_REVISION, + PSU_TEMP1_INPUT, + PSU_FAN1_FAULT, + PSU_FAN1_DUTY_CYCLE, + PSU_FAN1_SPEED, + PSU_MFR_ID, + PSU_MFR_MODEL, + PSU_MFR_REVISION, + PSU_MFR_SERIAL, +}; + +/* sysfs attributes for hwmon + */ +static SENSOR_DEVICE_ATTR(psu_v_in, S_IWUSR | S_IRUGO, get_value, set_value, PSU_V_IN); +static SENSOR_DEVICE_ATTR(psu_v_out, S_IWUSR | S_IRUGO, get_value, set_value, PSU_V_OUT); +static SENSOR_DEVICE_ATTR(psu_i_in, S_IWUSR | S_IRUGO, get_value, set_value, PSU_I_IN); +static SENSOR_DEVICE_ATTR(psu_i_out, S_IWUSR | S_IRUGO, get_value, set_value, PSU_I_OUT); +static SENSOR_DEVICE_ATTR(psu_p_in, S_IWUSR | S_IRUGO, get_value, set_value, PSU_P_IN); +static SENSOR_DEVICE_ATTR(psu_p_out, S_IWUSR | S_IRUGO, get_value, set_value, PSU_P_OUT); +static SENSOR_DEVICE_ATTR(psu_pmbus_revision, S_IWUSR | S_IRUGO, get_value, set_value, PSU_PMBUS_REVISION); +static SENSOR_DEVICE_ATTR(psu_temp1_input, S_IWUSR | S_IRUGO, get_value, set_value, PSU_TEMP1_INPUT); +static SENSOR_DEVICE_ATTR(psu_fan1_fault, S_IWUSR | S_IRUGO, get_value, set_value, PSU_FAN1_FAULT); +static SENSOR_DEVICE_ATTR(psu_fan1_duty_cycle, S_IWUSR | S_IRUGO, get_value, set_value, PSU_FAN1_DUTY_CYCLE); +static SENSOR_DEVICE_ATTR(psu_fan1_speed_rpm, S_IWUSR | S_IRUGO, get_value, set_value, PSU_FAN1_SPEED); +static SENSOR_DEVICE_ATTR(psu_mfr_id, S_IWUSR | S_IRUGO, get_value, set_value, PSU_MFR_ID); +static SENSOR_DEVICE_ATTR(psu_mfr_model, S_IWUSR | S_IRUGO, get_value, set_value, PSU_MFR_MODEL); +static SENSOR_DEVICE_ATTR(psu_mfr_revision, S_IWUSR | S_IRUGO, get_value, set_value, PSU_MFR_REVISION); +static SENSOR_DEVICE_ATTR(psu_mfr_serial, S_IWUSR | S_IRUGO, get_value, set_value, PSU_MFR_SERIAL); + +/*Duplicate nodes for lm-sensors.*/ +static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, get_value, NULL, PSU_V_OUT); +static SENSOR_DEVICE_ATTR(curr2_input, S_IRUGO, get_value, NULL, PSU_I_OUT); +static SENSOR_DEVICE_ATTR(power2_input, S_IRUGO, get_value, NULL, PSU_P_OUT); +static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, get_value, NULL, PSU_TEMP1_INPUT); +static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, get_value, NULL, PSU_FAN1_SPEED); + +static struct attribute *wistron_i2c_psu_attributes[] = { + &sensor_dev_attr_psu_v_in.dev_attr.attr, + &sensor_dev_attr_psu_v_out.dev_attr.attr, + &sensor_dev_attr_psu_i_in.dev_attr.attr, + &sensor_dev_attr_psu_i_out.dev_attr.attr, + &sensor_dev_attr_psu_p_in.dev_attr.attr, + &sensor_dev_attr_psu_p_out.dev_attr.attr, + &sensor_dev_attr_psu_pmbus_revision.dev_attr.attr, + &sensor_dev_attr_psu_temp1_input.dev_attr.attr, + &sensor_dev_attr_psu_fan1_fault.dev_attr.attr, + &sensor_dev_attr_psu_fan1_duty_cycle.dev_attr.attr, + &sensor_dev_attr_psu_fan1_speed_rpm.dev_attr.attr, + &sensor_dev_attr_psu_mfr_id.dev_attr.attr, + &sensor_dev_attr_psu_mfr_model.dev_attr.attr, + &sensor_dev_attr_psu_mfr_revision.dev_attr.attr, + &sensor_dev_attr_psu_mfr_serial.dev_attr.attr, + /*Duplicate nodes for lm-sensors.*/ + &sensor_dev_attr_curr2_input.dev_attr.attr, + &sensor_dev_attr_in3_input.dev_attr.attr, + &sensor_dev_attr_power2_input.dev_attr.attr, + &sensor_dev_attr_temp1_input.dev_attr.attr, + &sensor_dev_attr_fan1_input.dev_attr.attr, + NULL +}; + +static ssize_t get_value(struct device *dev, struct device_attribute *da, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct wistron_i2c_psu_data *data = i2c_get_clientdata(client); + size_t ret_count=0; + + mutex_lock(&data->lock); + switch (attr->index) + { + case PSU_V_IN: + { + ret_count = sprintf(buf, "%d", data->v_in); + break; + } + case PSU_V_OUT: + { + ret_count = sprintf(buf, "%d", data->v_out); + break; + } + case PSU_I_IN: + { + ret_count = sprintf(buf, "%d", data->i_in); + break; + } + case PSU_I_OUT: + { + ret_count = sprintf(buf, "%d", data->i_out); + break; + } + case PSU_P_IN: + { + ret_count = sprintf(buf, "%d", data->p_in); + break; + } + case PSU_P_OUT: + { + ret_count = sprintf(buf, "%d", data->p_out); + break; + } + case PSU_PMBUS_REVISION: + { + ret_count = sprintf(buf, "%d", data->pmbus_revision); + break; + } + case PSU_TEMP1_INPUT: + { + ret_count = sprintf(buf, "%d", data->temp_input); + break; + } + case PSU_FAN1_FAULT: + { + ret_count = sprintf(buf, "%d", data->fan_fault); + break; + } + case PSU_FAN1_DUTY_CYCLE: + { + ret_count = sprintf(buf, "%d", data->fan_duty_cycle); + break; + } + case PSU_FAN1_SPEED: + { + ret_count = sprintf(buf, "%d", data->fan_speed); + break; + } + case PSU_MFR_ID: + { + ret_count = sprintf(buf, "%s", data->mfr_id); + break; + } + case PSU_MFR_MODEL: + { + ret_count = sprintf(buf, "%s", data->mfr_model); + break; + } + case PSU_MFR_REVISION: + { + ret_count = sprintf(buf, "%s", data->mfr_revsion); + break; + } + case PSU_MFR_SERIAL: + { + ret_count = sprintf(buf, "%s", data->mfr_serial); + break; + } + default: + break; + } + mutex_unlock(&data->lock); + return ret_count; +} + +static ssize_t set_value +( + struct device *dev, + struct device_attribute *da, + const char *buf, + size_t count +) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct wistron_i2c_psu_data *data = i2c_get_clientdata(client); + int error, value; + + mutex_lock(&data->lock); + + switch (attr->index) + { + case PSU_V_IN: + { + error = kstrtoint(buf, 10, &data->v_in); + if (error) + { + goto exit_err; + } + + break; + } + case PSU_V_OUT: + { + error = kstrtoint(buf, 10, &data->v_out); + if (error) + { + goto exit_err; + } + + break; + } + case PSU_I_IN: + { + error = kstrtoint(buf, 10, &data->i_in); + if (error) + { + goto exit_err; + } + + break; + } + case PSU_I_OUT: + { + error = kstrtoint(buf, 10, &data->i_out); + if (error) + { + goto exit_err; + } + + break; + } + case PSU_P_IN: + { + error = kstrtoint(buf, 10, &data->p_in); + if (error) + { + goto exit_err; + } + + break; + } + case PSU_P_OUT: + { + error = kstrtoint(buf, 10, &data->p_out); + if (error) + { + goto exit_err; + } + + break; + } + case PSU_PMBUS_REVISION: + { + error = kstrtoint(buf, 10, &data->pmbus_revision); + if (error) + { + goto exit_err; + } + + break; + } + case PSU_TEMP1_INPUT: + { + error = kstrtoint(buf, 10, &data->temp_input); + if (error) + { + goto exit_err; + } + + break; + } + case PSU_FAN1_FAULT: + { + error = kstrtoint(buf, 10, &data->fan_fault); + if (error) + { + goto exit_err; + } + + break; + } + case PSU_FAN1_DUTY_CYCLE: + { + error = kstrtoint(buf, 10, &value); + if (error) + { + goto exit_err; + } + + if (value < 0 || value > MAX_FAN_DUTY_CYCLE) + { + error = -EINVAL; + goto exit_err; + } + + data->fan_duty_cycle = value; + break; + } + case PSU_FAN1_SPEED: + { + error = kstrtoint(buf, 10, &data->fan_speed); + if (error) + { + goto exit_err; + } + + break; + } + case PSU_MFR_ID: + { + memset(&data->mfr_id, 0x0, sizeof(data->mfr_id)); + strncpy(data->mfr_id, buf, sizeof(data->mfr_id)-1); + break; + } + case PSU_MFR_MODEL: + { + memset(&data->mfr_model, 0x0, sizeof(data->mfr_model)); + strncpy(data->mfr_model, buf, sizeof(data->mfr_model)-1); + break; + } + case PSU_MFR_REVISION: + { + memset(&data->mfr_revsion, 0x0, sizeof(data->mfr_revsion)); + strncpy(data->mfr_revsion, buf, sizeof(data->mfr_revsion)-1); + break; + } + case PSU_MFR_SERIAL: + { + memset(&data->mfr_serial, 0x0, sizeof(data->mfr_serial)); + strncpy(data->mfr_serial, buf, sizeof(data->mfr_serial)-1); + break; + } + default: + break; + } + + mutex_unlock(&data->lock); + return count; + +exit_err: + mutex_unlock(&data->lock); + return error; +} + +static const struct attribute_group wistron_i2c_psu_group = { + .attrs = wistron_i2c_psu_attributes, +}; + +static int wistron_i2c_psu_probe(struct i2c_client *client, const struct i2c_device_id *dev_id) +{ + struct wistron_i2c_psu_data *data; + int status; + + data = kzalloc(sizeof(struct wistron_i2c_psu_data), GFP_KERNEL); + if (!data) + { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + mutex_init(&data->lock); + dev_info(&client->dev, "device found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &wistron_i2c_psu_group); + if (status) + { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) + { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: psu '%s'\n", dev_name(data->hwmon_dev), client->name); + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &wistron_i2c_psu_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int wistron_i2c_psu_remove(struct i2c_client *client) +{ + struct wistron_i2c_psu_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &wistron_i2c_psu_group); + kfree(data); + return 0; +} + +/* Support psu moduel + */ +static const struct i2c_device_id wistron_i2c_psu_id[] = { + { "acbel_fshxxx", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, wistron_i2c_psu_id); + +static struct i2c_driver wistron_i2c_psu_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "wistron_i2c_psu", + }, + .probe = wistron_i2c_psu_probe, + .remove = wistron_i2c_psu_remove, + .id_table = wistron_i2c_psu_id, + .address_list = normal_i2c, +}; + +static int __init wistron_i2c_psu_init(void) +{ + return i2c_add_driver(&wistron_i2c_psu_driver); +} + +static void __exit wistron_i2c_psu_exit(void) +{ + i2c_del_driver(&wistron_i2c_psu_driver); +} + +MODULE_AUTHOR("Haowei Chung "); +MODULE_DESCRIPTION(DRIVER_DESCRIPTION_NAME); +MODULE_LICENSE("GPL"); + +module_init(wistron_i2c_psu_init); +module_exit(wistron_i2c_psu_exit); diff --git a/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/modules/wistron_sw_to3200k_cpld.c b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/modules/wistron_sw_to3200k_cpld.c new file mode 100644 index 0000000000..52f659eae2 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/modules/wistron_sw_to3200k_cpld.c @@ -0,0 +1,701 @@ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define PORT_NUM 32 +#define SYSLED_NUM 5 +#define SW_TO3200K_FPGA_ADDR 0x60 + +static LIST_HEAD(cpld_client_list); +static struct mutex list_lock; + +struct cpld_client_node { + struct i2c_client *client; + struct list_head list; +}; + +enum cpld_type { + sw_to3200k_fpga, + sw_to3200k_cpld1, + sw_to3200k_cpld2 +}; + +struct sw_to3200k_cpld_data { + enum cpld_type type; + struct device *hwmon_dev; + struct mutex lock; + int version; + int sysled_status[SYSLED_NUM]; + int present[PORT_NUM]; + int reset[PORT_NUM]; +}; + +static const struct i2c_device_id sw_to3200k_cpld_id[] = { + { "sw_to3200k_fpga", sw_to3200k_fpga }, + { "sw_to3200k_cpld1", sw_to3200k_cpld1 }, + { "sw_to3200k_cpld2", sw_to3200k_cpld2 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, sw_to3200k_cpld_id); + +#define TRANSCEIVER_PRESENT_ATTR_ID(index) MODULE_PRESENT_##index +#define TRANSCEIVER_RESET_ATTR_ID(index) MODULE_RESET_##index + +enum sw_to3200k_cpld_sysfs_attributes { + /* chip version */ + CPLD_VERSION, + /* system led */ + SYSTEM_LED_LOC, + SYSTEM_LED_DIAG, + SYSTEM_LED_FAN, + SYSTEM_LED_PSU1, + SYSTEM_LED_PSU2, + /* transceiver attributes */ + TRANSCEIVER_PRESENT_ATTR_ID(1), + TRANSCEIVER_PRESENT_ATTR_ID(2), + TRANSCEIVER_PRESENT_ATTR_ID(3), + TRANSCEIVER_PRESENT_ATTR_ID(4), + TRANSCEIVER_PRESENT_ATTR_ID(5), + TRANSCEIVER_PRESENT_ATTR_ID(6), + TRANSCEIVER_PRESENT_ATTR_ID(7), + TRANSCEIVER_PRESENT_ATTR_ID(8), + TRANSCEIVER_PRESENT_ATTR_ID(9), + TRANSCEIVER_PRESENT_ATTR_ID(10), + TRANSCEIVER_PRESENT_ATTR_ID(11), + TRANSCEIVER_PRESENT_ATTR_ID(12), + TRANSCEIVER_PRESENT_ATTR_ID(13), + TRANSCEIVER_PRESENT_ATTR_ID(14), + TRANSCEIVER_PRESENT_ATTR_ID(15), + TRANSCEIVER_PRESENT_ATTR_ID(16), + TRANSCEIVER_PRESENT_ATTR_ID(17), + TRANSCEIVER_PRESENT_ATTR_ID(18), + TRANSCEIVER_PRESENT_ATTR_ID(19), + TRANSCEIVER_PRESENT_ATTR_ID(20), + TRANSCEIVER_PRESENT_ATTR_ID(21), + TRANSCEIVER_PRESENT_ATTR_ID(22), + TRANSCEIVER_PRESENT_ATTR_ID(23), + TRANSCEIVER_PRESENT_ATTR_ID(24), + TRANSCEIVER_PRESENT_ATTR_ID(25), + TRANSCEIVER_PRESENT_ATTR_ID(26), + TRANSCEIVER_PRESENT_ATTR_ID(27), + TRANSCEIVER_PRESENT_ATTR_ID(28), + TRANSCEIVER_PRESENT_ATTR_ID(29), + TRANSCEIVER_PRESENT_ATTR_ID(30), + TRANSCEIVER_PRESENT_ATTR_ID(31), + TRANSCEIVER_PRESENT_ATTR_ID(32), + TRANSCEIVER_RESET_ATTR_ID(1), + TRANSCEIVER_RESET_ATTR_ID(2), + TRANSCEIVER_RESET_ATTR_ID(3), + TRANSCEIVER_RESET_ATTR_ID(4), + TRANSCEIVER_RESET_ATTR_ID(5), + TRANSCEIVER_RESET_ATTR_ID(6), + TRANSCEIVER_RESET_ATTR_ID(7), + TRANSCEIVER_RESET_ATTR_ID(8), + TRANSCEIVER_RESET_ATTR_ID(9), + TRANSCEIVER_RESET_ATTR_ID(10), + TRANSCEIVER_RESET_ATTR_ID(11), + TRANSCEIVER_RESET_ATTR_ID(12), + TRANSCEIVER_RESET_ATTR_ID(13), + TRANSCEIVER_RESET_ATTR_ID(14), + TRANSCEIVER_RESET_ATTR_ID(15), + TRANSCEIVER_RESET_ATTR_ID(16), + TRANSCEIVER_RESET_ATTR_ID(17), + TRANSCEIVER_RESET_ATTR_ID(18), + TRANSCEIVER_RESET_ATTR_ID(19), + TRANSCEIVER_RESET_ATTR_ID(20), + TRANSCEIVER_RESET_ATTR_ID(21), + TRANSCEIVER_RESET_ATTR_ID(22), + TRANSCEIVER_RESET_ATTR_ID(23), + TRANSCEIVER_RESET_ATTR_ID(24), + TRANSCEIVER_RESET_ATTR_ID(25), + TRANSCEIVER_RESET_ATTR_ID(26), + TRANSCEIVER_RESET_ATTR_ID(27), + TRANSCEIVER_RESET_ATTR_ID(28), + TRANSCEIVER_RESET_ATTR_ID(29), + TRANSCEIVER_RESET_ATTR_ID(30), + TRANSCEIVER_RESET_ATTR_ID(31), + TRANSCEIVER_RESET_ATTR_ID(32), +}; + +/* sysfs attributes for hwmon */ +static ssize_t get_status(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t set_status(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t get_version(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t set_version(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t get_mode_reset(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t set_mode_reset(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t get_led_status(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t set_led_status(struct device *dev, struct device_attribute *da, const char *buf, size_t count); + +/* version */ +static SENSOR_DEVICE_ATTR(version, S_IWUSR | S_IRUGO, get_version, set_version, CPLD_VERSION); + +/* system led */ +static SENSOR_DEVICE_ATTR(sys_led_loc, S_IWUSR | S_IRUGO, get_led_status, set_led_status, SYSTEM_LED_LOC); +static SENSOR_DEVICE_ATTR(sys_led_diag, S_IWUSR | S_IRUGO, get_led_status, set_led_status, SYSTEM_LED_DIAG); +static SENSOR_DEVICE_ATTR(sys_led_fan, S_IWUSR | S_IRUGO, get_led_status, set_led_status, SYSTEM_LED_FAN); +static SENSOR_DEVICE_ATTR(sys_led_psu1, S_IWUSR | S_IRUGO, get_led_status, set_led_status, SYSTEM_LED_PSU1); +static SENSOR_DEVICE_ATTR(sys_led_psu2, S_IWUSR | S_IRUGO, get_led_status, set_led_status, SYSTEM_LED_PSU2); + +/* transceiver attributes */ +#define DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(index) \ + static SENSOR_DEVICE_ATTR(module_present_##index, S_IWUSR | S_IRUGO, get_status, set_status, MODULE_PRESENT_##index) +#define DECLARE_TRANSCEIVER_PRESENT_ATTR(index) &sensor_dev_attr_module_present_##index.dev_attr.attr + +/*reset*/ +#define DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(index) \ + static SENSOR_DEVICE_ATTR(module_reset_##index, S_IWUSR | S_IRUGO, get_mode_reset, set_mode_reset, MODULE_RESET_##index) +#define DECLARE_TRANSCEIVER_RESET_ATTR(index) &sensor_dev_attr_module_reset_##index.dev_attr.attr + +/* transceiver attributes */ +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(1); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(2); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(3); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(4); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(5); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(6); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(7); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(8); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(9); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(10); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(11); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(12); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(13); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(14); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(15); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(16); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(17); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(18); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(19); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(20); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(21); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(22); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(23); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(24); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(25); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(26); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(27); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(28); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(29); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(30); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(31); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(32); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(1); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(2); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(3); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(4); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(5); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(6); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(7); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(8); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(9); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(10); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(11); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(12); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(13); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(14); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(15); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(16); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(17); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(18); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(19); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(20); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(21); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(22); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(23); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(24); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(25); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(26); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(27); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(28); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(29); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(30); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(31); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(32); + +static struct attribute *sw_to3200k_fpga_attributes[] = { + &sensor_dev_attr_version.dev_attr.attr, + &sensor_dev_attr_sys_led_loc.dev_attr.attr, + &sensor_dev_attr_sys_led_diag.dev_attr.attr, + &sensor_dev_attr_sys_led_fan.dev_attr.attr, + &sensor_dev_attr_sys_led_psu1.dev_attr.attr, + &sensor_dev_attr_sys_led_psu2.dev_attr.attr, + NULL +}; + +static const struct attribute_group sw_to3200k_fpga_group = { + .attrs = sw_to3200k_fpga_attributes, +}; + +static struct attribute *sw_to3200k_cpld1_attributes[] = { + &sensor_dev_attr_version.dev_attr.attr, + DECLARE_TRANSCEIVER_PRESENT_ATTR(1), + DECLARE_TRANSCEIVER_PRESENT_ATTR(2), + DECLARE_TRANSCEIVER_PRESENT_ATTR(3), + DECLARE_TRANSCEIVER_PRESENT_ATTR(4), + DECLARE_TRANSCEIVER_PRESENT_ATTR(5), + DECLARE_TRANSCEIVER_PRESENT_ATTR(6), + DECLARE_TRANSCEIVER_PRESENT_ATTR(7), + DECLARE_TRANSCEIVER_PRESENT_ATTR(8), + DECLARE_TRANSCEIVER_PRESENT_ATTR(9), + DECLARE_TRANSCEIVER_PRESENT_ATTR(10), + DECLARE_TRANSCEIVER_PRESENT_ATTR(11), + DECLARE_TRANSCEIVER_PRESENT_ATTR(12), + DECLARE_TRANSCEIVER_PRESENT_ATTR(13), + DECLARE_TRANSCEIVER_PRESENT_ATTR(14), + DECLARE_TRANSCEIVER_PRESENT_ATTR(15), + DECLARE_TRANSCEIVER_PRESENT_ATTR(16), + DECLARE_TRANSCEIVER_RESET_ATTR(1), + DECLARE_TRANSCEIVER_RESET_ATTR(2), + DECLARE_TRANSCEIVER_RESET_ATTR(3), + DECLARE_TRANSCEIVER_RESET_ATTR(4), + DECLARE_TRANSCEIVER_RESET_ATTR(5), + DECLARE_TRANSCEIVER_RESET_ATTR(6), + DECLARE_TRANSCEIVER_RESET_ATTR(7), + DECLARE_TRANSCEIVER_RESET_ATTR(8), + DECLARE_TRANSCEIVER_RESET_ATTR(9), + DECLARE_TRANSCEIVER_RESET_ATTR(10), + DECLARE_TRANSCEIVER_RESET_ATTR(11), + DECLARE_TRANSCEIVER_RESET_ATTR(12), + DECLARE_TRANSCEIVER_RESET_ATTR(13), + DECLARE_TRANSCEIVER_RESET_ATTR(14), + DECLARE_TRANSCEIVER_RESET_ATTR(15), + DECLARE_TRANSCEIVER_RESET_ATTR(16), + NULL +}; + +static const struct attribute_group sw_to3200k_cpld1_group = { + .attrs = sw_to3200k_cpld1_attributes, +}; + +static struct attribute *sw_to3200k_cpld2_attributes[] = { + &sensor_dev_attr_version.dev_attr.attr, + DECLARE_TRANSCEIVER_PRESENT_ATTR(17), + DECLARE_TRANSCEIVER_PRESENT_ATTR(18), + DECLARE_TRANSCEIVER_PRESENT_ATTR(19), + DECLARE_TRANSCEIVER_PRESENT_ATTR(20), + DECLARE_TRANSCEIVER_PRESENT_ATTR(21), + DECLARE_TRANSCEIVER_PRESENT_ATTR(22), + DECLARE_TRANSCEIVER_PRESENT_ATTR(23), + DECLARE_TRANSCEIVER_PRESENT_ATTR(24), + DECLARE_TRANSCEIVER_PRESENT_ATTR(25), + DECLARE_TRANSCEIVER_PRESENT_ATTR(26), + DECLARE_TRANSCEIVER_PRESENT_ATTR(27), + DECLARE_TRANSCEIVER_PRESENT_ATTR(28), + DECLARE_TRANSCEIVER_PRESENT_ATTR(29), + DECLARE_TRANSCEIVER_PRESENT_ATTR(30), + DECLARE_TRANSCEIVER_PRESENT_ATTR(31), + DECLARE_TRANSCEIVER_PRESENT_ATTR(32), + DECLARE_TRANSCEIVER_RESET_ATTR(17), + DECLARE_TRANSCEIVER_RESET_ATTR(18), + DECLARE_TRANSCEIVER_RESET_ATTR(19), + DECLARE_TRANSCEIVER_RESET_ATTR(20), + DECLARE_TRANSCEIVER_RESET_ATTR(21), + DECLARE_TRANSCEIVER_RESET_ATTR(22), + DECLARE_TRANSCEIVER_RESET_ATTR(23), + DECLARE_TRANSCEIVER_RESET_ATTR(24), + DECLARE_TRANSCEIVER_RESET_ATTR(25), + DECLARE_TRANSCEIVER_RESET_ATTR(26), + DECLARE_TRANSCEIVER_RESET_ATTR(27), + DECLARE_TRANSCEIVER_RESET_ATTR(28), + DECLARE_TRANSCEIVER_RESET_ATTR(29), + DECLARE_TRANSCEIVER_RESET_ATTR(30), + DECLARE_TRANSCEIVER_RESET_ATTR(31), + DECLARE_TRANSCEIVER_RESET_ATTR(32), + NULL +}; + +static const struct attribute_group sw_to3200k_cpld2_group = { + .attrs = sw_to3200k_cpld2_attributes, +}; + +static ssize_t get_status(struct device *dev, struct device_attribute *da, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct sw_to3200k_cpld_data *data = i2c_get_clientdata(client); + int update_idx, status = 0; + + update_idx = attr->index - MODULE_PRESENT_1; + mutex_lock(&data->lock); + status = data->present[update_idx]; + mutex_unlock(&data->lock); + return sprintf(buf, "%d", status); +} + +static ssize_t set_status +( + struct device *dev, + struct device_attribute *da, + const char *buf, + size_t count +) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct sw_to3200k_cpld_data *data = i2c_get_clientdata(client); + long status=0; + int update_idx, error; + + error = kstrtol(buf, 10, &status); + if (error) + { + return error; + } + + update_idx = attr->index - MODULE_PRESENT_1; + mutex_lock(&data->lock); + data->present[update_idx] = status; + mutex_unlock(&data->lock); + return count; +} + +static ssize_t get_version(struct device *dev, struct device_attribute *da, char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sw_to3200k_cpld_data *data = i2c_get_clientdata(client); + int version; + + mutex_lock(&data->lock); + version = data->version; + mutex_unlock(&data->lock); + return sprintf(buf, "%d", version); +} + +static ssize_t set_version +( + struct device *dev, + struct device_attribute *da, + const char *buf, + size_t count +) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sw_to3200k_cpld_data *data = i2c_get_clientdata(client); + int error, version; + + error = kstrtoint(buf, 10, &version); + if (error) + { + return error; + } + + mutex_lock(&data->lock); + data->version = version; + mutex_unlock(&data->lock); + return count; +} + +static ssize_t get_mode_reset(struct device *dev, struct device_attribute *da, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct sw_to3200k_cpld_data *data = i2c_get_clientdata(client); + int update_idx, reset = 0; + + update_idx = attr->index - MODULE_RESET_1; + mutex_lock(&data->lock); + reset = data->reset[update_idx]; + mutex_unlock(&data->lock); + return sprintf(buf, "%d", reset); +} + +static ssize_t set_mode_reset(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct sw_to3200k_cpld_data *data = i2c_get_clientdata(client); + int error, reset; + int update_idx; + + error = kstrtoint(buf, 10, &reset); + if (error) + { + return error; + } + + update_idx = attr->index - MODULE_RESET_1; + mutex_lock(&data->lock); + data->reset[update_idx] = reset; + mutex_unlock(&data->lock); + return count; +} + +static ssize_t get_led_status(struct device *dev, struct device_attribute *da, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct sw_to3200k_cpld_data *data = i2c_get_clientdata(client); + int update_idx, status = 0; + + update_idx = attr->index - SYSTEM_LED_LOC; + mutex_lock(&data->lock); + status = data->sysled_status[update_idx]; + mutex_unlock(&data->lock); + return sprintf(buf, "%d", status); +} + +static ssize_t set_led_status +( + struct device *dev, + struct device_attribute *da, + const char *buf, + size_t count +) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct sw_to3200k_cpld_data *data = i2c_get_clientdata(client); + int error, status; + int update_idx; + + error = kstrtoint(buf, 10, &status); + if (error) + { + return error; + } + + update_idx = attr->index - SYSTEM_LED_LOC; + mutex_lock(&data->lock); + data->sysled_status[update_idx] = status; + mutex_unlock(&data->lock); + return count; +} + +static int get_led_status_internal(struct i2c_client *client, int led_type) +{ + struct sw_to3200k_cpld_data *data = i2c_get_clientdata(client); + int status = 0; + + mutex_lock(&data->lock); + status = data->sysled_status[led_type]; + mutex_unlock(&data->lock); + return status; +} + +static int set_led_status_internal(struct i2c_client *client, int led_type, int light_mode) +{ + struct sw_to3200k_cpld_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->lock); + data->sysled_status[led_type] = light_mode; + mutex_unlock(&data->lock); + return 0; +} + +static void sw_to3200k_cpld_add_client(struct i2c_client *client) +{ + struct cpld_client_node *node = kzalloc(sizeof(struct cpld_client_node), GFP_KERNEL); + + if (!node) + { + dev_dbg(&client->dev, "Can't allocate cpld_client_node (0x%x)\n", client->addr); + return; + } + + node->client = client; + + mutex_lock(&list_lock); + list_add(&node->list, &cpld_client_list); + mutex_unlock(&list_lock); +} + +static void sw_to3200k_cpld_remove_client(struct i2c_client *client) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int found = 0; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client == client) + { + found = 1; + break; + } + } + + if (found) + { + list_del(list_node); + kfree(cpld_node); + } + + mutex_unlock(&list_lock); +} + +/* + * I2C init/probing/exit functions + */ +static int sw_to3200k_cpld_probe(struct i2c_client *client, const struct i2c_device_id *id) +{ + struct sw_to3200k_cpld_data *data; + int ret = -ENODEV; + const struct attribute_group *group = NULL; + + data = kzalloc(sizeof(struct sw_to3200k_cpld_data), GFP_KERNEL); + if (!data) + { + ret = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + mutex_init(&data->lock); + data->type = id->driver_data; + + /* Register sysfs hooks */ + switch (data->type) + { + case sw_to3200k_fpga: + group = &sw_to3200k_fpga_group; + break; + case sw_to3200k_cpld1: + group = &sw_to3200k_cpld1_group; + break; + case sw_to3200k_cpld2: + group = &sw_to3200k_cpld2_group; + break; + default: + break; + } + + if (group) + { + ret = sysfs_create_group(&client->dev.kobj, group); + if (ret) + { + goto exit_free; + } + } + + sw_to3200k_cpld_add_client(client); + return 0; + +exit_free: + kfree(data); +exit: + return ret; +} + +static int sw_to3200k_cpld_remove(struct i2c_client *client) +{ + struct sw_to3200k_cpld_data *data = i2c_get_clientdata(client); + const struct attribute_group *group = NULL; + + sw_to3200k_cpld_remove_client(client); + + /* Remove sysfs hooks */ + switch (data->type) + { + case sw_to3200k_fpga: + group = &sw_to3200k_fpga_group; + break; + case sw_to3200k_cpld1: + group = &sw_to3200k_cpld1_group; + break; + case sw_to3200k_cpld2: + group = &sw_to3200k_cpld2_group; + break; + default: + break; + } + + if (group) + { + sysfs_remove_group(&client->dev.kobj, group); + } + + kfree(data); + return 0; +} + +int sw_to3200k_fpga_sysled_get(int led_type) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EPERM; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client->addr == SW_TO3200K_FPGA_ADDR) { + ret = get_led_status_internal(cpld_node->client, led_type); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(sw_to3200k_fpga_sysled_get); + +int sw_to3200k_fpga_sysled_set(int led_type, int light_mode) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EIO; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client->addr == SW_TO3200K_FPGA_ADDR) { + ret = set_led_status_internal(cpld_node->client, led_type, light_mode); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(sw_to3200k_fpga_sysled_set); + +static struct i2c_driver sw_to3200k_cpld_driver = { + .driver = { + .name = "sw_to3200k_cpld", + .owner = THIS_MODULE, + }, + .probe = sw_to3200k_cpld_probe, + .remove = sw_to3200k_cpld_remove, + .id_table = sw_to3200k_cpld_id, +}; + +static int __init sw_to3200k_cpld_init(void) +{ + mutex_init(&list_lock); + return i2c_add_driver(&sw_to3200k_cpld_driver); +} + +static void __exit sw_to3200k_cpld_exit(void) +{ + i2c_del_driver(&sw_to3200k_cpld_driver); +} + +MODULE_AUTHOR("Haowei Chung "); +MODULE_DESCRIPTION("Wistron I2C CPLD driver"); +MODULE_LICENSE("GPL"); + +module_init(sw_to3200k_cpld_init); +module_exit(sw_to3200k_cpld_exit); + diff --git a/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/modules/wistron_sw_to3200k_fan.c b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/modules/wistron_sw_to3200k_fan.c new file mode 100644 index 0000000000..82dfa71b78 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/modules/wistron_sw_to3200k_fan.c @@ -0,0 +1,299 @@ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRVNAME "sw_to3200k_fan" + +static ssize_t get_fan_value(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t set_fan_value(struct device *dev, struct device_attribute *da, const char *buf, size_t count); + +enum fan_id { + FAN1_ID, + FAN2_ID, + FAN3_ID, + FAN4_ID, + FAN5_ID, + FAN6_ID, + FAN7_ID +}; + +enum sysfs_fan_attributes { + FAN_DUTY_CYCLE_PERCENTAGE, /* Only one CPLD register to control duty cycle for all fans */ + FAN1_PRESENCE, + FAN2_PRESENCE, + FAN3_PRESENCE, + FAN4_PRESENCE, + FAN5_PRESENCE, + FAN6_PRESENCE, + FAN7_PRESENCE, + FAN1_ENABLE, + FAN2_ENABLE, + FAN3_ENABLE, + FAN4_ENABLE, + FAN5_ENABLE, + FAN6_ENABLE, + FAN7_ENABLE, + FAN1_DIRECTION, + FAN2_DIRECTION, + FAN3_DIRECTION, + FAN4_DIRECTION, + FAN5_DIRECTION, + FAN6_DIRECTION, + FAN7_DIRECTION, + FAN1_FRONT_SPEED_RPM, + FAN2_FRONT_SPEED_RPM, + FAN3_FRONT_SPEED_RPM, + FAN4_FRONT_SPEED_RPM, + FAN5_FRONT_SPEED_RPM, + FAN6_FRONT_SPEED_RPM, + FAN7_FRONT_SPEED_RPM, + FAN1_REAR_SPEED_RPM, + FAN2_REAR_SPEED_RPM, + FAN3_REAR_SPEED_RPM, + FAN4_REAR_SPEED_RPM, + FAN5_REAR_SPEED_RPM, + FAN6_REAR_SPEED_RPM, + FAN7_REAR_SPEED_RPM, + FAN_ATTR_MAX +}; + +/* Each client has this additional data */ +struct sw_to3200k_fan_data { + struct device *hwmon_dev; + struct mutex update_lock; + int fan_val[FAN_ATTR_MAX]; +}; + +/* Define attributes */ +#define DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan##index##_duty_cycle_percentage, S_IWUSR | S_IRUGO, get_fan_value, set_fan_value, FAN##index##_DUTY_CYCLE_PERCENTAGE) +#define DECLARE_FAN_DUTY_CYCLE_ATTR(index) &sensor_dev_attr_fan##index##_duty_cycle_percentage.dev_attr.attr + +#define DECLARE_FAN_PRESENCE_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan##index##_presence, S_IWUSR | S_IRUGO, get_fan_value, set_fan_value, FAN##index##_PRESENCE) +#define DECLARE_FAN_PRESENCE_ATTR(index) &sensor_dev_attr_fan##index##_presence.dev_attr.attr + +#define DECLARE_FAN_ENABLE_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan##index##_enable, S_IWUSR | S_IRUGO, get_fan_value, set_fan_value, FAN##index##_ENABLE) +#define DECLARE_FAN_ENABLE_ATTR(index) &sensor_dev_attr_fan##index##_enable.dev_attr.attr + +#define DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan##index##_direction, S_IWUSR | S_IRUGO, get_fan_value, set_fan_value, FAN##index##_DIRECTION) +#define DECLARE_FAN_DIRECTION_ATTR(index) &sensor_dev_attr_fan##index##_direction.dev_attr.attr + +#define DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(index, index2) \ + static SENSOR_DEVICE_ATTR(fan##index##_front_speed_rpm, S_IWUSR | S_IRUGO, get_fan_value, set_fan_value, FAN##index##_FRONT_SPEED_RPM);\ + static SENSOR_DEVICE_ATTR(fan##index##_rear_speed_rpm, S_IWUSR | S_IRUGO, get_fan_value, set_fan_value, FAN##index##_REAR_SPEED_RPM);\ + static SENSOR_DEVICE_ATTR(fan##index##_input, S_IWUSR | S_IRUGO, get_fan_value, set_fan_value, FAN##index##_FRONT_SPEED_RPM);\ + static SENSOR_DEVICE_ATTR(fan##index2##_input, S_IWUSR | S_IRUGO, get_fan_value, set_fan_value, FAN##index##_REAR_SPEED_RPM) +#define DECLARE_FAN_SPEED_RPM_ATTR(index, index2) &sensor_dev_attr_fan##index##_front_speed_rpm.dev_attr.attr, \ + &sensor_dev_attr_fan##index##_rear_speed_rpm.dev_attr.attr, \ + &sensor_dev_attr_fan##index##_input.dev_attr.attr, \ + &sensor_dev_attr_fan##index2##_input.dev_attr.attr + +/* 7 fan speed(rpm) attributes in this platform */ +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(1,11); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(2,12); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(3,13); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(4,14); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(5,15); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(6,16); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(7,17); + +/* 7 fan presence */ +DECLARE_FAN_PRESENCE_SENSOR_DEV_ATTR(1); +DECLARE_FAN_PRESENCE_SENSOR_DEV_ATTR(2); +DECLARE_FAN_PRESENCE_SENSOR_DEV_ATTR(3); +DECLARE_FAN_PRESENCE_SENSOR_DEV_ATTR(4); +DECLARE_FAN_PRESENCE_SENSOR_DEV_ATTR(5); +DECLARE_FAN_PRESENCE_SENSOR_DEV_ATTR(6); +DECLARE_FAN_PRESENCE_SENSOR_DEV_ATTR(7); + +/* 7 fan enable */ +DECLARE_FAN_ENABLE_SENSOR_DEV_ATTR(1); +DECLARE_FAN_ENABLE_SENSOR_DEV_ATTR(2); +DECLARE_FAN_ENABLE_SENSOR_DEV_ATTR(3); +DECLARE_FAN_ENABLE_SENSOR_DEV_ATTR(4); +DECLARE_FAN_ENABLE_SENSOR_DEV_ATTR(5); +DECLARE_FAN_ENABLE_SENSOR_DEV_ATTR(6); +DECLARE_FAN_ENABLE_SENSOR_DEV_ATTR(7); + +/* 7 fan direction */ +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(1); +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(2); +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(3); +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(4); +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(5); +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(6); +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(7); + +/* 1 fan duty cycle attribute in this platform */ +DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR(); + +static struct attribute *sw_to3200k_fan_attributes[] = { + /* fan related attributes */ + DECLARE_FAN_SPEED_RPM_ATTR(1,11), + DECLARE_FAN_SPEED_RPM_ATTR(2,12), + DECLARE_FAN_SPEED_RPM_ATTR(3,13), + DECLARE_FAN_SPEED_RPM_ATTR(4,14), + DECLARE_FAN_SPEED_RPM_ATTR(5,15), + DECLARE_FAN_SPEED_RPM_ATTR(6,16), + DECLARE_FAN_SPEED_RPM_ATTR(7,17), + DECLARE_FAN_PRESENCE_ATTR(1), + DECLARE_FAN_PRESENCE_ATTR(2), + DECLARE_FAN_PRESENCE_ATTR(3), + DECLARE_FAN_PRESENCE_ATTR(4), + DECLARE_FAN_PRESENCE_ATTR(5), + DECLARE_FAN_PRESENCE_ATTR(6), + DECLARE_FAN_PRESENCE_ATTR(7), + DECLARE_FAN_ENABLE_ATTR(1), + DECLARE_FAN_ENABLE_ATTR(2), + DECLARE_FAN_ENABLE_ATTR(3), + DECLARE_FAN_ENABLE_ATTR(4), + DECLARE_FAN_ENABLE_ATTR(5), + DECLARE_FAN_ENABLE_ATTR(6), + DECLARE_FAN_ENABLE_ATTR(7), + DECLARE_FAN_DIRECTION_ATTR(1), + DECLARE_FAN_DIRECTION_ATTR(2), + DECLARE_FAN_DIRECTION_ATTR(3), + DECLARE_FAN_DIRECTION_ATTR(4), + DECLARE_FAN_DIRECTION_ATTR(5), + DECLARE_FAN_DIRECTION_ATTR(6), + DECLARE_FAN_DIRECTION_ATTR(7), + DECLARE_FAN_DUTY_CYCLE_ATTR(), + NULL +}; + +static ssize_t get_fan_value(struct device *dev, struct device_attribute *da, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct sw_to3200k_fan_data *data = i2c_get_clientdata(client); + int value = 0; + + mutex_lock(&data->update_lock); + value = data->fan_val[attr->index]; + mutex_unlock(&data->update_lock); + return sprintf(buf, "%d", value); +} + +static ssize_t set_fan_value +( + struct device *dev, + struct device_attribute *da, + const char *buf, + size_t count +) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct sw_to3200k_fan_data *data = i2c_get_clientdata(client); + int error, value; + + error = kstrtoint(buf, 10, &value); + if (error) + { + printk("fan_set_value error=%d\n", error); + return error; + } + + mutex_lock(&data->update_lock); + data->fan_val[attr->index] = value; + mutex_unlock(&data->update_lock); + return count; +} + +static const struct attribute_group sw_to3200k_fan_group = { + .attrs = sw_to3200k_fan_attributes, +}; + +static int sw_to3200k_fan_probe +( + struct i2c_client *client, + const struct i2c_device_id *dev_id +) +{ + struct sw_to3200k_fan_data *data; + int status; + + data = kzalloc(sizeof(struct sw_to3200k_fan_data), GFP_KERNEL); + if (!data) + { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + + dev_info(&client->dev, "device found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &sw_to3200k_fan_group); + if (status) + { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) + { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: fan '%s'\n", dev_name(data->hwmon_dev), client->name); + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &sw_to3200k_fan_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int sw_to3200k_fan_remove(struct i2c_client *client) +{ + struct sw_to3200k_fan_data *data = i2c_get_clientdata(client); + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &sw_to3200k_fan_group); + return 0; +} + +/* Addresses to scan */ +static const unsigned short normal_i2c[] = { 0x66, I2C_CLIENT_END }; + +static const struct i2c_device_id sw_to3200k_fan_id[] = { + { "sw_to3200k_fan", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, sw_to3200k_fan_id); + +static struct i2c_driver sw_to3200k_fan_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = DRVNAME, + }, + .probe = sw_to3200k_fan_probe, + .remove = sw_to3200k_fan_remove, + .id_table = sw_to3200k_fan_id, + .address_list = normal_i2c, +}; + +module_i2c_driver(sw_to3200k_fan_driver); + +MODULE_AUTHOR("Haowei Chung "); +MODULE_DESCRIPTION("sw_to3200k_fan driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/modules/wistron_sw_to3200k_leds.c b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/modules/wistron_sw_to3200k_leds.c new file mode 100644 index 0000000000..65be12e9f0 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/modules/wistron_sw_to3200k_leds.c @@ -0,0 +1,293 @@ + +#include +#include +#include +#include +#include +#include +#include +#include + +/* led_type: 0=loc, 1=diag, 2=fan, 3=psu1, 4=psu2 + * light_mode: 0=off, 1=green, 2=amber, 3=blinking green + */ +extern int sw_to3200k_fpga_sysled_get(int led_type); +extern int sw_to3200k_fpga_sysled_set(int led_type, int light_mode); + +#define DRVNAME "wistron_sw_to3200k_led" + +struct wistron_sw_to3200k_led_data { + struct platform_device *pdev; + struct mutex lock; + int sysled_status[5]; +}; + +static struct wistron_sw_to3200k_led_data *ledctl = NULL; + +/* LED related data */ +#define LED_MODE_OFF_VALUE 0 +#define LED_MODE_GREEN_VALUE 1 +#define LED_MODE_AMBER_VALUE 2 +#define LED_MODE_BLK_GREEN_VALUE 3 + +enum led_type { + LED_TYPE_LOC, + LED_TYPE_DIAG, + LED_TYPE_FAN, + LED_TYPE_PSU1, + LED_TYPE_PSU2, + LED_TYPE_END +}; + +enum led_light_mode { + LED_MODE_OFF = 0, + LED_MODE_GREEN, + LED_MODE_AMBER, + LED_MODE_BLK_GREEN, + LED_MODE_UNKNOWN +}; + +static void wistron_sw_to3200k_led_update(void) +{ + int i; + mutex_lock(&ledctl->lock); + for (i = 0; i < LED_TYPE_END; i++) + { + ledctl->sysled_status[i] = sw_to3200k_fpga_sysled_get(i); + } + mutex_unlock(&ledctl->lock); +} + +static void wistron_sw_to3200k_led_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode, + enum led_type type) +{ + mutex_lock(&ledctl->lock); + sw_to3200k_fpga_sysled_set(type, led_light_mode); + mutex_unlock(&ledctl->lock); +} + +static void wistron_sw_to3200k_led_diag_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + wistron_sw_to3200k_led_set(led_cdev, led_light_mode, LED_TYPE_DIAG); +} + +static enum led_brightness wistron_sw_to3200k_led_diag_get(struct led_classdev *cdev) +{ + wistron_sw_to3200k_led_update(); + return ledctl->sysled_status[LED_TYPE_DIAG]; +} + +static void wistron_sw_to3200k_led_loc_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + wistron_sw_to3200k_led_set(led_cdev, led_light_mode, LED_TYPE_LOC); +} + +static enum led_brightness wistron_sw_to3200k_led_loc_get(struct led_classdev *cdev) +{ + wistron_sw_to3200k_led_update(); + return ledctl->sysled_status[LED_TYPE_LOC]; +} + +static void wistron_sw_to3200k_led_fan_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + wistron_sw_to3200k_led_set(led_cdev, led_light_mode, LED_TYPE_FAN); +} + +static enum led_brightness wistron_sw_to3200k_led_fan_get(struct led_classdev *cdev) +{ + wistron_sw_to3200k_led_update(); + return ledctl->sysled_status[LED_TYPE_FAN]; +} + +static void wistron_sw_to3200k_led_psu1_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + wistron_sw_to3200k_led_set(led_cdev, led_light_mode, LED_TYPE_PSU1); +} + +static enum led_brightness wistron_sw_to3200k_led_psu1_get(struct led_classdev *cdev) +{ + wistron_sw_to3200k_led_update(); + return ledctl->sysled_status[LED_TYPE_PSU1]; +} + +static void wistron_sw_to3200k_led_psu2_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + wistron_sw_to3200k_led_set(led_cdev, led_light_mode, LED_TYPE_PSU2); +} + +static enum led_brightness wistron_sw_to3200k_led_psu2_get(struct led_classdev *cdev) +{ + wistron_sw_to3200k_led_update(); + return ledctl->sysled_status[LED_TYPE_PSU2]; +} + +static struct led_classdev wistron_sw_to3200k_leds[] = { + [LED_TYPE_DIAG] = { + .name = "wistron_sw_to3200k_led::diag", + .default_trigger = "unused", + .brightness_set = wistron_sw_to3200k_led_diag_set, + .brightness_get = wistron_sw_to3200k_led_diag_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_BLK_GREEN, + }, + [LED_TYPE_LOC] = { + .name = "wistron_sw_to3200k_led::loc", + .default_trigger = "unused", + .brightness_set = wistron_sw_to3200k_led_loc_set, + .brightness_get = wistron_sw_to3200k_led_loc_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_BLK_GREEN, + }, + [LED_TYPE_FAN] = { + .name = "wistron_sw_to3200k_led::fan", + .default_trigger = "unused", + .brightness_set = wistron_sw_to3200k_led_fan_set, + .brightness_get = wistron_sw_to3200k_led_fan_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AMBER, + }, + [LED_TYPE_PSU1] = { + .name = "wistron_sw_to3200k_led::psu1", + .default_trigger = "unused", + .brightness_set = wistron_sw_to3200k_led_psu1_set, + .brightness_get = wistron_sw_to3200k_led_psu1_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AMBER, + }, + [LED_TYPE_PSU2] = { + .name = "wistron_sw_to3200k_led::psu2", + .default_trigger = "unused", + .brightness_set = wistron_sw_to3200k_led_psu2_set, + .brightness_get = wistron_sw_to3200k_led_psu2_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AMBER, + }, +}; + +static int wistron_sw_to3200k_led_suspend(struct platform_device *dev, + pm_message_t state) +{ + int i = 0; + + for (i = 0; i < ARRAY_SIZE(wistron_sw_to3200k_leds); i++) + { + led_classdev_suspend(&wistron_sw_to3200k_leds[i]); + } + + return 0; +} + +static int wistron_sw_to3200k_led_resume(struct platform_device *dev) +{ + int i = 0; + + for (i = 0; i < ARRAY_SIZE(wistron_sw_to3200k_leds); i++) + { + led_classdev_resume(&wistron_sw_to3200k_leds[i]); + } + + return 0; +} + +static int wistron_sw_to3200k_led_probe(struct platform_device *pdev) +{ + int ret, i; + + for (i = 0; i < ARRAY_SIZE(wistron_sw_to3200k_leds); i++) + { + ret = led_classdev_register(&pdev->dev, &wistron_sw_to3200k_leds[i]); + + if (ret < 0) + break; + } + + /* Check if all LEDs were successfully registered */ + if (i != ARRAY_SIZE(wistron_sw_to3200k_leds)) + { + int j; + + /* only unregister the LEDs that were successfully registered */ + for (j = 0; j < i; j++) + { + led_classdev_unregister(&wistron_sw_to3200k_leds[i]); + } + } + + return ret; +} + +static int wistron_sw_to3200k_led_remove(struct platform_device *pdev) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(wistron_sw_to3200k_leds); i++) + { + led_classdev_unregister(&wistron_sw_to3200k_leds[i]); + } + + return 0; +} + +static struct platform_driver wistron_sw_to3200k_led_driver = { + .probe = wistron_sw_to3200k_led_probe, + .remove = wistron_sw_to3200k_led_remove, + .suspend = wistron_sw_to3200k_led_suspend, + .resume = wistron_sw_to3200k_led_resume, + .driver = { + .name = DRVNAME, + .owner = THIS_MODULE, + }, +}; + +static int __init wistron_sw_to3200k_led_init(void) +{ + int ret; + + ret = platform_driver_register(&wistron_sw_to3200k_led_driver); + if (ret < 0) + { + goto exit; + } + + ledctl = kzalloc(sizeof(struct wistron_sw_to3200k_led_data), GFP_KERNEL); + if (!ledctl) + { + ret = -ENOMEM; + platform_driver_unregister(&wistron_sw_to3200k_led_driver); + goto exit; + } + + mutex_init(&ledctl->lock); + + ledctl->pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0); + if (IS_ERR(ledctl->pdev)) + { + ret = PTR_ERR(ledctl->pdev); + platform_driver_unregister(&wistron_sw_to3200k_led_driver); + kfree(ledctl); + goto exit; + } + +exit: + return ret; +} + +static void __exit wistron_sw_to3200k_led_exit(void) +{ + platform_device_unregister(ledctl->pdev); + platform_driver_unregister(&wistron_sw_to3200k_led_driver); + kfree(ledctl); +} + +module_init(wistron_sw_to3200k_led_init); +module_exit(wistron_sw_to3200k_led_exit); + +MODULE_AUTHOR("Haowei Chung "); +MODULE_DESCRIPTION("wistron_sw_to3200k_led driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/modules/wistron_sw_to3200k_oom.c b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/modules/wistron_sw_to3200k_oom.c new file mode 100644 index 0000000000..eb376b9eb5 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/modules/wistron_sw_to3200k_oom.c @@ -0,0 +1,349 @@ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* QSFP-DD: page0 (low page + high page (128+128 byte)), page 2 (high page (128 byte)), page11 (high page (128 byte))*/ +#define EEPROM_DATA_SIZE 256 + +/* Addresses scanned */ +static const unsigned short normal_i2c[] = { I2C_CLIENT_END }; +#define MAX_PORT_NAME_LEN 20 + +enum sysfs_fan_attributes { + OOM_LP_MODE, + OOM_TEMP, + OOM_EEPROM1, + OOM_EEPROM2, + OOM_PORT_NAME, + OOM_ATTR_MAX +}; + +/* Each client has this additional data */ +struct sw_to3200k_oom_data { + struct device *hwmon_dev; + struct mutex lock; + u8 index; + int lp_mode; + int temp; + unsigned char eeprom1[EEPROM_DATA_SIZE]; + unsigned char eeprom2[EEPROM_DATA_SIZE]; + char port_name[MAX_PORT_NAME_LEN]; +}; + +/* sysfs attributes for hwmon */ +static ssize_t get_oom_value(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t set_oom_value(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t get_oom_info1(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t set_oom_info1(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t get_oom_info2(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t set_oom_info2(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t get_port_name(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t set_port_name(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static SENSOR_DEVICE_ATTR(lp_mode, S_IWUSR | S_IRUGO, get_oom_value, set_oom_value, OOM_LP_MODE); +static SENSOR_DEVICE_ATTR(temp, S_IWUSR | S_IRUGO, get_oom_value, set_oom_value, OOM_TEMP); +static SENSOR_DEVICE_ATTR(eeprom1, S_IWUSR | S_IRUGO, get_oom_info1, set_oom_info1, OOM_EEPROM1); +static SENSOR_DEVICE_ATTR(eeprom2, S_IWUSR | S_IRUGO, get_oom_info2, set_oom_info2, OOM_EEPROM2); +static SENSOR_DEVICE_ATTR(port_name, S_IRUGO | S_IWUSR, get_port_name, set_port_name, OOM_PORT_NAME); + +static struct attribute *sw_to3200k_oom_attributes[] = { + &sensor_dev_attr_lp_mode.dev_attr.attr, + &sensor_dev_attr_temp.dev_attr.attr, + &sensor_dev_attr_eeprom1.dev_attr.attr, + &sensor_dev_attr_eeprom2.dev_attr.attr, + &sensor_dev_attr_port_name.dev_attr.attr, + NULL +}; + +static ssize_t get_oom_value(struct device *dev, struct device_attribute *da, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct sw_to3200k_oom_data *data = i2c_get_clientdata(client); + int value = 0; + + mutex_lock(&data->lock); + if (attr->index == OOM_LP_MODE) + { + value = data->lp_mode; + } + else + { + value = data->temp; + } + mutex_unlock(&data->lock); + return sprintf(buf, "%d", value); +} + +static ssize_t set_oom_value(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct sw_to3200k_oom_data *data = i2c_get_clientdata(client); + int error, value; + + error = kstrtoint(buf, 10, &value); + if (error) + { + printk("oom_set_value error=%d\n", error); + return error; + } + + mutex_lock(&data->lock); + if (attr->index == OOM_LP_MODE) + { + data->lp_mode = value; + } + else + { + data->temp = value; + } + mutex_unlock(&data->lock); + return count; +} + +static ssize_t get_oom_info1(struct device *dev, struct device_attribute *da, char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sw_to3200k_oom_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->lock); + memcpy(buf, data->eeprom1, EEPROM_DATA_SIZE); + mutex_unlock(&data->lock); + return EEPROM_DATA_SIZE; +} + +static ssize_t set_oom_info1(struct device *dev, struct device_attribute *da, const char *buf, size_t size) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sw_to3200k_oom_data *data = i2c_get_clientdata(client); + int i=0, j=0, k=0; + unsigned char str[3]; + unsigned int val; + + //printk("eeprom1 strlen(buf)=%d\n",strlen(buf)); + k=0; + mutex_lock(&data->lock); + //memset(data->eeprom1, 0xFF, EEPROM_DATA_SIZE); + memset(str, 0x0, 3); + if (strlen(buf) >= EEPROM_DATA_SIZE) + { + for (i=0; i < strlen(buf) ; i++) + { + // printk("i=%d ", i); + for (j=0;j<2; j++) + { + str[j]=buf[i+j]; + } + sscanf(str, "%x", &val); + //printk("str=%s val=0x%x ", str, val); + i=j+i-1; + if (k>=EEPROM_DATA_SIZE) + { + break; + } + data->eeprom1[k]=(unsigned char)val; + //printk("data->eeprom1[%d]=0x%x\n",k, data->eeprom1[k]); + k++; + } + } + //printk("eeprom1 buf=\n"); + //for(i=0; i < strlen(buf) ; i++) + //{ + // printk("%c%c ", buf[i], buf[i+1]); + // if((i % 31)==0) + // printk("\n"); + //} + //printk("\n"); + + mutex_unlock(&data->lock); + return size; +} + +static ssize_t get_oom_info2(struct device *dev, struct device_attribute *da, char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sw_to3200k_oom_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->lock); + memcpy(buf, data->eeprom2, EEPROM_DATA_SIZE); + mutex_unlock(&data->lock); + return EEPROM_DATA_SIZE; +} + +static ssize_t set_oom_info2(struct device *dev, struct device_attribute *da, const char *buf, size_t size) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sw_to3200k_oom_data *data = i2c_get_clientdata(client); + int i=0, j=0, k=0; + unsigned char str[3]; + unsigned int val; + + // printk("eeprom2 strlen(buf)=%d\n",strlen(buf)); + k=0; + mutex_lock(&data->lock); + memset(data->eeprom2, 0xFF, EEPROM_DATA_SIZE); + memset(str, 0x0, 3); + if (strlen(buf) >= EEPROM_DATA_SIZE) + { + for (i=0; i < strlen(buf) ; i++) + { + // printk("i=%d ", i); + for (j=0;j<2; j++) + { + str[j]=buf[i+j]; + } + sscanf(str, "%x", &val); + //printk("str=%s val=0x%x ", str, val); + i=j+i-1; + if (k>=EEPROM_DATA_SIZE) + { + break; + } + data->eeprom2[k]=(unsigned char)val; + //printk("data->eeprom2[%d]=0x%x\n",k, data->eeprom2[k]); + k++; + } + } + //printk("eeprom2 buf=\n"); + //for(i=0; i < strlen(buf) ; i++) + //{ + // printk("%c%c ", buf[i], buf[i+1]); + // if((i % 31)==0) + // printk("\n"); + //} + //printk("\n"); + + mutex_unlock(&data->lock); + return size; +} + +static ssize_t get_port_name(struct device *dev, struct device_attribute *da, char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sw_to3200k_oom_data *data = i2c_get_clientdata(client); + ssize_t count; + + mutex_lock(&data->lock); + count = sprintf(buf, "%s", data->port_name); + mutex_unlock(&data->lock); + return count; +} + +static ssize_t set_port_name(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sw_to3200k_oom_data *data = i2c_get_clientdata(client); + char port_name[MAX_PORT_NAME_LEN]; + + if (sscanf(buf, "%19s", port_name) != 1) + { + return -EINVAL; + } + + mutex_lock(&data->lock); + strcpy(data->port_name, port_name); + mutex_unlock(&data->lock); + return count; +} + +static const struct attribute_group sw_to3200k_oom_group = { + .attrs = sw_to3200k_oom_attributes, +}; + +static int sw_to3200k_oom_probe(struct i2c_client *client, const struct i2c_device_id *dev_id) +{ + struct sw_to3200k_oom_data *data; + int status; + + data = kzalloc(sizeof(struct sw_to3200k_oom_data), GFP_KERNEL); + if (!data) + { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + data->index = dev_id->driver_data; + mutex_init(&data->lock); + + dev_info(&client->dev, "device found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &sw_to3200k_oom_group); + if (status) + { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) + { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: oom '%s'\n", dev_name(data->hwmon_dev), client->name); + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &sw_to3200k_oom_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int sw_to3200k_oom_remove(struct i2c_client *client) +{ + struct sw_to3200k_oom_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &sw_to3200k_oom_group); + kfree(data); + + return 0; +} + +static const struct i2c_device_id sw_to3200k_oom_id[] = { + { "sw_to3200k_oom", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, sw_to3200k_oom_id); + +static struct i2c_driver sw_to3200k_oom_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "sw_to3200k_oom", + }, + .probe = sw_to3200k_oom_probe, + .remove = sw_to3200k_oom_remove, + .id_table = sw_to3200k_oom_id, + .address_list = normal_i2c, +}; + +static int __init sw_to3200k_oom_init(void) +{ + return i2c_add_driver(&sw_to3200k_oom_driver); +} + +static void __exit sw_to3200k_oom_exit(void) +{ + i2c_del_driver(&sw_to3200k_oom_driver); +} + +module_init(sw_to3200k_oom_init); +module_exit(sw_to3200k_oom_exit); + +MODULE_AUTHOR("Haowei Chung "); +MODULE_DESCRIPTION("sw_to3200k_oom driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/modules/wistron_sw_to3200k_psu.c b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/modules/wistron_sw_to3200k_psu.c new file mode 100644 index 0000000000..849ec13154 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/modules/wistron_sw_to3200k_psu.c @@ -0,0 +1,266 @@ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MAX_MODEL_NAME 16 +#define MAX_SERIAL_NUMBER 19 + +static ssize_t get_status(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t set_status(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t get_string(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t set_string(struct device *dev, struct device_attribute *da, const char *buf, size_t count); + +/* Addresses scanned */ +static const unsigned short normal_i2c[] = { 0x51, 0x52, I2C_CLIENT_END }; + +/* Each client has this additional data */ +struct sw_to3200k_psu_data { + struct device *hwmon_dev; + struct mutex lock; + int index; /* PSU index */ + int present; /* PSU present */ + int pwr_good; /* PSU power good */ + int psu_fan_dir; /* PSU fan direction 0:afo, 1:afi */ + char model_name[MAX_MODEL_NAME]; /* Model name */ + char serial_number[MAX_SERIAL_NUMBER]; +}; + +enum sw_to3200k_psu_sysfs_attributes { + PSU_PRESENT, + PSU_MODEL_NAME, + PSU_POWER_GOOD, + PSU_SERIAL_NUMBER, + PSU_FAN_DIR +}; + +/* sysfs attributes for hwmon */ +static SENSOR_DEVICE_ATTR(psu_present, S_IWUSR | S_IRUGO, get_status, set_status, PSU_PRESENT); +static SENSOR_DEVICE_ATTR(psu_model_name, S_IWUSR | S_IRUGO, get_string, set_string, PSU_MODEL_NAME); +static SENSOR_DEVICE_ATTR(psu_power_good, S_IWUSR | S_IRUGO, get_status, set_status, PSU_POWER_GOOD); +static SENSOR_DEVICE_ATTR(psu_serial_number, S_IWUSR | S_IRUGO, get_string, set_string, PSU_SERIAL_NUMBER); +static SENSOR_DEVICE_ATTR(psu_fan_dir, S_IWUSR | S_IRUGO, get_status, set_status, PSU_FAN_DIR); + +static struct attribute *sw_to3200k_psu_attributes[] = { + &sensor_dev_attr_psu_present.dev_attr.attr, + &sensor_dev_attr_psu_model_name.dev_attr.attr, + &sensor_dev_attr_psu_power_good.dev_attr.attr, + &sensor_dev_attr_psu_serial_number.dev_attr.attr, + &sensor_dev_attr_psu_fan_dir.dev_attr.attr, + NULL +}; + +static ssize_t get_status(struct device *dev, struct device_attribute *da, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct sw_to3200k_psu_data *data = i2c_get_clientdata(client); + int status = 0; + + mutex_lock(&data->lock); + if (attr->index == PSU_PRESENT) + { + status = data->present; + } + else if (attr->index == PSU_POWER_GOOD) + { + status = data->pwr_good; + } + else + { + status = data->psu_fan_dir; + } + mutex_unlock(&data->lock); + return sprintf(buf, "%d", status); +} + +static ssize_t set_status(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct sw_to3200k_psu_data *data = i2c_get_clientdata(client); + int error, status; + + error = kstrtoint(buf, 10, &status); + if (error) + { + printk("psu_set_status error=%d\n", error); + return error; + } + + mutex_lock(&data->lock); + if (attr->index == PSU_PRESENT) + { + data->present = status; + } + else if (attr->index == PSU_POWER_GOOD) + { + data->pwr_good = status; + } + else + { + data->psu_fan_dir = status; + } + mutex_unlock(&data->lock); + return count; +} + +static ssize_t get_string(struct device *dev, struct device_attribute *da, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct sw_to3200k_psu_data *data = i2c_get_clientdata(client); + ssize_t count; + + mutex_lock(&data->lock); + if (attr->index == PSU_MODEL_NAME) + { + count = sprintf(buf, "%s", data->model_name); + } + else + { + count = sprintf(buf, "%s", data->serial_number); + } + mutex_unlock(&data->lock); + return count; +} + +static ssize_t set_string(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct sw_to3200k_psu_data *data = i2c_get_clientdata(client); + char tmp_str[32]; + + memset(&tmp_str, 0x0, sizeof(tmp_str)); + if (attr->index == PSU_MODEL_NAME) + { + if (sscanf(buf, "%16s", tmp_str) != 1) + { + return -EINVAL; + } + } + else + { + if (sscanf(buf, "%19s", tmp_str) != 1) + { + return -EINVAL; + } + } + + mutex_lock(&data->lock); + if (attr->index == PSU_MODEL_NAME) + { + strcpy(data->model_name, tmp_str); + } + else + { + strcpy(data->serial_number, tmp_str); + } + mutex_unlock(&data->lock); + return count; +} + +static const struct attribute_group sw_to3200k_psu_group = { + .attrs = sw_to3200k_psu_attributes, +}; + +static int sw_to3200k_psu_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct sw_to3200k_psu_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_I2C_BLOCK)) + { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct sw_to3200k_psu_data), GFP_KERNEL); + if (!data) + { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + data->index = dev_id->driver_data; + mutex_init(&data->lock); + + dev_info(&client->dev, "device found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &sw_to3200k_psu_group); + if (status) + { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) + { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: psu '%s'\n", dev_name(data->hwmon_dev), client->name); + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &sw_to3200k_psu_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int sw_to3200k_psu_remove(struct i2c_client *client) +{ + struct sw_to3200k_psu_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &sw_to3200k_psu_group); + kfree(data); + + return 0; +} + +enum psu_index +{ + sw_to3200k_psu1, + sw_to3200k_psu2 +}; + +static const struct i2c_device_id sw_to3200k_psu_id[] = { + { "sw_to3200k_psu1", sw_to3200k_psu1 }, + { "sw_to3200k_psu2", sw_to3200k_psu2 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, sw_to3200k_psu_id); + +static struct i2c_driver sw_to3200k_psu_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "sw_to3200k_psu", + }, + .probe = sw_to3200k_psu_probe, + .remove = sw_to3200k_psu_remove, + .id_table = sw_to3200k_psu_id, + .address_list = normal_i2c, +}; + +module_i2c_driver(sw_to3200k_psu_driver); + +MODULE_AUTHOR("Haowei Chung "); +MODULE_DESCRIPTION("sw_to3200k_psu driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/modules/wistron_sw_to3200k_thermal.c b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/modules/wistron_sw_to3200k_thermal.c new file mode 100644 index 0000000000..e96e9d723f --- /dev/null +++ b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/modules/wistron_sw_to3200k_thermal.c @@ -0,0 +1,205 @@ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define STRING_TO_DEC_VALUE 10 +#define STRING_TO_HEX_VALUE 16 + +#define TEMP1_MAX_DEFAULT 75000 +#define TEMP1_MAX_HYST_DEFAULT 70000 + +/* Addresses scanned */ +static const unsigned short normal_i2c[] = { I2C_CLIENT_END }; + +/* Each client has this additional data */ +struct sw_to3200k_thermal_data { + struct device *hwmon_dev; + struct mutex lock; + u8 index; + unsigned int temp1_input; + unsigned int temp1_max; + unsigned int temp1_max_hyst; +}; + +enum sw_to3200k_thermal_sysfs_attributes { + TEMP1_INPUT, + TEMP1_MAX, + TEMP1_MAX_HYST +}; + +/* sysfs attributes for hwmon */ +static ssize_t get_temp_info(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t set_temp_info(struct device *dev, struct device_attribute *da, const char *buf, size_t count); + +static SENSOR_DEVICE_ATTR(temp1_input, S_IWUSR|S_IRUGO, get_temp_info, set_temp_info, TEMP1_INPUT); +static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR|S_IRUGO, get_temp_info, set_temp_info, TEMP1_MAX); +static SENSOR_DEVICE_ATTR(temp1_max_hyst, S_IWUSR|S_IRUGO, get_temp_info, set_temp_info, TEMP1_MAX_HYST); + +static struct attribute *sw_to3200k_thermal_attributes[] = { + &sensor_dev_attr_temp1_input.dev_attr.attr, + &sensor_dev_attr_temp1_max.dev_attr.attr, + &sensor_dev_attr_temp1_max_hyst.dev_attr.attr, + NULL +}; + +static ssize_t get_temp_info(struct device *dev, struct device_attribute *da, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct sw_to3200k_thermal_data *data = i2c_get_clientdata(client); + int status = -EINVAL; + + mutex_lock(&data->lock); + switch (attr->index) + { + case TEMP1_INPUT: + status = snprintf(buf, PAGE_SIZE - 1, "%d", data->temp1_input); + break; + case TEMP1_MAX: + status = snprintf(buf, PAGE_SIZE - 1, "%d", TEMP1_MAX_DEFAULT); + break; + case TEMP1_MAX_HYST: + status = snprintf(buf, PAGE_SIZE - 1, "%d", TEMP1_MAX_HYST_DEFAULT); + break; + default : + break; + } + mutex_unlock(&data->lock); + return status; +} + +static ssize_t set_temp_info +( + struct device *dev, + struct device_attribute *da, + const char *buf, + size_t size +) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct sw_to3200k_thermal_data *data = i2c_get_clientdata(client); + long keyin = 0; + int error; + + error = kstrtol(buf, STRING_TO_DEC_VALUE, &keyin); + if (error) + { + return error; + } + + mutex_lock(&data->lock); + switch (attr->index) + { + case TEMP1_INPUT: + data->temp1_input = keyin; + break; + default : + break; + } + + mutex_unlock(&data->lock); + return size; +} + +static const struct attribute_group sw_to3200k_thermal_group = { + .attrs = sw_to3200k_thermal_attributes, +}; + +static int sw_to3200k_thermal_probe(struct i2c_client *client, const struct i2c_device_id *dev_id) +{ + struct sw_to3200k_thermal_data *data; + int status; + + data = kzalloc(sizeof(struct sw_to3200k_thermal_data), GFP_KERNEL); + if (!data) + { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + data->index = dev_id->driver_data; + mutex_init(&data->lock); + + dev_info(&client->dev, "device found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &sw_to3200k_thermal_group); + if (status) + { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) + { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: thermal '%s'\n", dev_name(data->hwmon_dev), client->name); + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &sw_to3200k_thermal_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int sw_to3200k_thermal_remove(struct i2c_client *client) +{ + struct sw_to3200k_thermal_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &sw_to3200k_thermal_group); + kfree(data); + return 0; +} + + +static const struct i2c_device_id sw_to3200k_thermal_id[] = { + { "sw_to3200k_thermal", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, sw_to3200k_thermal_id); + +static struct i2c_driver sw_to3200k_thermal_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "sw_to3200k_thermal", + }, + .probe = sw_to3200k_thermal_probe, + .remove = sw_to3200k_thermal_remove, + .id_table = sw_to3200k_thermal_id, + .address_list = normal_i2c, +}; + +static int __init sw_to3200k_thermal_init(void) +{ + return i2c_add_driver(&sw_to3200k_thermal_driver); +} + +static void __exit sw_to3200k_thermal_exit(void) +{ + i2c_del_driver(&sw_to3200k_thermal_driver); +} + +module_init(sw_to3200k_thermal_init); +module_exit(sw_to3200k_thermal_exit); + +MODULE_AUTHOR("Haowei Chung "); +MODULE_DESCRIPTION("sw_to3200k_thermal driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/service/platform-modules-sw-to3200k.service b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/service/platform-modules-sw-to3200k.service new file mode 100644 index 0000000000..0e7a679b91 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/service/platform-modules-sw-to3200k.service @@ -0,0 +1,14 @@ +[Unit] +Description=Wistron SW-TO3200K Platform modules +Before=pmon.service +After=sysinit.target +DefaultDependencies=no + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/wistron_sw_to3200k_util.py install +ExecStop=/usr/local/bin/wistron_sw_to3200k_util.py clean +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/service/platform_api/platform_api_mgnt.sh b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/service/platform_api/platform_api_mgnt.sh new file mode 100755 index 0000000000..e1d3303578 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/service/platform_api/platform_api_mgnt.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +PREV_REBOOT_CAUSE="/host/reboot-cause/" +DEVICE="/usr/share/sonic/device" +PLATFORM=$(/usr/local/bin/sonic-cfggen -H -v DEVICE_METADATA.localhost.platform) +FILES=$DEVICE/$PLATFORM/api_files + +install() { + # Install sonic-platform package + if [ -e $DEVICE/$PLATFORM/sonic_platform-1.0-py2-none-any.whl ]; then + pip install $DEVICE/$PLATFORM/sonic_platform-1.0-py2-none-any.whl + fi +} + +init() { + # mount needed files for sonic-platform package + mkdir -p $FILES + + mkdir -p $FILES/reboot-cause + mount -B $PREV_REBOOT_CAUSE $FILES/reboot-cause +} + +deinit() { + # deinit sonic-platform package + umount -f $PREV_REBOOT_CAUSE $FILES/reboot-cause >/dev/null 2>/dev/null +} + +uninstall() { + # Uninstall sonic-platform package + pip uninstall -y sonic-platform >/dev/null 2>/dev/null +} + +case "$1" in +install | uninstall | init | deinit) + $1 + ;; +*) + echo "Usage: $0 {install|uninstall|init|deinit}" + exit 1 + ;; +esac diff --git a/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/service/to3200k-led.service b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/service/to3200k-led.service new file mode 100644 index 0000000000..803f1cdb6a --- /dev/null +++ b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/service/to3200k-led.service @@ -0,0 +1,12 @@ +[Unit] +Description=Wistron SW-TO3200K Platform LED service +After=platform-modules-sw-to3200k.service +DefaultDependencies=no + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/platform_led +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/service/to3200k-platform.service b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/service/to3200k-platform.service new file mode 100644 index 0000000000..38aab39739 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/service/to3200k-platform.service @@ -0,0 +1,13 @@ +[Unit] +Description=Wistron SW-TO3200K Platform Monitoring service +Before=pmon.service +After=sysinit.target +DefaultDependencies=no + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/platform_sync +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/setup.py b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/setup.py new file mode 100644 index 0000000000..ca39936e6a --- /dev/null +++ b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/setup.py @@ -0,0 +1,32 @@ +from setuptools import setup + + +setup( + name='sonic-platform', + version='1.0', + description='SONiC platform API implementation on Wistron SW-TO3200K Platforms', + license='Apache 2.0', + author='SONiC Team', + author_email='sonic_rd@wistron.com', + url='', + maintainer='Wistron SW-TO3200K', + maintainer_email='', + packages=[ + 'sonic_platform' + ], + package_dir={'sonic_platform': 'sw-to3200k/sonic_platform'}, + classifiers=[ + 'Development Status :: 3 - Alpha', + 'Environment :: Plugins', + 'Intended Audience :: Developers', + 'Intended Audience :: Information Technology', + 'Intended Audience :: System Administrators', + 'License :: OSI Approved :: Apache Software License', + 'Natural Language :: English', + 'Operating System :: POSIX :: Linux', + 'Programming Language :: Python :: 2.7', + 'Topic :: Utilities', + ], + keywords='sonic SONiC platform PLATFORM', +) + diff --git a/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/sonic_platform/__init__.py b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/sonic_platform/__init__.py new file mode 100755 index 0000000000..e69de29bb2 diff --git a/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/sonic_platform/chassis.py b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/sonic_platform/chassis.py new file mode 100755 index 0000000000..d6337079f7 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/sonic_platform/chassis.py @@ -0,0 +1,217 @@ +#!/usr/bin/env python + +############################################################################# +# +# Module contains an implementation of SONiC Platform Base API and +# provides the Chassis information which are available in the platform +# +############################################################################# +try: + import sys + import os + import time + from sonic_platform_base.chassis_base import ChassisBase + from sonic_platform.fan import Fan + from sonic_platform.psu import Psu + from sonic_platform.component import Component + from sonic_platform.thermal import Thermal + from sonic_platform.sfp import Sfp + from sonic_platform.eeprom import Tlv +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +NUM_FAN = 14 +NUM_PSU = 2 +NUM_THERMAL = 7 +NUM_SFP = 32 +HOST_REBOOT_CAUSE_PATH = "/host/reboot-cause/" +PMON_REBOOT_CAUSE_PATH = "/usr/share/sonic/platform/api_files/reboot-cause/" +REBOOT_CAUSE_FILE = "reboot-cause.txt" +PREV_REBOOT_CAUSE_FILE = "previous-reboot-cause.txt" +COMPONENT_NAME_LIST = ["BIOS"] +HOST_CHK_CMD = "docker > /dev/null 2>&1" + + +class Chassis(ChassisBase): + """Platform-specific Chassis class""" + + def __init__(self): + super(Chassis, self).__init__() + + for fan_index in range(0, NUM_FAN): + fan = Fan(fan_index) + self._fan_list.append(fan) + + for index in range(0, NUM_PSU): + psu = Psu(index) + self._psu_list.append(psu) + + for index in range(0, NUM_THERMAL): + thermal = Thermal(index) + self._thermal_list.append(thermal) + + for index in range(0, NUM_SFP): + sfp_module = Sfp(index, 'QSFP-DD') + self._sfp_list.append(sfp_module) + self._component_name_list = COMPONENT_NAME_LIST + self._eeprom = Tlv() + self._transceiver_presence = self._get_sfp_presence() + + def __is_host(self): + return os.system(HOST_CHK_CMD) == 0 + + def __read_txt_file(self, file_path): + try: + with open(file_path, 'r') as fd: + data = fd.read() + return data.strip() + except IOError: + pass + return None + + def get_base_mac(self): + """ + Retrieves the base MAC address for the chassis + Returns: + A string containing the MAC address in the format + 'XX:XX:XX:XX:XX:XX' + """ + return self._eeprom.get_mac() + + def get_serial_number(self): + """ + Retrieves the hardware serial number for the chassis + Returns: + A string containing the hardware serial number for this chassis. + """ + return self._eeprom.get_serial() + + def get_system_eeprom_info(self): + """ + Retrieves the full content of system EEPROM information for the chassis + Returns: + A dictionary where keys are the type code defined in + OCP ONIE TlvInfo EEPROM format and values are their corresponding + values. + """ + return self._eeprom.get_eeprom() + + def get_firmware_version(self, component_name): + """ + Retrieves platform-specific hardware/firmware versions for chassis + componenets such as BIOS, CPLD, FPGA, etc. + Args: + type: A string, component name + + Returns: + A string containing platform-specific component versions + """ + self.component = Component(component_name) + if component_name not in self._component_name_list: + return None + return self.component.get_firmware_version() + + def install_component_firmware(self, component_name, image_path): + """ + Install firmware to module + Args: + type: A string, component name. + image_path: A string, path to firmware image. + + Returns: + A boolean, True if install successfully, False if not + """ + self.component = Component(component_name) + if component_name not in self._component_name_list: + return False + return self.component.upgrade_firmware(image_path) + + def get_reboot_cause(self): + """ + Retrieves the cause of the previous reboot + + Returns: + A tuple (string, string) where the first element is a string + containing the cause of the previous reboot. This string must be + one of the predefined strings in this class. If the first string + is "REBOOT_CAUSE_HARDWARE_OTHER", the second string can be used + to pass a description of the reboot cause. + """ + + reboot_cause_path = (HOST_REBOOT_CAUSE_PATH + REBOOT_CAUSE_FILE) if self.__is_host( + ) else PMON_REBOOT_CAUSE_PATH + REBOOT_CAUSE_FILE + sw_reboot_cause = self.__read_txt_file( + reboot_cause_path) or "Unknown" + + if sw_reboot_cause != "Unknown": + reboot_cause = self.REBOOT_CAUSE_NON_HARDWARE + description = sw_reboot_cause + else: + reboot_cause = self.REBOOT_CAUSE_HARDWARE_OTHER + description = 'Unknown reason' + + return (reboot_cause, description) + + def get_sfp(self, index): + sfp = None + try: + sfp = self._sfp_list[index] + except IndexError: + sys.stderr.write("SFP index {} out of range (0-{})\n".format(index, len(self._sfp_list)-1)) + + return sfp + + def _get_sfp_presence(self): + port_pres = {} + for port in range(0, NUM_SFP): + sfp = self._sfp_list[port] + port_pres[port] = sfp.get_presence() + + return port_pres + + def get_change_event(self, timeout=0): + port_dict = {} + ret_dict = {'sfp': port_dict} + forever = False + change_event = False + + if timeout == 0: + forever = True + elif timeout > 0: + timeout = timeout / float(1000) + else: + return False, ret_dict #Incorrect timeout + + while True: + if forever: + timer = 1 + else: + timer = min(timeout, 1) + start_time = time.time() + + time.sleep(timer) + cur_presence = self._get_sfp_presence() + for port in range(0, NUM_SFP): + if cur_presence[port] == 1: + port_dict[port] = '1' + else: + port_dict[port] = '0' + + if cur_presence[port] != self._transceiver_presence[port]: + change_event = True + + self._transceiver_presence = cur_presence + if change_event == True: + break + + if not forever: + elapsed_time = time.time() - start_time + timeout = round(timeout - elapsed_time, 3) + if timeout <= 0: + break + + for port in range(0, NUM_SFP): + sfp = self._sfp_list[port] + sfp.reinit() + + return True, ret_dict diff --git a/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/sonic_platform/component.py b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/sonic_platform/component.py new file mode 100755 index 0000000000..ba241380b4 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/sonic_platform/component.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python + +############################################################################# +# Component contains an implementation of SONiC Platform Base API and +# provides the components firmware management function +############################################################################# + +import os.path +import shlex +import subprocess + +try: + from sonic_platform_base.device_base import DeviceBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +BIOS_VERSION_PATH = "/sys/class/dmi/id/bios_version" + +class Component(DeviceBase): + """Platform-specific Component class""" + + DEVICE_TYPE = "component" + + def __init__(self, component_name): + DeviceBase.__init__(self) + self.name = component_name.upper() + + def __run_command(self, command): + # Run bash command and print output to stdout + try: + process = subprocess.Popen( + shlex.split(command), stdout=subprocess.PIPE) + while True: + output = process.stdout.readline() + if output == '' and process.poll() is not None: + break + rc = process.poll() + if rc != 0: + return False + except BaseException: + return False + return True + + def __get_bios_version(self): + # Retrieves the BIOS firmware version + try: + with open(BIOS_VERSION_PATH, 'r') as fd: + bios_version = fd.read() + return bios_version.strip() + except Exception as e: + return None + + def get_firmware_version(self): + """ + Retrieves the firmware version of module + Returns: + string: The firmware versions of the module + """ + fw_version = None + + if self.name == "BIOS": + fw_version = self.__get_bios_version() + + return fw_version + + def upgrade_firmware(self, image_path): + """ + Install firmware to module + Args: + image_path: A string, path to firmware image + Returns: + A boolean, True if install successfully, False if not + """ + if not os.path.isfile(image_path): + return False + + if self.name == "BIOS": + print("Not supported") + return False + + return self.__run_command(install_command) diff --git a/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/sonic_platform/eeprom.py b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/sonic_platform/eeprom.py new file mode 100755 index 0000000000..1545470970 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/sonic_platform/eeprom.py @@ -0,0 +1,104 @@ +#!/usr/bin/env python + +############################################################################# +# Platform and model specific eeprom subclass, inherits from the base class, +# and provides the followings: +# - the eeprom format definition +# - specific encoder/decoder if there is special need +############################################################################# + +try: + import os + import sys + import re + from cStringIO import StringIO + from sonic_platform_base.sonic_eeprom import eeprom_tlvinfo +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +CACHE_ROOT = '/var/cache/sonic/decode-syseeprom' +CACHE_FILE = 'syseeprom_cache' + + +class Tlv(eeprom_tlvinfo.TlvInfoDecoder): + + EEPROM_DECODE_HEADLINES = 6 + + def __init__(self): + self._eeprom_path = "/sys/bus/i2c/devices/0-0056/eeprom" + super(Tlv, self).__init__(self._eeprom_path, 0, '', True) + self._eeprom = self._load_eeprom() + + def __parse_output(self, decode_output): + decode_output.replace('\0', '') + lines = decode_output.split('\n') + lines = lines[self.EEPROM_DECODE_HEADLINES:] + _eeprom_info_dict = dict() + + for line in lines: + try: + match = re.search( + '(0x[0-9a-fA-F]{2})([\s]+[\S]+[\s]+)([\S]+)', line) + if match is not None: + idx = match.group(1) + value = match.group(3).rstrip('\0') + + _eeprom_info_dict[idx] = value + except BaseException: + pass + return _eeprom_info_dict + + def _load_eeprom(self): + original_stdout = sys.stdout + sys.stdout = StringIO() + err = self.read_eeprom_db() + if err: + # Failed to read EEPROM information from database. Read from cache file + pass + else: + decode_output = sys.stdout.getvalue() + sys.stdout = original_stdout + return self.__parse_output(decode_output) + + status = self.check_status() + if status < 'ok': + return False + + if not os.path.exists(CACHE_ROOT): + try: + os.makedirs(CACHE_ROOT) + except OSError: + pass + + # + # only the eeprom classes that inherit from eeprom_base + # support caching. Others will work normally + # + try: + self.set_cache_name(os.path.join(CACHE_ROOT, CACHE_FILE)) + except OSError: + pass + + e = self.read_eeprom() + if e is None: + return 0 + + self.update_cache(e) + self.decode_eeprom(e) + decode_output = sys.stdout.getvalue() + sys.stdout = original_stdout + + (is_valid, valid_crc) = self.is_checksum_valid(e) + if not is_valid: + return False + + return self.__parse_output(decode_output) + + def get_eeprom(self): + return self._eeprom + + def get_serial(self): + return self._eeprom.get('0x23', "Undefined.") + + def get_mac(self): + return self._eeprom.get('0x24', "Undefined.") diff --git a/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/sonic_platform/fan.py b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/sonic_platform/fan.py new file mode 100755 index 0000000000..f5b7f9e80e --- /dev/null +++ b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/sonic_platform/fan.py @@ -0,0 +1,192 @@ +#!/usr/bin/env python + +############################################################################# +# +# Module contains an implementation of SONiC Platform Base API and +# provides the fan status which are available in the platform +# +############################################################################# + +import os.path + +try: + from sonic_platform_base.fan_base import FanBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +FAN_PATH = "/sys/bus/i2c/devices/0-0066/" +FANTRAY_NAME_LIST = ["FANTRAY-1", "FANTRAY-2", + "FANTRAY-3", "FANTRAY-4", + "FANTRAY-5", "FANTRAY-6", "FANTRAY-7"] +FAN_NAME_LIST = ["fan1_front","fan2_front","fan3_front","fan4_front","fan5_front","fan6_front", "fan7_front",\ +"fan1_rear","fan2_rear","fan3_rear","fan4_rear", "fan5_rear", "fan6_rear", "fan7_rear",] + +class Fan(FanBase): + """Platform-specific Fan class""" + + def __init__(self, fan_index): + self.fan_tray_index = fan_index + self.fan_presence = "fan{}_presence" + self.fan_direction = "fan{}_direction" + self.fan_speed_rpm = "fan{}_{}_speed_rpm" + FanBase.__init__(self) + + def __read_txt_file(self, file_path): + try: + with open(file_path, 'r') as fd: + data = fd.read() + return data.strip() + except IOError: + pass + return "" + + def __write_txt_file(self, file_path, value): + try: + with open(file_path, 'w') as fd: + fd.write(str(value)) + except BaseException: + return False + return True + + def __search_file_by_name(self, directory, file_name): + for dirpath, dirnames, files in os.walk(directory): + for name in files: + file_path = os.path.join(dirpath, name) + if name in file_name: + return file_path + return None + + def get_direction(self): + """ + Retrieves the direction of fan + Returns: + A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST + depending on fan direction + """ + index1=self.fan_tray_index + if self.fan_tray_index>6: + index1=self.fan_tray_index%7 + fan_direction_file = (FAN_PATH + + self.fan_direction.format(index1+1)) + raw = self.__read_txt_file(fan_direction_file).strip('\r\n') + direction = self.FAN_DIRECTION_INTAKE if str( + raw).upper() == "1" else self.FAN_DIRECTION_EXHAUST + + return direction + + def get_speed(self): + """ + Retrieves the speed of fan as a percentage of full speed + Returns: + An integer, the percentage of full fan speed, in the range 0 (off) + to 12000 (full speed) + """ + if self.fan_tray_index<=6: + index1=self.fan_tray_index + speed = 0 + if self.get_presence(): + fan_speed_file = (FAN_PATH + + self.fan_speed_rpm.format(index1+1,"front")) + speed = self.__read_txt_file(fan_speed_file).strip('\r\n') + else: + index1=self.fan_tray_index%7 + if self.get_presence(): + fan_speed_file = (FAN_PATH + + self.fan_speed_rpm.format(index1+1,"rear")) + speed = self.__read_txt_file(fan_speed_file).strip('\r\n') + + return int(speed) + + def get_target_speed(self): + """ + Retrieves the target (expected) speed of the fan + Returns: + An integer, the percentage of full fan speed, in the range 0 (off) + to 100 (full speed) + """ + if self.fan_tray_index<=6: + index1=self.fan_tray_index + speed = 0 + if self.get_presence(): + fan_speed_file = (FAN_PATH + + self.fan_speed_rpm.format(index1+1,"front")) + speed = self.__read_txt_file(fan_speed_file).strip('\r\n') + else: + index1=self.fan_tray_index%7 + if self.get_presence(): + fan_speed_file = (FAN_PATH + + self.fan_speed_rpm.format(index1+1,"rear")) + speed = self.__read_txt_file(fan_speed_file).strip('\r\n') + + return int(speed) + + def get_speed_tolerance(self): + """ + Retrieves the speed tolerance of the fan + Returns: + An integer, the percentage of variance from target speed which is + considered tolerable + """ + return 10 + + def set_speed(self, speed): + """ + Sets the fan speed + Args: + speed: An integer, the percentage of full fan speed to set fan to, + in the range 0 (off) to 100 (full speed) + Returns: + A boolean, True if speed is set successfully, False if not + + Note: + Depends on pwm or target mode is selected: + 1) pwm = speed_pc * 255 <-- Currently use this mode. + 2) target_pwm = speed_pc * 100 / 255 + 2.1) set pwm{}_enable to 3 + + """ + return False + + def set_status_led(self, color): + """ + Sets the state of the fan module status LED + Args: + color: A string representing the color with which to set the + fan module status LED + Returns: + bool: True if status LED state is set successfully, False if not + """ + return False + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + fan_name = FAN_NAME_LIST[self.fan_tray_index] + + return fan_name + + def get_presence(self): + """ + Retrieves the presence of the PSU + Returns: + bool: True if PSU is present, False if not + """ + index1=self.fan_tray_index + if self.fan_tray_index>6: + index1=self.fan_tray_index%7 + fan_direction_file = (FAN_PATH + + self.fan_presence.format(index1+1)) + present_str = self.__read_txt_file(fan_direction_file) or '1' + + return int(present_str) == 1 + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + return self.get_presence() and self.get_speed() > 0 diff --git a/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/sonic_platform/platform.py b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/sonic_platform/platform.py new file mode 100755 index 0000000000..44e03cdadb --- /dev/null +++ b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/sonic_platform/platform.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python + +############################################################################# +# Module contains an implementation of SONiC Platform Base API and +# provides the platform information +# +############################################################################# + +try: + from sonic_platform_base.platform_base import PlatformBase + from sonic_platform.chassis import Chassis +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +class Platform(PlatformBase): + """Platform-specific Platform class""" + + def __init__(self): + PlatformBase.__init__(self) + self._chassis = Chassis() diff --git a/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/sonic_platform/psu.py b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/sonic_platform/psu.py new file mode 100755 index 0000000000..975cf8845e --- /dev/null +++ b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/sonic_platform/psu.py @@ -0,0 +1,97 @@ +#!/usr/bin/env python + +############################################################################# +# psuutil.py +# Platform-specific PSU status interface for SONiC +############################################################################# + +try: + from sonic_platform_base.psu_base import PsuBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +PSU_NAME_LIST = ["PSU-1", "PSU-2"] + +class Psu(PsuBase): + """Platform-specific Psu class""" + + SYSFS_PSU_DIR = ["/sys/bus/i2c/devices/0-0051", + "/sys/bus/i2c/devices/0-0052"] + + def __init__(self, psu_index): + self.index = psu_index + PsuBase.__init__(self) + + + def get_fan(self): + """ + Retrieves object representing the fan module contained in this PSU + Returns: + An object dervied from FanBase representing the fan module + contained in this PSU + """ + # Hardware not supported + return False + + def get_powergood_status(self): + """ + Retrieves the powergood status of PSU + Returns: + A boolean, True if PSU has stablized its output voltages and passed all + its internal self-tests, False if not. + """ + return self.get_status() + + def set_status_led(self, color): + """ + Sets the state of the PSU status LED + Args: + color: A string representing the color with which to set the PSU status LED + Note: Only support green and off + Returns: + bool: True if status LED state is set successfully, False if not + """ + # Hardware not supported + return False + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + return PSU_NAME_LIST[self.index] + + def get_presence(self): + """ + Retrieves the presence of the PSU + Returns: + bool: True if PSU is present, False if not + """ + attr_file ='psu_present' + attr_path = self.SYSFS_PSU_DIR[self.index-1] +'/' + attr_file + status = 0 + try: + with open(attr_path, 'r') as psu_prs: + status = int(psu_prs.read()) + except IOError: + return False + + return status == 1 + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + attr_file = 'psu_power_good' + attr_path = self.SYSFS_PSU_DIR[self.index-1] +'/' + attr_file + status = 0 + try: + with open(attr_path, 'r') as power_status: + status = int(power_status.read()) + except IOError: + return False + + return status == 1 diff --git a/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/sonic_platform/sfp.py b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/sonic_platform/sfp.py new file mode 100755 index 0000000000..dea6ac8833 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/sonic_platform/sfp.py @@ -0,0 +1,1438 @@ +#!/usr/bin/env python + +############################################################################# +# Sfp contains an implementation of SONiC Platform Base API and +# provides the sfp device status which are available in the platform +############################################################################# +try: + from sonic_platform_base.sfp_base import SfpBase + from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId + from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom + from sonic_platform_base.sonic_sfp.qsfp_dd import qsfp_dd_InterfaceId + from sonic_platform_base.sonic_sfp.qsfp_dd import qsfp_dd_Dom + from sonic_py_common.logger import Logger +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +# definitions of the offset and width for values in XCVR info eeprom +XCVR_INTFACE_BULK_OFFSET = 0 +XCVR_INTFACE_BULK_WIDTH_QSFP = 20 +XCVR_INTFACE_BULK_WIDTH_SFP = 21 +XCVR_TYPE_OFFSET = 0 +XCVR_TYPE_WIDTH = 1 +XCVR_EXT_TYPE_OFFSET = 1 +XCVR_EXT_TYPE_WIDTH = 1 +XCVR_CONNECTOR_OFFSET = 2 +XCVR_CONNECTOR_WIDTH = 1 +XCVR_COMPLIANCE_CODE_OFFSET = 3 +XCVR_COMPLIANCE_CODE_WIDTH = 8 +XCVR_ENCODING_OFFSET = 11 +XCVR_ENCODING_WIDTH = 1 +XCVR_NBR_OFFSET = 12 +XCVR_NBR_WIDTH = 1 +XCVR_EXT_RATE_SEL_OFFSET = 13 +XCVR_EXT_RATE_SEL_WIDTH = 1 +XCVR_CABLE_LENGTH_OFFSET = 14 +XCVR_CABLE_LENGTH_WIDTH_QSFP = 5 +XCVR_CABLE_LENGTH_WIDTH_SFP = 6 +XCVR_VENDOR_NAME_OFFSET = 20 +XCVR_VENDOR_NAME_WIDTH = 16 +XCVR_VENDOR_OUI_OFFSET = 37 +XCVR_VENDOR_OUI_WIDTH = 3 +XCVR_VENDOR_PN_OFFSET = 40 +XCVR_VENDOR_PN_WIDTH = 16 +XCVR_HW_REV_OFFSET = 56 +XCVR_HW_REV_WIDTH_OSFP = 2 +XCVR_HW_REV_WIDTH_QSFP = 2 +XCVR_HW_REV_WIDTH_SFP = 4 +XCVR_EXT_SPECIFICATION_COMPLIANCE_OFFSET = 64 +XCVR_EXT_SPECIFICATION_COMPLIANCE_WIDTH = 1 +XCVR_VENDOR_SN_OFFSET = 68 +XCVR_VENDOR_SN_WIDTH = 16 +XCVR_VENDOR_DATE_OFFSET = 84 +XCVR_VENDOR_DATE_WIDTH = 8 +XCVR_DOM_CAPABILITY_OFFSET = 92 +XCVR_DOM_CAPABILITY_WIDTH = 2 + +# definitions of the offset and width for values in XCVR_QSFP_DD info eeprom +XCVR_EXT_TYPE_OFFSET_QSFP_DD = 72 +XCVR_EXT_TYPE_WIDTH_QSFP_DD = 2 +XCVR_CONNECTOR_OFFSET_QSFP_DD = 75 +XCVR_CONNECTOR_WIDTH_QSFP_DD = 1 +XCVR_CABLE_LENGTH_OFFSET_QSFP_DD = 74 +XCVR_CABLE_LENGTH_WIDTH_QSFP_DD = 1 +XCVR_HW_REV_OFFSET_QSFP_DD = 36 +XCVR_HW_REV_WIDTH_QSFP_DD = 2 +XCVR_VENDOR_DATE_OFFSET_QSFP_DD = 54 +XCVR_VENDOR_DATE_WIDTH_QSFP_DD = 8 +XCVR_DOM_CAPABILITY_OFFSET_QSFP_DD = 2 +XCVR_DOM_CAPABILITY_WIDTH_QSFP_DD = 1 +XCVR_MEDIA_TYPE_OFFSET_QSFP_DD = 85 +XCVR_MEDIA_TYPE_WIDTH_QSFP_DD = 1 +XCVR_FIRST_APPLICATION_LIST_OFFSET_QSFP_DD = 86 +XCVR_FIRST_APPLICATION_LIST_WIDTH_QSFP_DD = 32 +XCVR_SECOND_APPLICATION_LIST_OFFSET_QSFP_DD = 351 +XCVR_SECOND_APPLICATION_LIST_WIDTH_QSFP_DD = 28 + +XCVR_INTERFACE_DATA_START = 0 +XCVR_INTERFACE_DATA_SIZE = 92 +SFP_MODULE_ADDRA2_OFFSET = 256 +SFP_MODULE_THRESHOLD_OFFSET = 0 +SFP_MODULE_THRESHOLD_WIDTH = 56 + +QSFP_DOM_BULK_DATA_START = 22 +QSFP_DOM_BULK_DATA_SIZE = 36 +SFP_DOM_BULK_DATA_START = 96 +SFP_DOM_BULK_DATA_SIZE = 10 + +QSFP_DD_DOM_BULK_DATA_START = 14 +QSFP_DD_DOM_BULK_DATA_SIZE = 4 + +# definitions of the offset for values in OSFP info eeprom +OSFP_TYPE_OFFSET = 0 +OSFP_VENDOR_NAME_OFFSET = 129 +OSFP_VENDOR_PN_OFFSET = 148 +OSFP_HW_REV_OFFSET = 164 +OSFP_VENDOR_SN_OFFSET = 166 + +# definitions of the offset for values in QSFP_DD info eeprom +QSFP_DD_TYPE_OFFSET = 0 +QSFP_DD_VENDOR_NAME_OFFSET = 1 +QSFP_DD_VENDOR_PN_OFFSET = 20 +QSFP_DD_VENDOR_SN_OFFSET = 38 +QSFP_DD_VENDOR_OUI_OFFSET = 17 + +#definitions of the offset and width for values in DOM info eeprom +QSFP_DOM_REV_OFFSET = 1 +QSFP_DOM_REV_WIDTH = 1 +QSFP_TEMPE_OFFSET = 22 +QSFP_TEMPE_WIDTH = 2 +QSFP_VOLT_OFFSET = 26 +QSFP_VOLT_WIDTH = 2 +QSFP_VERSION_COMPLIANCE_OFFSET = 1 +QSFP_VERSION_COMPLIANCE_WIDTH = 2 +QSFP_CHANNL_MON_OFFSET = 34 +QSFP_CHANNL_MON_WIDTH = 16 +QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH = 24 +QSFP_CHANNL_DISABLE_STATUS_OFFSET = 86 +QSFP_CHANNL_DISABLE_STATUS_WIDTH = 1 +QSFP_CHANNL_RX_LOS_STATUS_OFFSET = 3 +QSFP_CHANNL_RX_LOS_STATUS_WIDTH = 1 +QSFP_CHANNL_TX_FAULT_STATUS_OFFSET = 4 +QSFP_CHANNL_TX_FAULT_STATUS_WIDTH = 1 +QSFP_CONTROL_OFFSET = 86 +QSFP_CONTROL_WIDTH = 8 +QSFP_MODULE_MONITOR_OFFSET = 0 +QSFP_MODULE_MONITOR_WIDTH = 9 +QSFP_POWEROVERRIDE_OFFSET = 93 +QSFP_POWEROVERRIDE_WIDTH = 1 +QSFP_POWEROVERRIDE_BIT = 0 +QSFP_POWERSET_BIT = 1 +QSFP_OPTION_VALUE_OFFSET = 192 +QSFP_OPTION_VALUE_WIDTH = 4 + +QSFP_MODULE_UPPER_PAGE3_START = 384 +QSFP_MODULE_THRESHOLD_OFFSET = 128 +QSFP_MODULE_THRESHOLD_WIDTH = 24 +QSFP_CHANNL_THRESHOLD_OFFSET = 176 +QSFP_CHANNL_THRESHOLD_WIDTH = 24 + +#definitions of the offset and width for values in DOM info eeprom +QSFP_DD_TEMPE_OFFSET = 14 +QSFP_DD_TEMPE_WIDTH = 2 +QSFP_DD_VOLT_OFFSET = 16 +QSFP_DD_VOLT_WIDTH = 2 +QSFP_DD_TX_BIAS_OFFSET = 42 +QSFP_DD_TX_BIAS_WIDTH = 16 +QSFP_DD_RX_POWER_OFFSET = 58 +QSFP_DD_RX_POWER_WIDTH = 16 +QSFP_DD_TX_POWER_OFFSET = 26 +QSFP_DD_TX_POWER_WIDTH = 16 +QSFP_DD_CHANNL_MON_OFFSET = 154 +QSFP_DD_CHANNL_MON_WIDTH = 48 +QSFP_DD_CHANNL_DISABLE_STATUS_OFFSET = 86 +QSFP_DD_CHANNL_DISABLE_STATUS_WIDTH = 1 +QSFP_DD_CHANNL_RX_LOS_STATUS_OFFSET = 19 +QSFP_DD_CHANNL_RX_LOS_STATUS_WIDTH = 1 +QSFP_DD_CHANNL_TX_FAULT_STATUS_OFFSET = 7 +QSFP_DD_CHANNL_TX_FAULT_STATUS_WIDTH = 1 +QSFP_DD_MODULE_THRESHOLD_OFFSET = 0 +QSFP_DD_MODULE_THRESHOLD_WIDTH = 72 +QSFP_DD_CHANNL_STATUS_OFFSET = 26 +QSFP_DD_CHANNL_STATUS_WIDTH = 1 + +QSFP_TYPE_CODE_LIST = [ + '0d', # QSFP+ or later + '11' # QSFP28 or later +] + +QSFP_DD_TYPE_CODE_LIST = [ + '18' # QSFP-DD Double Density 8X Pluggable Transceiver +] + +qsfp_cable_length_tup = ('Length(km)', 'Length OM3(2m)', + 'Length OM2(m)', 'Length OM1(m)', + 'Length Cable Assembly(m)') + +sfp_cable_length_tup = ('LengthSMFkm-UnitsOfKm', 'LengthSMF(UnitsOf100m)', + 'Length50um(UnitsOf10m)', 'Length62.5um(UnitsOfm)', + 'LengthCable(UnitsOfm)', 'LengthOM3(UnitsOf10m)') + +sfp_compliance_code_tup = ('10GEthernetComplianceCode', 'InfinibandComplianceCode', + 'ESCONComplianceCodes', 'SONETComplianceCodes', + 'EthernetComplianceCodes','FibreChannelLinkLength', + 'FibreChannelTechnology', 'SFP+CableTechnology', + 'FibreChannelTransmissionMedia','FibreChannelSpeed') + +qsfp_compliance_code_tup = ('10/40G Ethernet Compliance Code', 'SONET Compliance codes', + 'SAS/SATA compliance codes', 'Gigabit Ethernet Compliant codes', + 'Fibre Channel link length/Transmitter Technology', + 'Fibre Channel transmission media', 'Fibre Channel Speed') + +QSFP_TYPE = "QSFP" +QSFP_DD_TYPE = "QSFP_DD" + +# Global logger class instance +logger = Logger() + +class Sfp(SfpBase): + """Platform-specific Sfp class""" + + # Port number + PORT_START = 0 + PORT_END = 31 + + port_to_i2c_mapping = { + 0: 10, + 1: 11, + 2: 12, + 3: 13, + 4: 14, + 5: 15, + 6: 16, + 7: 17, + 8: 18, + 9: 19, + 10: 20, + 11: 21, + 12: 22, + 13: 23, + 14: 24, + 15: 25, + 16: 26, + 17: 27, + 18: 28, + 19: 29, + 20: 30, + 21: 31, + 22: 32, + 23: 33, + 24: 34, + 25: 35, + 26: 36, + 27: 37, + 28: 38, + 29: 39, + 30: 40, + 31: 41, + } + + _sfp_port = range(32, PORT_END + 1) + RESET_1_16_PATH = "/sys/bus/i2c/devices/0-0061/module_reset_{}" + RESET_17_32_PATH = "/sys/bus/i2c/devices/0-0062/module_reset_{}" + PRS_1_16_PATH = "/sys/bus/i2c/devices/0-0061/module_present_{}" + PRS_17_32_PATH = "/sys/bus/i2c/devices/0-0062/module_present_{}" + + def __init__(self, sfp_index, sfp_type): + # Init index + self.index = sfp_index + self.port_num = self.index + 1 + + # Init eeprom path + eeprom1_path = '/sys/bus/i2c/devices/0-00{}/eeprom1' + eeprom2_path = '/sys/bus/i2c/devices/0-00{}/eeprom2' + name_path = '/sys/bus/i2c/devices/0-00{}/port_name' + self.port_to_eeprom1_mapping = {} + self.port_to_eeprom2_mapping = {} + self.port_to_name_mapping = {} + for x in range(self.PORT_START, self.PORT_END + 1): + p_num = x - 1 if self.PORT_START == 1 else x + self.port_to_eeprom1_mapping[p_num] = eeprom1_path.format(self.port_to_i2c_mapping[p_num]) + self.port_to_eeprom2_mapping[p_num] = eeprom2_path.format(self.port_to_i2c_mapping[p_num]) + self.port_to_name_mapping[p_num] = name_path.format(self.port_to_i2c_mapping[p_num]) + + self._detect_sfp_type(sfp_type) + self._dom_capability_detect() + SfpBase.__init__(self) + + def reinit(self): + self._detect_sfp_type(self.sfp_type) + self._dom_capability_detect() + + def get_presence(self): + """ + Retrieves the presence of the SFP + Returns: + bool: True if SFP is present, False if not + """ + presence = False + try: + if self.index < 16: + pres_path=self.PRS_1_16_PATH.format(self.port_num) + else: + pres_path=self.PRS_17_32_PATH.format(self.port_num) + with open(pres_path, 'r') as sfp_presence: + presence = int(sfp_presence.read(), 16) + except IOError: + return False + logger.log_info("debug:port_ %s sfp presence is %s" % (str(self.index), str(presence))) + return presence + + def _read_eeprom_specific_bytes(self, offset, num_bytes): + sysfsfile_eeprom = None + eeprom_raw = [] + for i in range(0, num_bytes): + eeprom_raw.append("0x00") + + if offset < 256: + sysfs_sfp_i2c_client_eeprom_path = self.port_to_eeprom1_mapping[self.index] + else: + sysfs_sfp_i2c_client_eeprom_path = self.port_to_eeprom2_mapping[self.index] + offset = offset - 256 + + try: + sysfsfile_eeprom = open(sysfs_sfp_i2c_client_eeprom_path, mode="rb", buffering=0) + sysfsfile_eeprom.seek(offset) + raw = sysfsfile_eeprom.read(num_bytes) + for n in range(0, num_bytes): + eeprom_raw[n] = hex(ord(raw[n]))[2:].zfill(2) + except BaseException: + pass + finally: + if sysfsfile_eeprom: + sysfsfile_eeprom.close() + + return eeprom_raw + + def _detect_sfp_type(self, sfp_type): + eeprom_raw = [] + eeprom_raw = self._read_eeprom_specific_bytes(XCVR_TYPE_OFFSET, XCVR_TYPE_WIDTH) + if eeprom_raw: + if eeprom_raw[0] in QSFP_TYPE_CODE_LIST: + self.sfp_type = QSFP_TYPE + elif eeprom_raw[0] in QSFP_DD_TYPE_CODE_LIST: + self.sfp_type = QSFP_DD_TYPE + else: + # we don't regonize this identifier value, treat the xSFP module as the default type + self.sfp_type = sfp_type + logger.log_info("Identifier value of {} module {} is {} which isn't regonized and will be treated as default type ({})".format( + sfp_type, self.index, eeprom_raw[0], sfp_type + )) + else: + # eeprom_raw being None indicates the module is not present. + # in this case we treat it as the default type according to the SKU + self.sfp_type = sfp_type + + def _dom_capability_detect(self): + if not self.get_presence(): + self.dom_supported = False + self.dom_temp_supported = False + self.dom_volt_supported = False + self.dom_rx_power_supported = False + self.dom_tx_bias_power_supported = False + self.dom_tx_power_supported = False + self.calibration = 0 + return + + self.dom_channel_monitor_supported = False + self.dom_module_monitor_supported = True + self.dom_channel_treshold_supported = False + self.dom_module_treshold_supported =False + + if self.sfp_type == QSFP_TYPE: + self.calibration = 1 + sfpi_obj = sff8436InterfaceId() + if sfpi_obj is None: + self.dom_supported = False + offset = 128 + + # QSFP capability byte parse, through this byte can know whether it support tx_power or not. + # TODO: in the future when decided to migrate to support SFF-8636 instead of SFF-8436, + # need to add more code for determining the capability and version compliance + # in SFF-8636 dom capability definitions evolving with the versions. + qsfp_dom_capability_raw = self._read_eeprom_specific_bytes((offset + XCVR_DOM_CAPABILITY_OFFSET), XCVR_DOM_CAPABILITY_WIDTH) + if qsfp_dom_capability_raw is not None: + qsfp_version_compliance_raw = self._read_eeprom_specific_bytes(QSFP_VERSION_COMPLIANCE_OFFSET, QSFP_VERSION_COMPLIANCE_WIDTH) + qsfp_version_compliance = int(qsfp_version_compliance_raw[0], 16) + dom_capability = sfpi_obj.parse_qsfp_dom_capability(qsfp_dom_capability_raw, 0) + if qsfp_version_compliance >= 0x08: + self.dom_temp_supported = dom_capability['data']['Temp_support']['value'] == 'On' + self.dom_volt_supported = dom_capability['data']['Voltage_support']['value'] == 'On' + self.dom_rx_power_supported = dom_capability['data']['Rx_power_support']['value'] == 'On' + self.dom_tx_power_supported = dom_capability['data']['Tx_power_support']['value'] == 'On' + else: + self.dom_temp_supported = True + self.dom_volt_supported = True + self.dom_rx_power_supported = dom_capability['data']['Rx_power_support']['value'] == 'On' + self.dom_tx_power_supported = True + self.dom_supported = True + self.calibration = 1 + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return None + qsfp_option_value_raw = self._read_eeprom_specific_bytes(QSFP_OPTION_VALUE_OFFSET, QSFP_OPTION_VALUE_WIDTH) + if qsfp_option_value_raw is not None: + optional_capability = sfpd_obj.parse_option_params(qsfp_option_value_raw, 0) + self.dom_tx_disable_supported = optional_capability['data']['TxDisable']['value'] == 'On' + dom_status_indicator = sfpd_obj.parse_dom_status_indicator(qsfp_version_compliance_raw, 1) + self.qsfp_page3_available = dom_status_indicator['data']['FlatMem']['value'] == 'Off' + else: + self.dom_supported = False + self.dom_temp_supported = False + self.dom_volt_supported = False + self.dom_rx_power_supported = False + self.dom_tx_power_supported = False + self.calibration = 0 + self.qsfp_page3_available = False + + elif self.sfp_type == QSFP_DD_TYPE: + sfpi_obj = qsfp_dd_InterfaceId() + if sfpi_obj is None: + self.dom_supported = False + + offset = 0 + # two types of QSFP-DD cable types supported: Copper and Optical. + qsfp_dom_capability_raw = self._read_eeprom_specific_bytes((offset + XCVR_DOM_CAPABILITY_OFFSET_QSFP_DD), XCVR_DOM_CAPABILITY_WIDTH_QSFP_DD) + if qsfp_dom_capability_raw is not None: + self.dom_temp_supported = True + self.dom_volt_supported = True + dom_capability = sfpi_obj.parse_qsfp_dom_capability(qsfp_dom_capability_raw, 0) + if dom_capability['data']['Flat_MEM']['value'] == 'Off': + self.dom_supported = False + self.dom_rx_power_supported = False + self.dom_tx_power_supported = False + self.dom_tx_bias_power_supported = False + self.dom_thresholds_supported = False + else: + self.dom_supported = False + self.dom_rx_power_supported = False + self.dom_tx_power_supported = False + self.dom_tx_bias_power_supported = False + self.dom_thresholds_supported = False + else: + self.dom_supported = False + self.dom_temp_supported = False + self.dom_volt_supported = False + self.dom_rx_power_supported = False + self.dom_tx_power_supported = False + self.dom_tx_bias_power_supported = False + self.dom_thresholds_supported = False + + else: + self.dom_supported = False + self.dom_temp_supported = False + self.dom_volt_supported = False + self.dom_rx_power_supported = False + self.dom_tx_power_supported = False + + def _convert_string_to_num(self, value_str): + if "-inf" in value_str: + return 'N/A' + elif "Unknown" in value_str: + return 'N/A' + elif 'dBm' in value_str: + t_str = value_str.rstrip('dBm') + return float(t_str) + elif 'mA' in value_str: + t_str = value_str.rstrip('mA') + return float(t_str) + elif 'C' in value_str: + t_str = value_str.rstrip('C') + return float(t_str) + elif 'Volts' in value_str: + t_str = value_str.rstrip('Volts') + return float(t_str) + else: + return 'N/A' + + def get_transceiver_info(self): + """ + Retrieves transceiver info of this SFP + + Returns: + A dict which contains following keys/values : + ================================================================================ + keys |Value Format |Information + ---------------------------|---------------|---------------------------- + type |1*255VCHAR |type of SFP + hardware_rev |1*255VCHAR |hardware version of SFP + serial |1*255VCHAR |serial number of the SFP + manufacturer |1*255VCHAR |SFP vendor name + model |1*255VCHAR |SFP model name + connector |1*255VCHAR |connector information + encoding |1*255VCHAR |encoding information + ext_identifier |1*255VCHAR |extend identifier + ext_rateselect_compliance |1*255VCHAR |extended rateSelect compliance + cable_length |INT |cable length in m + mominal_bit_rate |INT |nominal bit rate by 100Mbs + specification_compliance |1*255VCHAR |specification compliance + vendor_date |1*255VCHAR |vendor date + vendor_oui |1*255VCHAR |vendor OUI + application_advertisement |1*255VCHAR |supported applications advertisement + ================================================================================ + """ + transceiver_info_dict = {} + compliance_code_dict = {} + + #QSFP + if self.sfp_type == QSFP_TYPE: + offset = 128 + vendor_rev_width = XCVR_HW_REV_WIDTH_QSFP + interface_info_bulk_width = XCVR_INTFACE_BULK_WIDTH_QSFP + + sfpi_obj = sff8436InterfaceId() + if sfpi_obj is None: + print("Error: sfp_object open failed") + return None + + sfp_interface_bulk_raw = self._read_eeprom_specific_bytes(offset + XCVR_INTERFACE_DATA_START, XCVR_INTERFACE_DATA_SIZE) + if sfp_interface_bulk_raw is None: + return None + + start = XCVR_INTFACE_BULK_OFFSET - XCVR_INTERFACE_DATA_START + end = start + interface_info_bulk_width + sfp_interface_bulk_data = sfpi_obj.parse_sfp_info_bulk(sfp_interface_bulk_raw[start : end], 0) + + start = XCVR_VENDOR_NAME_OFFSET - XCVR_INTERFACE_DATA_START + end = start + XCVR_VENDOR_NAME_WIDTH + sfp_vendor_name_data = sfpi_obj.parse_vendor_name(sfp_interface_bulk_raw[start : end], 0) + + start = XCVR_VENDOR_PN_OFFSET - XCVR_INTERFACE_DATA_START + end = start + XCVR_VENDOR_PN_WIDTH + sfp_vendor_pn_data = sfpi_obj.parse_vendor_pn(sfp_interface_bulk_raw[start : end], 0) + + start = XCVR_HW_REV_OFFSET - XCVR_INTERFACE_DATA_START + end = start + vendor_rev_width + sfp_vendor_rev_data = sfpi_obj.parse_vendor_rev(sfp_interface_bulk_raw[start : end], 0) + + start = XCVR_VENDOR_SN_OFFSET - XCVR_INTERFACE_DATA_START + end = start + XCVR_VENDOR_SN_WIDTH + sfp_vendor_sn_data = sfpi_obj.parse_vendor_sn(sfp_interface_bulk_raw[start : end], 0) + + start = XCVR_VENDOR_OUI_OFFSET - XCVR_INTERFACE_DATA_START + end = start + XCVR_VENDOR_OUI_WIDTH + sfp_vendor_oui_data = sfpi_obj.parse_vendor_oui(sfp_interface_bulk_raw[start : end], 0) + + start = XCVR_VENDOR_DATE_OFFSET - XCVR_INTERFACE_DATA_START + end = start + XCVR_VENDOR_DATE_WIDTH + sfp_vendor_date_data = sfpi_obj.parse_vendor_date(sfp_interface_bulk_raw[start : end], 0) + + transceiver_info_dict['type'] = sfp_interface_bulk_data['data']['type']['value'] + transceiver_info_dict['manufacturer'] = sfp_vendor_name_data['data']['Vendor Name']['value'] + transceiver_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] + transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] + transceiver_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] + transceiver_info_dict['vendor_oui'] = sfp_vendor_oui_data['data']['Vendor OUI']['value'] + transceiver_info_dict['vendor_date'] = sfp_vendor_date_data['data']['VendorDataCode(YYYY-MM-DD Lot)']['value'] + transceiver_info_dict['connector'] = sfp_interface_bulk_data['data']['Connector']['value'] + transceiver_info_dict['encoding'] = sfp_interface_bulk_data['data']['EncodingCodes']['value'] + transceiver_info_dict['ext_identifier'] = sfp_interface_bulk_data['data']['Extended Identifier']['value'] + transceiver_info_dict['ext_rateselect_compliance'] = sfp_interface_bulk_data['data']['RateIdentifier']['value'] + transceiver_info_dict['application_advertisement'] = 'N/A' + + for key in qsfp_cable_length_tup: + if key in sfp_interface_bulk_data['data']: + transceiver_info_dict['cable_type'] = key + transceiver_info_dict['cable_length'] = str(sfp_interface_bulk_data['data'][key]['value']) + + for key in qsfp_compliance_code_tup: + if key in sfp_interface_bulk_data['data']['Specification compliance']['value']: + compliance_code_dict[key] = sfp_interface_bulk_data['data']['Specification compliance']['value'][key]['value'] + sfp_ext_specification_compliance_raw = self._read_eeprom_specific_bytes(offset + XCVR_EXT_SPECIFICATION_COMPLIANCE_OFFSET, XCVR_EXT_SPECIFICATION_COMPLIANCE_WIDTH) + if sfp_ext_specification_compliance_raw is not None: + sfp_ext_specification_compliance_data = sfpi_obj.parse_ext_specification_compliance(sfp_ext_specification_compliance_raw[0 : 1], 0) + if sfp_ext_specification_compliance_data['data']['Extended Specification compliance']['value'] != "Unspecified": + compliance_code_dict['Extended Specification compliance'] = sfp_ext_specification_compliance_data['data']['Extended Specification compliance']['value'] + transceiver_info_dict['specification_compliance'] = str(compliance_code_dict) + transceiver_info_dict['nominal_bit_rate'] = str(sfp_interface_bulk_data['data']['Nominal Bit Rate(100Mbs)']['value']) + + #QSFP-DD + else: + offset = 128 + + sfpi_obj = qsfp_dd_InterfaceId() + if sfpi_obj is None: + print("Error: sfp_object open failed") + return None + + sfp_type_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_TYPE_OFFSET), XCVR_TYPE_WIDTH) + if sfp_type_raw is not None: + sfp_type_data = sfpi_obj.parse_sfp_type(sfp_type_raw, 0) + else: + return None + + sfp_vendor_name_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_VENDOR_NAME_OFFSET), XCVR_VENDOR_NAME_WIDTH) + if sfp_vendor_name_raw is not None: + sfp_vendor_name_data = sfpi_obj.parse_vendor_name(sfp_vendor_name_raw, 0) + else: + return None + + sfp_vendor_pn_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_VENDOR_PN_OFFSET), XCVR_VENDOR_PN_WIDTH) + if sfp_vendor_pn_raw is not None: + sfp_vendor_pn_data = sfpi_obj.parse_vendor_pn(sfp_vendor_pn_raw, 0) + else: + return None + + sfp_vendor_rev_raw = self._read_eeprom_specific_bytes((offset + XCVR_HW_REV_OFFSET_QSFP_DD), XCVR_HW_REV_WIDTH_QSFP_DD) + if sfp_vendor_rev_raw is not None: + sfp_vendor_rev_data = sfpi_obj.parse_vendor_rev(sfp_vendor_rev_raw, 0) + else: + return None + + sfp_vendor_sn_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_VENDOR_SN_OFFSET), XCVR_VENDOR_SN_WIDTH) + if sfp_vendor_sn_raw is not None: + sfp_vendor_sn_data = sfpi_obj.parse_vendor_sn(sfp_vendor_sn_raw, 0) + else: + return None + + sfp_vendor_oui_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_VENDOR_OUI_OFFSET), XCVR_VENDOR_OUI_WIDTH) + if sfp_vendor_oui_raw is not None: + sfp_vendor_oui_data = sfpi_obj.parse_vendor_oui(sfp_vendor_oui_raw, 0) + else: + return None + + sfp_vendor_date_raw = self._read_eeprom_specific_bytes((offset + XCVR_VENDOR_DATE_OFFSET_QSFP_DD), XCVR_VENDOR_DATE_WIDTH_QSFP_DD) + if sfp_vendor_date_raw is not None: + sfp_vendor_date_data = sfpi_obj.parse_vendor_date(sfp_vendor_date_raw, 0) + else: + return None + + sfp_connector_raw = self._read_eeprom_specific_bytes((offset + XCVR_CONNECTOR_OFFSET_QSFP_DD), XCVR_CONNECTOR_WIDTH_QSFP_DD) + if sfp_connector_raw is not None: + sfp_connector_data = sfpi_obj.parse_connector(sfp_connector_raw, 0) + else: + return None + + sfp_ext_identifier_raw = self._read_eeprom_specific_bytes((offset + XCVR_EXT_TYPE_OFFSET_QSFP_DD), XCVR_EXT_TYPE_WIDTH_QSFP_DD) + if sfp_ext_identifier_raw is not None: + sfp_ext_identifier_data = sfpi_obj.parse_ext_iden(sfp_ext_identifier_raw, 0) + else: + return None + + sfp_cable_len_raw = self._read_eeprom_specific_bytes((offset + XCVR_CABLE_LENGTH_OFFSET_QSFP_DD), XCVR_CABLE_LENGTH_WIDTH_QSFP_DD) + if sfp_cable_len_raw is not None: + sfp_cable_len_data = sfpi_obj.parse_cable_len(sfp_cable_len_raw, 0) + else: + return None + + sfp_media_type_raw = self._read_eeprom_specific_bytes(XCVR_MEDIA_TYPE_OFFSET_QSFP_DD, XCVR_MEDIA_TYPE_WIDTH_QSFP_DD) + if sfp_media_type_raw is not None: + sfp_media_type_dict = sfpi_obj.parse_media_type(sfp_media_type_raw, 0) + if sfp_media_type_dict is None: + return None + + host_media_list = "" + sfp_application_type_first_list = self._read_eeprom_specific_bytes((XCVR_FIRST_APPLICATION_LIST_OFFSET_QSFP_DD), XCVR_FIRST_APPLICATION_LIST_WIDTH_QSFP_DD) + possible_application_count = 8 + if sfp_application_type_first_list is not None: + sfp_application_type_list = sfp_application_type_first_list + else: + return None + + for i in range(0, possible_application_count): + if sfp_application_type_list[i * 4] == 'ff': + break + host_electrical, media_interface = sfpi_obj.parse_application(sfp_media_type_dict, sfp_application_type_list[i * 4], sfp_application_type_list[i * 4 + 1]) + host_media_list = host_media_list + host_electrical + ' - ' + media_interface + '\n\t\t\t\t ' + else: + return None + + transceiver_info_dict['type'] = str(sfp_type_data['data']['type']['value']) + transceiver_info_dict['manufacturer'] = str(sfp_vendor_name_data['data']['Vendor Name']['value']) + transceiver_info_dict['model'] = str(sfp_vendor_pn_data['data']['Vendor PN']['value']) + transceiver_info_dict['hardware_rev'] = str(sfp_vendor_rev_data['data']['Vendor Rev']['value']) + transceiver_info_dict['serial'] = str(sfp_vendor_sn_data['data']['Vendor SN']['value']) + transceiver_info_dict['vendor_oui'] = str(sfp_vendor_oui_data['data']['Vendor OUI']['value']) + transceiver_info_dict['vendor_date'] = str(sfp_vendor_date_data['data']['VendorDataCode(YYYY-MM-DD Lot)']['value']) + transceiver_info_dict['connector'] = str(sfp_connector_data['data']['Connector']['value']) + transceiver_info_dict['encoding'] = "Not supported for CMIS cables" + transceiver_info_dict['ext_identifier'] = str(sfp_ext_identifier_data['data']['Extended Identifier']['value']) + transceiver_info_dict['ext_rateselect_compliance'] = "Not supported for CMIS cables" + transceiver_info_dict['specification_compliance'] = "Not supported for CMIS cables" + transceiver_info_dict['cable_type'] = "Length Cable Assembly(m)" + transceiver_info_dict['cable_length'] = str(sfp_cable_len_data['data']['Length Cable Assembly(m)']['value']) + transceiver_info_dict['nominal_bit_rate'] = "Not supported for CMIS cables" + transceiver_info_dict['application_advertisement'] = host_media_list + + return transceiver_info_dict + + def get_transceiver_bulk_status(self): + """ + Retrieves transceiver bulk status of this SFP + + Returns: + A dict which contains following keys/values : + ======================================================================== + keys |Value Format |Information + ---------------------------|---------------|---------------------------- + RX LOS |BOOLEAN |RX lost-of-signal status, + | |True if has RX los, False if not. + TX FAULT |BOOLEAN |TX fault status, + | |True if has TX fault, False if not. + Reset status |BOOLEAN |reset status, + | |True if SFP in reset, False if not. + LP mode |BOOLEAN |low power mode status, + | |True in lp mode, False if not. + TX disable |BOOLEAN |TX disable status, + | |True TX disabled, False if not. + TX disabled channel |HEX |disabled TX channles in hex, + | |bits 0 to 3 represent channel 0 + | |to channel 3. + Temperature |INT |module temperature in Celsius + Voltage |INT |supply voltage in mV + TX bias |INT |TX Bias Current in mA + RX power |INT |received optical power in mW + TX power |INT |TX output power in mW + ======================================================================== + """ + transceiver_dom_info_dict = {} + + dom_info_dict_keys = ['temperature', 'voltage', + 'rx1power', 'rx2power', + 'rx3power', 'rx4power', + 'rx5power', 'rx6power', + 'rx7power', 'rx8power', + 'tx1bias', 'tx2bias', + 'tx3bias', 'tx4bias', + 'tx5bias', 'tx6bias', + 'tx7bias', 'tx8bias', + 'tx1power', 'tx2power', + 'tx3power', 'tx4power', + 'tx5power', 'tx6power', + 'tx7power', 'tx8power' + ] + transceiver_dom_info_dict = dict.fromkeys(dom_info_dict_keys, 'N/A') + + #QSFP + if self.sfp_type == QSFP_TYPE: + if not self.dom_supported: + return transceiver_dom_info_dict + + offset = 0 + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return transceiver_dom_info_dict + + dom_data_raw = self._read_eeprom_specific_bytes((offset + QSFP_DOM_BULK_DATA_START), QSFP_DOM_BULK_DATA_SIZE) + if dom_data_raw is None: + return transceiver_dom_info_dict + + if self.dom_module_monitor_supported: + if self.dom_temp_supported: + start = QSFP_TEMPE_OFFSET - QSFP_DOM_BULK_DATA_START + end = start + QSFP_TEMPE_WIDTH + dom_temperature_data = sfpd_obj.parse_temperature(dom_data_raw[start : end], 0) + temp = self._convert_string_to_num(dom_temperature_data['data']['Temperature']['value']) + if temp is not None: + transceiver_dom_info_dict['temperature'] = temp + + if self.dom_volt_supported: + start = QSFP_VOLT_OFFSET - QSFP_DOM_BULK_DATA_START + end = start + QSFP_VOLT_WIDTH + dom_voltage_data = sfpd_obj.parse_voltage(dom_data_raw[start : end], 0) + volt = self._convert_string_to_num(dom_voltage_data['data']['Vcc']['value']) + if volt is not None: + transceiver_dom_info_dict['voltage'] = volt + if self.dom_channel_monitor_supported: + start = QSFP_CHANNL_MON_OFFSET - QSFP_DOM_BULK_DATA_START + end = start + QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params_with_tx_power(dom_data_raw[start : end], 0) + + if self.dom_tx_power_supported: + transceiver_dom_info_dict['tx1power'] = self._convert_string_to_num(dom_channel_monitor_data['data']['TX1Power']['value']) + transceiver_dom_info_dict['tx2power'] = self._convert_string_to_num(dom_channel_monitor_data['data']['TX2Power']['value']) + transceiver_dom_info_dict['tx3power'] = self._convert_string_to_num(dom_channel_monitor_data['data']['TX3Power']['value']) + transceiver_dom_info_dict['tx4power'] = self._convert_string_to_num(dom_channel_monitor_data['data']['TX4Power']['value']) + + if self.dom_rx_power_supported: + transceiver_dom_info_dict['rx1power'] = self._convert_string_to_num(dom_channel_monitor_data['data']['RX1Power']['value']) + transceiver_dom_info_dict['rx2power'] = self._convert_string_to_num(dom_channel_monitor_data['data']['RX2Power']['value']) + transceiver_dom_info_dict['rx3power'] = self._convert_string_to_num(dom_channel_monitor_data['data']['RX3Power']['value']) + transceiver_dom_info_dict['rx4power'] = self._convert_string_to_num(dom_channel_monitor_data['data']['RX4Power']['value']) + + transceiver_dom_info_dict['tx1bias'] = dom_channel_monitor_data['data']['TX1Bias']['value'] + transceiver_dom_info_dict['tx2bias'] = dom_channel_monitor_data['data']['TX2Bias']['value'] + transceiver_dom_info_dict['tx3bias'] = dom_channel_monitor_data['data']['TX3Bias']['value'] + transceiver_dom_info_dict['tx4bias'] = dom_channel_monitor_data['data']['TX4Bias']['value'] + + #QSFP-DD + else: + offset = 0 + sfpd_obj = qsfp_dd_Dom() + if sfpd_obj is None: + return transceiver_dom_info_dict + + dom_data_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_DOM_BULK_DATA_START), QSFP_DD_DOM_BULK_DATA_SIZE) + if dom_data_raw is None: + return transceiver_dom_info_dict + + if self.dom_module_monitor_supported: + if self.dom_temp_supported: + start = QSFP_DD_TEMPE_OFFSET - QSFP_DD_DOM_BULK_DATA_START + end = start + QSFP_DD_TEMPE_WIDTH + dom_temperature_data = sfpd_obj.parse_temperature(dom_data_raw[start : end], 0) + temp = self._convert_string_to_num(dom_temperature_data['data']['Temperature']['value']) + if temp is not None: + transceiver_dom_info_dict['temperature'] = temp + + if self.dom_volt_supported: + start = QSFP_DD_VOLT_OFFSET - QSFP_DD_DOM_BULK_DATA_START + end = start + QSFP_DD_VOLT_WIDTH + dom_voltage_data = sfpd_obj.parse_voltage(dom_data_raw[start : end], 0) + volt = self._convert_string_to_num(dom_voltage_data['data']['Vcc']['value']) + if volt is not None: + transceiver_dom_info_dict['voltage'] = volt + + return transceiver_dom_info_dict + + def get_transceiver_threshold_info(self): + """ + Retrieves transceiver threshold info of this SFP + + Returns: + A dict which contains following keys/values : + ======================================================================== + keys |Value Format |Information + ---------------------------|---------------|---------------------------- + temphighalarm |FLOAT |High Alarm Threshold value of temperature in Celsius. + templowalarm |FLOAT |Low Alarm Threshold value of temperature in Celsius. + temphighwarning |FLOAT |High Warning Threshold value of temperature in Celsius. + templowwarning |FLOAT |Low Warning Threshold value of temperature in Celsius. + vcchighalarm |FLOAT |High Alarm Threshold value of supply voltage in mV. + vcclowalarm |FLOAT |Low Alarm Threshold value of supply voltage in mV. + vcchighwarning |FLOAT |High Warning Threshold value of supply voltage in mV. + vcclowwarning |FLOAT |Low Warning Threshold value of supply voltage in mV. + rxpowerhighalarm |FLOAT |High Alarm Threshold value of received power in dBm. + rxpowerlowalarm |FLOAT |Low Alarm Threshold value of received power in dBm. + rxpowerhighwarning |FLOAT |High Warning Threshold value of received power in dBm. + rxpowerlowwarning |FLOAT |Low Warning Threshold value of received power in dBm. + txpowerhighalarm |FLOAT |High Alarm Threshold value of transmit power in dBm. + txpowerlowalarm |FLOAT |Low Alarm Threshold value of transmit power in dBm. + txpowerhighwarning |FLOAT |High Warning Threshold value of transmit power in dBm. + txpowerlowwarning |FLOAT |Low Warning Threshold value of transmit power in dBm. + txbiashighalarm |FLOAT |High Alarm Threshold value of tx Bias Current in mA. + txbiaslowalarm |FLOAT |Low Alarm Threshold value of tx Bias Current in mA. + txbiashighwarning |FLOAT |High Warning Threshold value of tx Bias Current in mA. + txbiaslowwarning |FLOAT |Low Warning Threshold value of tx Bias Current in mA. + ======================================================================== + """ + transceiver_dom_threshold_info_dict = {} + + dom_info_dict_keys = ['temphighalarm', 'temphighwarning', + 'templowalarm', 'templowwarning', + 'vcchighalarm', 'vcchighwarning', + 'vcclowalarm', 'vcclowwarning', + 'rxpowerhighalarm', 'rxpowerhighwarning', + 'rxpowerlowalarm', 'rxpowerlowwarning', + 'txpowerhighalarm', 'txpowerhighwarning', + 'txpowerlowalarm', 'txpowerlowwarning', + 'txbiashighalarm', 'txbiashighwarning', + 'txbiaslowalarm', 'txbiaslowwarning' + ] + transceiver_dom_threshold_info_dict = dict.fromkeys(dom_info_dict_keys, 'N/A') + + #QSFP + if self.sfp_type == QSFP_TYPE: + if not self.dom_supported or not self.qsfp_page3_available: + return transceiver_dom_threshold_info_dict + + # Dom Threshold data starts from offset 384 + # Revert offset back to 0 once data is retrieved + offset = QSFP_MODULE_UPPER_PAGE3_START + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return transceiver_dom_threshold_info_dict + + dom_module_threshold_raw = self._read_eeprom_specific_bytes((offset + QSFP_MODULE_THRESHOLD_OFFSET), QSFP_MODULE_THRESHOLD_WIDTH) + if dom_module_threshold_raw is None: + return transceiver_dom_threshold_info_dict + + dom_module_threshold_data = sfpd_obj.parse_module_threshold_values(dom_module_threshold_raw, 0) + + dom_channel_threshold_raw = self._read_eeprom_specific_bytes((offset + QSFP_CHANNL_THRESHOLD_OFFSET), + QSFP_CHANNL_THRESHOLD_WIDTH) + if dom_channel_threshold_raw is None: + return transceiver_dom_threshold_info_dict + dom_channel_threshold_data = sfpd_obj.parse_channel_threshold_values(dom_channel_threshold_raw, 0) + + # Threshold Data + if self.dom_module_treshold_supported: + transceiver_dom_threshold_info_dict['temphighalarm'] = dom_module_threshold_data['data']['TempHighAlarm']['value'] + transceiver_dom_threshold_info_dict['temphighwarning'] = dom_module_threshold_data['data']['TempHighWarning']['value'] + transceiver_dom_threshold_info_dict['templowalarm'] = dom_module_threshold_data['data']['TempLowAlarm']['value'] + transceiver_dom_threshold_info_dict['templowwarning'] = dom_module_threshold_data['data']['TempLowWarning']['value'] + transceiver_dom_threshold_info_dict['vcchighalarm'] = dom_module_threshold_data['data']['VccHighAlarm']['value'] + transceiver_dom_threshold_info_dict['vcchighwarning'] = dom_module_threshold_data['data']['VccHighWarning']['value'] + transceiver_dom_threshold_info_dict['vcclowalarm'] = dom_module_threshold_data['data']['VccLowAlarm']['value'] + transceiver_dom_threshold_info_dict['vcclowwarning'] = dom_module_threshold_data['data']['VccLowWarning']['value'] + if self.dom_channel_treshold_supported: + transceiver_dom_threshold_info_dict['rxpowerhighalarm'] = dom_channel_threshold_data['data']['RxPowerHighAlarm']['value'] + transceiver_dom_threshold_info_dict['rxpowerhighwarning'] = dom_channel_threshold_data['data']['RxPowerHighWarning']['value'] + transceiver_dom_threshold_info_dict['rxpowerlowalarm'] = dom_channel_threshold_data['data']['RxPowerLowAlarm']['value'] + transceiver_dom_threshold_info_dict['rxpowerlowwarning'] = dom_channel_threshold_data['data']['RxPowerLowWarning']['value'] + transceiver_dom_threshold_info_dict['txbiashighalarm'] = dom_channel_threshold_data['data']['TxBiasHighAlarm']['value'] + transceiver_dom_threshold_info_dict['txbiashighwarning'] = dom_channel_threshold_data['data']['TxBiasHighWarning']['value'] + transceiver_dom_threshold_info_dict['txbiaslowalarm'] = dom_channel_threshold_data['data']['TxBiasLowAlarm']['value'] + transceiver_dom_threshold_info_dict['txbiaslowwarning'] = dom_channel_threshold_data['data']['TxBiasLowWarning']['value'] + transceiver_dom_threshold_info_dict['txpowerhighalarm'] = dom_channel_threshold_data['data']['TxPowerHighAlarm']['value'] + transceiver_dom_threshold_info_dict['txpowerhighwarning'] = dom_channel_threshold_data['data']['TxPowerHighWarning']['value'] + transceiver_dom_threshold_info_dict['txpowerlowalarm'] = dom_channel_threshold_data['data']['TxPowerLowAlarm']['value'] + transceiver_dom_threshold_info_dict['txpowerlowwarning'] = dom_channel_threshold_data['data']['TxPowerLowWarning']['value'] + + #QSFP-DD + else: + if not self.dom_supported: + return transceiver_dom_threshold_info_dict + + if not self.dom_thresholds_supported: + return transceiver_dom_threshold_info_dict + + sfpd_obj = qsfp_dd_Dom() + if sfpd_obj is None: + return transceiver_dom_threshold_info_dict + + # page 02 (we put page 2 to byte 256~384) + offset = 256 + dom_module_threshold_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_MODULE_THRESHOLD_OFFSET), QSFP_DD_MODULE_THRESHOLD_WIDTH) + if dom_module_threshold_raw is None: + return transceiver_dom_threshold_info_dict + + dom_module_threshold_data = sfpd_obj.parse_module_threshold_values(dom_module_threshold_raw, 0) + + # Threshold Data + if self.dom_module_treshold_supported: + transceiver_dom_threshold_info_dict['temphighalarm'] = dom_module_threshold_data['data']['TempHighAlarm']['value'] + transceiver_dom_threshold_info_dict['temphighwarning'] = dom_module_threshold_data['data']['TempHighWarning']['value'] + transceiver_dom_threshold_info_dict['templowalarm'] = dom_module_threshold_data['data']['TempLowAlarm']['value'] + transceiver_dom_threshold_info_dict['templowwarning'] = dom_module_threshold_data['data']['TempLowWarning']['value'] + transceiver_dom_threshold_info_dict['vcchighalarm'] = dom_module_threshold_data['data']['VccHighAlarm']['value'] + transceiver_dom_threshold_info_dict['vcchighwarning'] = dom_module_threshold_data['data']['VccHighWarning']['value'] + transceiver_dom_threshold_info_dict['vcclowalarm'] = dom_module_threshold_data['data']['VccLowAlarm']['value'] + transceiver_dom_threshold_info_dict['vcclowwarning'] = dom_module_threshold_data['data']['VccLowWarning']['value'] + if self.dom_channel_treshold_supported: + transceiver_dom_threshold_info_dict['rxpowerhighalarm'] = dom_module_threshold_data['data']['RxPowerHighAlarm']['value'] + transceiver_dom_threshold_info_dict['rxpowerhighwarning'] = dom_module_threshold_data['data']['RxPowerHighWarning']['value'] + transceiver_dom_threshold_info_dict['rxpowerlowalarm'] = dom_module_threshold_data['data']['RxPowerLowAlarm']['value'] + transceiver_dom_threshold_info_dict['rxpowerlowwarning'] = dom_module_threshold_data['data']['RxPowerLowWarning']['value'] + transceiver_dom_threshold_info_dict['txbiashighalarm'] = dom_module_threshold_data['data']['TxBiasHighAlarm']['value'] + transceiver_dom_threshold_info_dict['txbiashighwarning'] = dom_module_threshold_data['data']['TxBiasHighWarning']['value'] + transceiver_dom_threshold_info_dict['txbiaslowalarm'] = dom_module_threshold_data['data']['TxBiasLowAlarm']['value'] + transceiver_dom_threshold_info_dict['txbiaslowwarning'] = dom_module_threshold_data['data']['TxBiasLowWarning']['value'] + transceiver_dom_threshold_info_dict['txpowerhighalarm'] = dom_module_threshold_data['data']['TxPowerHighAlarm']['value'] + transceiver_dom_threshold_info_dict['txpowerhighwarning'] = dom_module_threshold_data['data']['TxPowerHighWarning']['value'] + transceiver_dom_threshold_info_dict['txpowerlowalarm'] = dom_module_threshold_data['data']['TxPowerLowAlarm']['value'] + transceiver_dom_threshold_info_dict['txpowerlowwarning'] = dom_module_threshold_data['data']['TxPowerLowWarning']['value'] + + return transceiver_dom_threshold_info_dict + + def get_reset_status(self): + """ + Retrieves the reset status of SFP + Returns: + A Boolean, True if reset enabled, False if disabled + """ + # SFP doesn't support this feature + return False + + def get_rx_los(self): + """ + Retrieves the RX LOS (lost-of-signal) status of SFP + + Returns: + A Boolean, True if SFP has RX LOS, False if not. + Note : RX LOS status is latched until a call to get_rx_los or a reset. + """ + if not self.dom_supported: + return None + + rx_los_list = [] + #QSFP + if self.sfp_type == QSFP_TYPE: + offset = 0 + dom_channel_monitor_raw = self._read_eeprom_specific_bytes((offset + QSFP_CHANNL_RX_LOS_STATUS_OFFSET), QSFP_CHANNL_RX_LOS_STATUS_WIDTH) + if dom_channel_monitor_raw is not None: + rx_los_data = int(dom_channel_monitor_raw[0], 16) + rx_los_list.append(rx_los_data & 0x01 != 0) + rx_los_list.append(rx_los_data & 0x02 != 0) + rx_los_list.append(rx_los_data & 0x04 != 0) + rx_los_list.append(rx_los_data & 0x08 != 0) + + #QSFP-DD + else: + # page 11h (we put page 2 to byte 384~512) + if self.dom_rx_tx_power_bias_supported: + offset = 384 + dom_channel_monitor_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_CHANNL_RX_LOS_STATUS_OFFSET), QSFP_DD_CHANNL_RX_LOS_STATUS_WIDTH) + if dom_channel_monitor_raw is not None: + rx_los_data = int(dom_channel_monitor_raw[0], 8) + rx_los_list.append(rx_los_data & 0x01 != 0) + rx_los_list.append(rx_los_data & 0x02 != 0) + rx_los_list.append(rx_los_data & 0x04 != 0) + rx_los_list.append(rx_los_data & 0x08 != 0) + rx_los_list.append(rx_los_data & 0x10 != 0) + rx_los_list.append(rx_los_data & 0x20 != 0) + rx_los_list.append(rx_los_data & 0x40 != 0) + rx_los_list.append(rx_los_data & 0x80 != 0) + + return rx_los_list + + def get_tx_fault(self): + """ + Retrieves the TX fault status of SFP + + Returns: + A Boolean, True if SFP has TX fault, False if not + Note : TX fault status is lached until a call to get_tx_fault or a reset. + """ + if not self.dom_supported: + return None + + tx_fault_list = [] + #QSFP + if self.sfp_type == QSFP_TYPE: + offset = 0 + dom_channel_monitor_raw = self._read_eeprom_specific_bytes((offset + QSFP_CHANNL_TX_FAULT_STATUS_OFFSET), QSFP_CHANNL_TX_FAULT_STATUS_WIDTH) + if dom_channel_monitor_raw is not None: + tx_fault_data = int(dom_channel_monitor_raw[0], 16) + tx_fault_list.append(tx_fault_data & 0x01 != 0) + tx_fault_list.append(tx_fault_data & 0x02 != 0) + tx_fault_list.append(tx_fault_data & 0x04 != 0) + tx_fault_list.append(tx_fault_data & 0x08 != 0) + + #QSFP-DD + else: + return None + + return tx_fault_list + + def get_tx_disable(self): + """ + Retrieves the tx_disable status of this SFP + + Returns: + A Boolean, True if tx_disable is enabled, False if disabled + + for QSFP, the disable states of each channel which are the lower 4 bits in byte 85 page a0 + for SFP, the TX Disable State and Soft TX Disable Select is ORed as the tx_disable status returned + These two bits are bit 7 & 6 in byte 110 page a2 respectively + """ + if not self.dom_supported: + return None + + tx_disable_list = [] + #QSFP + if self.sfp_type == QSFP_TYPE: + offset = 0 + dom_channel_monitor_raw = self._read_eeprom_specific_bytes((offset + QSFP_CHANNL_DISABLE_STATUS_OFFSET), QSFP_CHANNL_DISABLE_STATUS_WIDTH) + if dom_channel_monitor_raw is not None: + tx_disable_data = int(dom_channel_monitor_raw[0], 16) + tx_disable_list.append(tx_disable_data & 0x01 != 0) + tx_disable_list.append(tx_disable_data & 0x02 != 0) + tx_disable_list.append(tx_disable_data & 0x04 != 0) + tx_disable_list.append(tx_disable_data & 0x08 != 0) + + #QSFP-DD + else: + if self.dom_rx_tx_power_bias_supported: + # page 11h (we put page 1 to byte 384~512) + offset = 384 + dom_channel_monitor_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_CHANNL_DISABLE_STATUS_OFFSET), QSFP_DD_CHANNL_DISABLE_STATUS_WIDTH) + if dom_channel_monitor_raw is not None: + tx_disable_data = int(dom_channel_monitor_raw[0], 16) + tx_disable_list.append(tx_disable_data & 0x01 != 0) + tx_disable_list.append(tx_disable_data & 0x02 != 0) + tx_disable_list.append(tx_disable_data & 0x04 != 0) + tx_disable_list.append(tx_disable_data & 0x08 != 0) + tx_disable_list.append(tx_disable_data & 0x10 != 0) + tx_disable_list.append(tx_disable_data & 0x20 != 0) + tx_disable_list.append(tx_disable_data & 0x40 != 0) + tx_disable_list.append(tx_disable_data & 0x80 != 0) + + return tx_disable_list + + def get_tx_disable_channel(self): + """ + Retrieves the TX disabled channels in this SFP + Returns: + A hex of 4 bits (bit 0 to bit 3 as channel 0 to channel 3) to represent + TX channels which have been disabled in this SFP. + As an example, a returned value of 0x5 indicates that channel 0 + and channel 2 have been disabled. + """ + # SFP doesn't support this feature + return 0 + + def get_lpmode(self): + """ + Retrieves the lpmode (low power mode) status of this SFP + Returns: + A Boolean, True if lpmode is enabled, False if disabled + """ + # SFP doesn't support this feature + return False + + def get_power_override(self): + """ + Retrieves the power-override status of this SFP + Returns: + A Boolean, True if power-override is enabled, False if disabled + """ + # SFP doesn't support this feature + return False + + def get_temperature(self): + """ + Retrieves the temperature of this SFP + + Returns: + An integer number of current temperature in Celsius + """ + if not self.dom_supported: + return None + #QSFP + if self.sfp_type == QSFP_TYPE: + offset = 0 + + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return None + + if self.dom_temp_supported: + dom_temperature_raw = self._read_eeprom_specific_bytes((offset + QSFP_TEMPE_OFFSET), QSFP_TEMPE_WIDTH) + if dom_temperature_raw is not None: + dom_temperature_data = sfpd_obj.parse_temperature(dom_temperature_raw, 0) + temp = self._convert_string_to_num(dom_temperature_data['data']['Temperature']['value']) + return temp + else: + return None + else: + return None + + #QSFP-DD + else: + offset = 0 + + sfpd_obj = qsfp_dd_Dom() + if sfpd_obj is None: + return None + + if self.dom_temp_supported: + dom_temperature_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_TEMPE_OFFSET), QSFP_DD_TEMPE_WIDTH) + if dom_temperature_raw is not None: + dom_temperature_data = sfpd_obj.parse_temperature(dom_temperature_raw, 0) + temp = self._convert_string_to_num(dom_temperature_data['data']['Temperature']['value']) + return temp + return None + + def get_voltage(self): + """ + Retrieves the supply voltage of this SFP + + Returns: + An integer number of supply voltage in mV + """ + if not self.dom_supported: + return None + + #QSFP + if self.sfp_type == QSFP_TYPE: + offset = 0 + + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return None + + if self.dom_volt_supported: + dom_voltage_raw = self._read_eeprom_specific_bytes((offset + QSFP_VOLT_OFFSET), QSFP_VOLT_WIDTH) + if dom_voltage_raw is not None: + dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0) + voltage = self._convert_string_to_num(dom_voltage_data['data']['Vcc']['value']) + return voltage + else: + return None + return None + + #QSFP-DD + else: + offset = 0 + + sfpd_obj = qsfp_dd_Dom() + if sfpd_obj is None: + return None + + if self.dom_volt_supported: + dom_voltage_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_VOLT_OFFSET), QSFP_DD_VOLT_WIDTH) + if dom_voltage_raw is not None: + dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0) + voltage = self._convert_string_to_num(dom_voltage_data['data']['Vcc']['value']) + return voltage + return None + + def get_tx_bias(self): + """ + Retrieves the TX bias current of this SFP + + Returns: + A list of four integer numbers, representing TX bias in mA + for channel 0 to channel 4. + Ex. ['110.09', '111.12', '108.21', '112.09'] + """ + tx_bias_list = [] + + #QSFP + if self.sfp_type == QSFP_TYPE: + offset = 0 + + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return None + + dom_channel_monitor_raw = self._read_eeprom_specific_bytes((offset + QSFP_CHANNL_MON_OFFSET), QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH) + if dom_channel_monitor_raw is not None: + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params_with_tx_power(dom_channel_monitor_raw, 0) + tx_bias_list.append(self._convert_string_to_num(dom_channel_monitor_data['data']['TX1Bias']['value'])) + tx_bias_list.append(self._convert_string_to_num(dom_channel_monitor_data['data']['TX2Bias']['value'])) + tx_bias_list.append(self._convert_string_to_num(dom_channel_monitor_data['data']['TX3Bias']['value'])) + tx_bias_list.append(self._convert_string_to_num(dom_channel_monitor_data['data']['TX4Bias']['value'])) + + #QSFP-DD + else: + # page 11h (we put page 1 to byte 384~512) + if self.dom_rx_tx_power_bias_supported: + offset = 384 + sfpd_obj = qsfp_dd_Dom() + if sfpd_obj is None: + return None + + if dom_tx_bias_power_supported: + dom_tx_bias_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_TX_BIAS_OFFSET), QSFP_DD_TX_BIAS_WIDTH) + if dom_tx_bias_raw is not None: + dom_tx_bias_data = sfpd_obj.parse_dom_tx_bias(dom_tx_bias_raw, 0) + tx_bias_list.append(self._convert_string_to_num(dom_tx_bias_data['data']['TX1Bias']['value'])) + tx_bias_list.append(self._convert_string_to_num(dom_tx_bias_data['data']['TX2Bias']['value'])) + tx_bias_list.append(self._convert_string_to_num(dom_tx_bias_data['data']['TX3Bias']['value'])) + tx_bias_list.append(self._convert_string_to_num(dom_tx_bias_data['data']['TX4Bias']['value'])) + tx_bias_list.append(self._convert_string_to_num(dom_tx_bias_data['data']['TX5Bias']['value'])) + tx_bias_list.append(self._convert_string_to_num(dom_tx_bias_data['data']['TX6Bias']['value'])) + tx_bias_list.append(self._convert_string_to_num(dom_tx_bias_data['data']['TX7Bias']['value'])) + tx_bias_list.append(self._convert_string_to_num(dom_tx_bias_data['data']['TX8Bias']['value'])) + + return tx_bias_list + + def get_rx_power(self): + """ + Retrieves the received optical power for this SFP + + Returns: + A list of four integer numbers, representing received optical + power in mW for channel 0 to channel 4. + Ex. ['1.77', '1.71', '1.68', '1.70'] + """ + rx_power_list = [] + + #QSFP + if self.sfp_type == QSFP_TYPE: + offset = 0 + + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return None + + if self.dom_rx_power_supported: + dom_channel_monitor_raw = self._read_eeprom_specific_bytes((offset + QSFP_CHANNL_MON_OFFSET), QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH) + if dom_channel_monitor_raw is not None: + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params_with_tx_power(dom_channel_monitor_raw, 0) + rx_power_list.append(self._convert_string_to_num(dom_channel_monitor_data['data']['RX1Power']['value'])) + rx_power_list.append(self._convert_string_to_num(dom_channel_monitor_data['data']['RX2Power']['value'])) + rx_power_list.append(self._convert_string_to_num(dom_channel_monitor_data['data']['RX3Power']['value'])) + rx_power_list.append(self._convert_string_to_num(dom_channel_monitor_data['data']['RX4Power']['value'])) + else: + return None + else: + return None + + #QSFP-DD + elif self.sfp_type == QSFP_DD_TYPE: + # page 11h (we put page 1 to byte 384~512) + if self.dom_rx_tx_power_bias_supported: + offset = 384 + sfpd_obj = qsfp_dd_Dom() + if sfpd_obj is None: + return None + + if self.dom_rx_power_supported: + dom_rx_power_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_RX_POWER_OFFSET), QSFP_DD_RX_POWER_WIDTH) + if dom_rx_power_raw is not None: + dom_rx_power_data = sfpd_obj.parse_dom_rx_power(dom_rx_power_raw, 0) + rx_power_list.append(self._convert_string_to_num(dom_rx_power_data['data']['RX1Power']['value'])) + rx_power_list.append(self._convert_string_to_num(dom_rx_power_data['data']['RX2Power']['value'])) + rx_power_list.append(self._convert_string_to_num(dom_rx_power_data['data']['RX3Power']['value'])) + rx_power_list.append(self._convert_string_to_num(dom_rx_power_data['data']['RX4Power']['value'])) + rx_power_list.append(self._convert_string_to_num(dom_rx_power_data['data']['RX5Power']['value'])) + rx_power_list.append(self._convert_string_to_num(dom_rx_power_data['data']['RX6Power']['value'])) + rx_power_list.append(self._convert_string_to_num(dom_rx_power_data['data']['RX7Power']['value'])) + rx_power_list.append(self._convert_string_to_num(dom_rx_power_data['data']['RX8Power']['value'])) + + return rx_power_list + + def get_tx_power(self): + """ + Retrieves the TX power of this SFP + + Returns: + A list of four integer numbers, representing TX power in mW + for channel 0 to channel 4. + Ex. ['1.86', '1.86', '1.86', '1.86'] + """ + tx_power_list = [] + + #QSFP + if self.sfp_type == QSFP_TYPE: + offset = 0 + + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return None + + if self.dom_tx_power_supported: + dom_channel_monitor_raw = self._read_eeprom_specific_bytes((offset + QSFP_CHANNL_MON_OFFSET), QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH) + if dom_channel_monitor_raw is not None: + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params_with_tx_power(dom_channel_monitor_raw, 0) + tx_power_list.append(self._convert_string_to_num(dom_channel_monitor_data['data']['TX1Power']['value'])) + tx_power_list.append(self._convert_string_to_num(dom_channel_monitor_data['data']['TX2Power']['value'])) + tx_power_list.append(self._convert_string_to_num(dom_channel_monitor_data['data']['TX3Power']['value'])) + tx_power_list.append(self._convert_string_to_num(dom_channel_monitor_data['data']['TX4Power']['value'])) + else: + return None + else: + return None + + #QSFP-DD + else: + # page 11h (we put page 1 to byte 384~512) + if self.dom_rx_tx_power_bias_supported: + offset = 384 + sfpd_obj = qsfp_dd_Dom() + if sfpd_obj is None: + return None + + if self.dom_tx_power_supported: + dom_tx_power_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_TX_POWER_OFFSET), QSFP_DD_TX_POWER_WIDTH) + if dom_tx_power_raw is not None: + dom_tx_power_data = sfpd_obj.parse_dom_tx_power(dom_tx_power_raw, 0) + tx_power_list.append(self._convert_string_to_num(dom_tx_power_data['data']['TX1Power']['value'])) + tx_power_list.append(self._convert_string_to_num(dom_tx_power_data['data']['TX2Power']['value'])) + tx_power_list.append(self._convert_string_to_num(dom_tx_power_data['data']['TX3Power']['value'])) + tx_power_list.append(self._convert_string_to_num(dom_tx_power_data['data']['TX4Power']['value'])) + tx_power_list.append(self._convert_string_to_num(dom_tx_power_data['data']['TX5Power']['value'])) + tx_power_list.append(self._convert_string_to_num(dom_tx_power_data['data']['TX6Power']['value'])) + tx_power_list.append(self._convert_string_to_num(dom_tx_power_data['data']['TX7Power']['value'])) + tx_power_list.append(self._convert_string_to_num(dom_tx_power_data['data']['TX8Power']['value'])) + + return tx_power_list + + def reset(self): + """ + Reset SFP and return all user module settings to their default srate. + Returns: + A boolean, True if successful, False if not + """ + # SFP doesn't support this feature + return False + + def tx_disable(self, tx_disable): + """ + Disable SFP TX for all channels + Args: + tx_disable : A Boolean, True to enable tx_disable mode, False to disable + tx_disable mode. + Returns: + A boolean, True if tx_disable is set successfully, False if not + """ + # SFP doesn't support this feature + return False + + def tx_disable_channel(self, channel, disable): + """ + Sets the tx_disable for specified SFP channels + Args: + channel : A hex of 4 bits (bit 0 to bit 3) which represent channel 0 to 3, + e.g. 0x5 for channel 0 and channel 2. + disable : A boolean, True to disable TX channels specified in channel, + False to enable + Returns: + A boolean, True if successful, False if not + """ + # SFP doesn't support this feature + return False + + def set_lpmode(self, lpmode): + """ + Sets the lpmode (low power mode) of SFP + Args: + lpmode: A Boolean, True to enable lpmode, False to disable it + Note : lpmode can be overridden by set_power_override + Returns: + A boolean, True if lpmode is set successfully, False if not + """ + # SFP doesn't support this feature + return False + + def set_power_override(self, power_override, power_set): + """ + Sets SFP power level using power_override and power_set + Args: + power_override : + A Boolean, True to override set_lpmode and use power_set + to control SFP power, False to disable SFP power control + through power_override/power_set and use set_lpmode + to control SFP power. + power_set : + Only valid when power_override is True. + A Boolean, True to set SFP to low power mode, False to set + SFP to high power mode. + Returns: + A boolean, True if power-override and power_set are set successfully, + False if not + """ + # SFP doesn't support this feature + return False + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + with open(self.port_to_name_mapping[self.index], 'r') as sfp_name: + name=sfp_name.read() + return name + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + transceiver_dom_info_dict = self.get_transceiver_info() + return transceiver_dom_info_dict.get("model", "N/A") + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + transceiver_dom_info_dict = self.get_transceiver_info() + return transceiver_dom_info_dict.get("serial", "N/A") + diff --git a/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/sonic_platform/thermal.py b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/sonic_platform/thermal.py new file mode 100755 index 0000000000..f45d930e87 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/sonic_platform/thermal.py @@ -0,0 +1,165 @@ +#!/usr/bin/env python + +############################################################################# +# +# Thermal contains an implementation of SONiC Platform Base API and +# provides the thermal device status which are available in the platform +# +############################################################################# + +import os +import os.path + +try: + from sonic_platform_base.thermal_base import ThermalBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Thermal(ThermalBase): + """Platform-specific Thermal class""" + + THERMAL_NAME_LIST = [] + SYSFS_THERMAL_DIR = ["/sys/bus/i2c/devices/0-004f/", + "/sys/bus/i2c/devices/0-0049/", + "/sys/bus/i2c/devices/0-004a/", + "/sys/bus/i2c/devices/0-004b/", + "/sys/bus/i2c/devices/0-004c/", + "/sys/bus/i2c/devices/0-004d/", + "/sys/bus/i2c/devices/0-004e/"] + + def __init__(self, thermal_index): + self.index = thermal_index + + # Add thermal name + self.THERMAL_NAME_LIST.append("Top-Rear") + self.THERMAL_NAME_LIST.append("Top-Front") + self.THERMAL_NAME_LIST.append("Right-Front") + self.THERMAL_NAME_LIST.append("Top-Center") + self.THERMAL_NAME_LIST.append("Left-Front") + self.THERMAL_NAME_LIST.append("Bottom-Front") + self.THERMAL_NAME_LIST.append("Bottom-Rear") + ThermalBase.__init__(self) + + def __read_txt_file(self, file_path): + try: + with open(file_path, 'r') as fd: + data = fd.read() + return data.strip() + except IOError: + pass + return "" + + def __get_temp(self, temp_file): + temp_file_path = os.path.join(self.SYSFS_THERMAL_DIR[self.index], temp_file) + raw_temp = self.__read_txt_file(temp_file_path) + temp = float(raw_temp)/1000 + return "{:.3f}".format(temp) + + def __set_threshold(self, file_name, temperature): + temp_file_path = os.path.join(self.hwmon_path, file_name) + try: + with open(temp_file_path, 'w') as fd: + fd.write(str(temperature)) + return True + except IOError: + return False + + def get_temperature(self): + """ + Retrieves current temperature reading from thermal + Returns: + A float number of current temperature in Celsius up to nearest thousandth + of one degree Celsius, e.g. 30.125 + """ + temp_file = "temp1_input" + return float(self.__get_temp(temp_file)) + + def get_low_threshold(self): + """ + Retrieves the low threshold temperature of thermal + :return: A float number, the low threshold temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + return int(9) + + def get_low_critical_threshold(self): + """ + Retrieves the low critical threshold temperature of thermal + :return: A float number, the low critical threshold temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + return int(7) + + def get_high_threshold(self): + """ + Retrieves the high threshold temperature of thermal + Returns: + A float number, the high threshold temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + if self.index==0: + return int(56) + elif self.index==1: + return int(74) + elif self.index==2: + return int(55) + elif self.index==3: + return int(74) + elif self.index==4: + return int(55) + elif self.index==5: + return int(74) + else: + return int(56) + + def get_high_critical_threshold(self): + """ + Retrieves the high critical threshold temperature of thermal + :return: A float number, the high critical threshold temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + if self.index==0: + return int(58) + elif self.index==1: + return int(76) + elif self.index==2: + return int(57) + elif self.index==3: + return int(76) + elif self.index==4: + return int(57) + elif self.index==5: + return int(76) + else: + return int(58) + + def get_name(self): + """ + Retrieves the name of the thermal device + Returns: + string: The name of the thermal device + """ + return self.THERMAL_NAME_LIST[self.index] + + def get_presence(self): + """ + Retrieves the presence of the PSU + Returns: + bool: True if PSU is present, False if not + """ + temp_file = "temp1_input" + temp_file_path = os.path.join(self.hwmon_path, temp_file) + return os.path.isfile(temp_file_path) + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + if not self.get_presence(): + return False + + return True + diff --git a/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/sonic_platform/watchdog.py b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/sonic_platform/watchdog.py new file mode 100755 index 0000000000..820dd54f95 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/sonic_platform/watchdog.py @@ -0,0 +1,73 @@ +#!/usr/bin/env python + +######################################################################## +# +# Abstract base class for implementing a platform-specific class with +# which to interact with a hardware watchdog module in SONiC +# +######################################################################## + +try: + from sonic_platform_base.watchdog_base import WatchdogBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +class Watchdog(WatchdogBase): + """ + Abstract base class for interfacing with a hardware watchdog module + """ + + def __init__(self): + print("INFO: Watchdog __init__") + + def arm(self, seconds): + """ + Arm the hardware watchdog with a timeout of seconds. + If the watchdog is currently armed, calling this function will + simply reset the timer to the provided value. If the underlying + hardware does not support the value provided in , this + method should arm the watchdog with the *next greater* + available value. + Returns: + An integer specifying the *actual* number of seconds the + watchdog was armed with. On failure returns -1. + """ + print("ERROR: Platform did not implement arm()") + raise NotImplementedError + + def disarm(self): + """ + Disarm the hardware watchdog + Returns: + A boolean, True if watchdog is disarmed successfully, False + if not + """ + print("ERROR: Platform did not implement disarm()") + raise NotImplementedError + + def is_armed(self): + """ + Retrieves the armed state of the hardware watchdog. + Returns: + A boolean, True if watchdog is armed, False if not + """ + print("ERROR: Platform did not implement is_armed()") + raise NotImplementedError + + def get_remaining_time(self): + """ + If the watchdog is armed, retrieve the number of seconds + remaining on the watchdog timer + Returns: + An integer specifying the number of seconds remaining on + their watchdog timer. If the watchdog is not armed, returns + -1. + S5232 doesnot have hardware support to show remaining time. + Due to this limitation, this API is implemented in software. + This API would return correct software time difference if it + is called from the process which armed the watchdog timer. + If this API called from any other process, it would return + 0. If the watchdog is not armed, this API would return -1. + """ + print("ERROR: Platform did not implement get_remaining_time()") + raise NotImplementedError diff --git a/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/utils/platform_led b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/utils/platform_led new file mode 100755 index 0000000000..9cf2b7adc1 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/utils/platform_led @@ -0,0 +1,4 @@ +#!/bin/bash +sudo ipmitool raw 0x06 0x52 0x05 192 0 0x49 0 2>>/dev/null +exit 0 + diff --git a/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/utils/platform_sync b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/utils/platform_sync new file mode 100755 index 0000000000..9c357e7ac7 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/utils/platform_sync @@ -0,0 +1,7 @@ +#!/bin/bash +/usr/local/bin/sonic-fanthrml-monitor & +/usr/local/bin/sonic-led-monitor & +/usr/local/bin/sonic-qsfp-monitor & +/usr/local/bin/sonic-psu-monitor & +exit 0 + diff --git a/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/utils/sonic-fanthrml-monitor b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/utils/sonic-fanthrml-monitor new file mode 100755 index 0000000000..4dcf00781f --- /dev/null +++ b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/utils/sonic-fanthrml-monitor @@ -0,0 +1,354 @@ +#!/bin/bash + +debug_flag=0 + +ipmi_val=0 +ctrl_mode_val=0 +fan_pwm_val=0 +fan_rpm_val=0 + +bmc_sensor_read() +{ + ipmi_val=$(ipmitool raw 0x30 0x92 2>>/dev/null) + if [ $? -eq 0 ];then + return 0 + fi + + return 1 +} + +#$1=get(0)/set(1), $2=ctrl_mode(1:manual, 0:auto) +#get rtn: ctrl_mode_val, fan_pwm_val +bmc_fan_speed_ctrl() +{ + if [ -e /sys/bus/i2c/devices/0-0066/fan_duty_cycle_percentage ];then + if [ $1 -eq 1 ];then + #Set Fan Speed Control + if [ $2 -eq 0 ];then + ipmitool raw 0x30 0x20 0x0 0x0 1>/dev/null 2>/dev/null + else + fan_pwm_input=$(cat /sys/bus/i2c/devices/0-0066/fan_duty_cycle_percentage | awk '{printf $1}') + fan_pwm_input=$( printf "%d" 0x$fan_pwm_input ) + ipmitool raw 0x30 0x20 0x1 $fan_pwm_input 1>/dev/null 2>/dev/null + fi + else + #Get Fan Speed Control + ctrl_mode_val=$(echo $ipmi_val | awk '{printf $1}') + fan_pwm_val=$(echo $ipmi_val | awk '{printf $2}') + ctrl_mode_val=$( printf "%d" 0x$ctrl_mode_val ) + fan_pwm_val=$( printf "%d" 0x$fan_pwm_val ) + echo $fan_pwm_val > /sys/bus/i2c/devices/0-0066/fan_duty_cycle_percentage + fi + fi +} + +bmc_fan_presence() +{ + if [ -e /sys/bus/i2c/devices/0-0066/fan1_presence ];then + fan_pre_val=$(echo $ipmi_val | awk '{printf $44}') + fan_pre_val=$( printf "%d" 0x$fan_pre_val ) + for i in $(seq 0 6); + do + tmp=$((1 << $i)) + tmp1=$(($fan_pre_val & $tmp)) + if [ $tmp1 -eq 0 ];then + if [ $i == 0 ];then + echo 1 > /sys/bus/i2c/devices/0-0066/fan1_presence + elif [ $i == 1 ];then + echo 1 > /sys/bus/i2c/devices/0-0066/fan2_presence + elif [ $i == 2 ];then + echo 1 > /sys/bus/i2c/devices/0-0066/fan3_presence + elif [ $i == 3 ];then + echo 1 > /sys/bus/i2c/devices/0-0066/fan4_presence + elif [ $i == 4 ];then + echo 1 > /sys/bus/i2c/devices/0-0066/fan5_presence + elif [ $i == 5 ];then + echo 1 > /sys/bus/i2c/devices/0-0066/fan6_presence + else + echo 1 > /sys/bus/i2c/devices/0-0066/fan7_presence + fi + else + if [ $i == 0 ];then + echo 0 > /sys/bus/i2c/devices/0-0066/fan1_presence + elif [ $i == 1 ];then + echo 0 > /sys/bus/i2c/devices/0-0066/fan2_presence + elif [ $i == 2 ];then + echo 0 > /sys/bus/i2c/devices/0-0066/fan3_presence + elif [ $i == 3 ];then + echo 0 > /sys/bus/i2c/devices/0-0066/fan4_presence + elif [ $i == 4 ];then + echo 0 > /sys/bus/i2c/devices/0-0066/fan5_presence + elif [ $i == 5 ];then + echo 0 > /sys/bus/i2c/devices/0-0066/fan6_presence + else + echo 0 > /sys/bus/i2c/devices/0-0066/fan7_presence + fi + fi + done + fi +} + +bmc_fan_enable() +{ + if [ -e /sys/bus/i2c/devices/0-0066/fan1_enable ];then + fan_en_val=$(echo $ipmi_val | awk '{printf $45}') + fan_en_val=$( printf "%d" 0x$fan_en_val ) + for i in $(seq 0 6); + do + tmp=$((1 << $i)) + tmp1=$(($fan_en_val & $tmp)) + if [ $tmp1 -ne 0 ];then + if [ $i == 0 ];then + echo 1 > /sys/bus/i2c/devices/0-0066/fan1_enable + elif [ $i == 1 ];then + echo 1 > /sys/bus/i2c/devices/0-0066/fan2_enable + elif [ $i == 2 ];then + echo 1 > /sys/bus/i2c/devices/0-0066/fan3_enable + elif [ $i == 3 ];then + echo 1 > /sys/bus/i2c/devices/0-0066/fan4_enable + elif [ $i == 4 ];then + echo 1 > /sys/bus/i2c/devices/0-0066/fan5_enable + elif [ $i == 5 ];then + echo 1 > /sys/bus/i2c/devices/0-0066/fan6_enable + else + echo 1 > /sys/bus/i2c/devices/0-0066/fan7_enable + fi + else + if [ $i == 0 ];then + echo 0 > /sys/bus/i2c/devices/0-0066/fan1_enable + elif [ $i == 1 ];then + echo 0 > /sys/bus/i2c/devices/0-0066/fan2_enable + elif [ $i == 2 ];then + echo 0 > /sys/bus/i2c/devices/0-0066/fan3_enable + elif [ $i == 3 ];then + echo 0 > /sys/bus/i2c/devices/0-0066/fan4_enable + elif [ $i == 4 ];then + echo 0 > /sys/bus/i2c/devices/0-0066/fan5_enable + elif [ $i == 5 ];then + echo 0 > /sys/bus/i2c/devices/0-0066/fan6_enable + else + echo 0 > /sys/bus/i2c/devices/0-0066/fan7_enable + fi + fi + done + fi +} + +bmc_fan_speed_rpm() +{ + if [ -e /sys/bus/i2c/devices/0-0066/fan1_front_speed_rpm ];then + #fan1 front + hi_byte=$(echo $ipmi_val | awk '{printf $1}') + lo_byte=$(echo $ipmi_val | awk '{printf $2}') + hi_byte=$( printf "%d" 0x$hi_byte ) + lo_byte=$( printf "%d" 0x$lo_byte ) + fan_rpm_val=$((hi_byte<<8)) + fan_rpm_val=`expr $fan_rpm_val + $lo_byte` + echo $fan_rpm_val > /sys/bus/i2c/devices/0-0066/fan1_front_speed_rpm + + #fan1 rear + hi_byte=$(echo $ipmi_val | awk '{printf $15}') + lo_byte=$(echo $ipmi_val | awk '{printf $16}') + hi_byte=$( printf "%d" 0x$hi_byte ) + lo_byte=$( printf "%d" 0x$lo_byte ) + fan_rpm_val=$((hi_byte<<8)) + fan_rpm_val=`expr $fan_rpm_val + $lo_byte` + echo $fan_rpm_val > /sys/bus/i2c/devices/0-0066/fan1_rear_speed_rpm + + #fan2 front + hi_byte=$(echo $ipmi_val | awk '{printf $3}') + lo_byte=$(echo $ipmi_val | awk '{printf $4}') + hi_byte=$( printf "%d" 0x$hi_byte ) + lo_byte=$( printf "%d" 0x$lo_byte ) + fan_rpm_val=$((hi_byte<<8)) + fan_rpm_val=`expr $fan_rpm_val + $lo_byte` + echo $fan_rpm_val > /sys/bus/i2c/devices/0-0066/fan2_front_speed_rpm + + #fan2 rear + hi_byte=$(echo $ipmi_val | awk '{printf $17}') + lo_byte=$(echo $ipmi_val | awk '{printf $18}') + hi_byte=$( printf "%d" 0x$hi_byte ) + lo_byte=$( printf "%d" 0x$lo_byte ) + fan_rpm_val=$((hi_byte<<8)) + fan_rpm_val=`expr $fan_rpm_val + $lo_byte` + echo $fan_rpm_val > /sys/bus/i2c/devices/0-0066/fan2_rear_speed_rpm + + #fan3 front + hi_byte=$(echo $ipmi_val | awk '{printf $5}') + lo_byte=$(echo $ipmi_val | awk '{printf $6}') + hi_byte=$( printf "%d" 0x$hi_byte ) + lo_byte=$( printf "%d" 0x$lo_byte ) + fan_rpm_val=$((hi_byte<<8)) + fan_rpm_val=`expr $fan_rpm_val + $lo_byte` + echo $fan_rpm_val > /sys/bus/i2c/devices/0-0066/fan3_front_speed_rpm + + #fan3 rear + hi_byte=$(echo $ipmi_val | awk '{printf $19}') + lo_byte=$(echo $ipmi_val | awk '{printf $20}') + hi_byte=$( printf "%d" 0x$hi_byte ) + lo_byte=$( printf "%d" 0x$lo_byte ) + fan_rpm_val=$((hi_byte<<8)) + fan_rpm_val=`expr $fan_rpm_val + $lo_byte` + echo $fan_rpm_val > /sys/bus/i2c/devices/0-0066/fan3_rear_speed_rpm + + #fan4 front + hi_byte=$(echo $ipmi_val | awk '{printf $7}') + lo_byte=$(echo $ipmi_val | awk '{printf $8}') + hi_byte=$( printf "%d" 0x$hi_byte ) + lo_byte=$( printf "%d" 0x$lo_byte ) + fan_rpm_val=$((hi_byte<<8)) + fan_rpm_val=`expr $fan_rpm_val + $lo_byte` + echo $fan_rpm_val > /sys/bus/i2c/devices/0-0066/fan4_front_speed_rpm + + #fan4 rear + hi_byte=$(echo $ipmi_val | awk '{printf $21}') + lo_byte=$(echo $ipmi_val | awk '{printf $22}') + hi_byte=$( printf "%d" 0x$hi_byte ) + lo_byte=$( printf "%d" 0x$lo_byte ) + fan_rpm_val=$((hi_byte<<8)) + fan_rpm_val=`expr $fan_rpm_val + $lo_byte` + echo $fan_rpm_val > /sys/bus/i2c/devices/0-0066/fan4_rear_speed_rpm + + #fan5 front + hi_byte=$(echo $ipmi_val | awk '{printf $9}') + lo_byte=$(echo $ipmi_val | awk '{printf $10}') + hi_byte=$( printf "%d" 0x$hi_byte ) + lo_byte=$( printf "%d" 0x$lo_byte ) + fan_rpm_val=$((hi_byte<<8)) + fan_rpm_val=`expr $fan_rpm_val + $lo_byte` + echo $fan_rpm_val > /sys/bus/i2c/devices/0-0066/fan5_front_speed_rpm + + #fan5 rear + hi_byte=$(echo $ipmi_val | awk '{printf $23}') + lo_byte=$(echo $ipmi_val | awk '{printf $24}') + hi_byte=$( printf "%d" 0x$hi_byte ) + lo_byte=$( printf "%d" 0x$lo_byte ) + fan_rpm_val=$((hi_byte<<8)) + fan_rpm_val=`expr $fan_rpm_val + $lo_byte` + echo $fan_rpm_val > /sys/bus/i2c/devices/0-0066/fan5_rear_speed_rpm + + #fan6 front + hi_byte=$(echo $ipmi_val | awk '{printf $11}') + lo_byte=$(echo $ipmi_val | awk '{printf $12}') + hi_byte=$( printf "%d" 0x$hi_byte ) + lo_byte=$( printf "%d" 0x$lo_byte ) + fan_rpm_val=$((hi_byte<<8)) + fan_rpm_val=`expr $fan_rpm_val + $lo_byte` + echo $fan_rpm_val > /sys/bus/i2c/devices/0-0066/fan6_front_speed_rpm + + #fan6 rear + hi_byte=$(echo $ipmi_val | awk '{printf $25}') + lo_byte=$(echo $ipmi_val | awk '{printf $26}') + hi_byte=$( printf "%d" 0x$hi_byte ) + lo_byte=$( printf "%d" 0x$lo_byte ) + fan_rpm_val=$((hi_byte<<8)) + fan_rpm_val=`expr $fan_rpm_val + $lo_byte` + echo $fan_rpm_val > /sys/bus/i2c/devices/0-0066/fan6_rear_speed_rpm + + #fan7 front + hi_byte=$(echo $ipmi_val | awk '{printf $13}') + lo_byte=$(echo $ipmi_val | awk '{printf $14}') + hi_byte=$( printf "%d" 0x$hi_byte ) + lo_byte=$( printf "%d" 0x$lo_byte ) + fan_rpm_val=$((hi_byte<<8)) + fan_rpm_val=`expr $fan_rpm_val + $lo_byte` + echo $fan_rpm_val > /sys/bus/i2c/devices/0-0066/fan7_front_speed_rpm + + #fan7 rear + hi_byte=$(echo $ipmi_val | awk '{printf $27}') + lo_byte=$(echo $ipmi_val | awk '{printf $28}') + hi_byte=$( printf "%d" 0x$hi_byte ) + lo_byte=$( printf "%d" 0x$lo_byte ) + fan_rpm_val=$((hi_byte<<8)) + fan_rpm_val=`expr $fan_rpm_val + $lo_byte` + echo $fan_rpm_val > /sys/bus/i2c/devices/0-0066/fan7_rear_speed_rpm + fi +} + +do_fan_update() +{ + #fan presence + bmc_fan_presence + + #fan enable + bmc_fan_enable + + #fan speed rpm + bmc_fan_speed_rpm + + if [ $debug_flag -eq 0 ];then + #Get Fan RPM + bmc_fan_speed_ctrl 0 + else + bmc_fan_speed_ctrl 1 1 + fi +} + +do_thermal_update() +{ + if [ -e /sys/bus/i2c/devices/0-004f/temp1_input ];then + #lm75_1 + thermal_val=$(echo $ipmi_val | awk '{printf $29}') + thermal_val=$( printf "%d" 0x$thermal_val ) + thermal_val=`expr $thermal_val \* 1000` + echo $thermal_val > /sys/bus/i2c/devices/0-004f/temp1_input + + #lm75_2 + thermal_val=$(echo $ipmi_val | awk '{printf $30}') + thermal_val=$( printf "%d" 0x$thermal_val ) + thermal_val=`expr $thermal_val \* 1000` + echo $thermal_val > /sys/bus/i2c/devices/0-0049/temp1_input + + #lm75_3 + thermal_val=$(echo $ipmi_val | awk '{printf $31}') + thermal_val=$( printf "%d" 0x$thermal_val ) + thermal_val=`expr $thermal_val \* 1000` + echo $thermal_val > /sys/bus/i2c/devices/0-004a/temp1_input + + #lm75_4 + thermal_val=$(echo $ipmi_val | awk '{printf $32}') + thermal_val=$( printf "%d" 0x$thermal_val ) + thermal_val=`expr $thermal_val \* 1000` + echo $thermal_val > /sys/bus/i2c/devices/0-004b/temp1_input + + #lm75_5 + thermal_val=$(echo $ipmi_val | awk '{printf $32}') + thermal_val=$( printf "%d" 0x$thermal_val ) + thermal_val=`expr $thermal_val \* 1000` + echo $thermal_val > /sys/bus/i2c/devices/0-004c/temp1_input + + #lm75_6 + thermal_val=$(echo $ipmi_val | awk '{printf $33}') + thermal_val=$( printf "%d" 0x$thermal_val ) + thermal_val=`expr $thermal_val \* 1000` + echo $thermal_val > /sys/bus/i2c/devices/0-004d/temp1_input + + #lm75_7 + thermal_val=$(echo $ipmi_val | awk '{printf $34}') + thermal_val=$( printf "%d" 0x$thermal_val ) + thermal_val=`expr $thermal_val \* 1000` + echo $thermal_val > /sys/bus/i2c/devices/0-004e/temp1_input + fi +} + +FAN_Thermal_monitor() +{ + if [ $debug_flag -eq 1 ];then + fan_pwm_input=100 + echo $fan_pwm_input > /sys/bus/i2c/devices/0-0066/fan_duty_cycle_percentage + fi + + while true + do + #get bmc sensor value + bmc_sensor_read + if [ $? -eq 0 ];then + do_fan_update + do_thermal_update + fi + + sleep 1 + done +} + +FAN_Thermal_monitor diff --git a/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/utils/sonic-led-monitor b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/utils/sonic-led-monitor new file mode 100755 index 0000000000..ba4f4c8dae --- /dev/null +++ b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/utils/sonic-led-monitor @@ -0,0 +1,201 @@ +#!/bin/bash + +#0=off, 1=green, 2=amber, 3=blk_green +led_state=0 + +#$1=led_no(1=loc, 2=diag, 3=fan, 4=psu1, 5=psu2) +bmc_led_read() +{ + led_state=0 + rtn_state=0 + val=$(ipmitool raw 0x30 0x97 2>>/dev/null) + if [ $? -eq 0 ];then + if [ $1 -eq 1 ];then + rtn_state=$(echo $val | awk '{printf $1}') + rtn_state=$( printf "%d" 0x$rtn_state ) + if [ $rtn_state -eq 0 ];then + led_state=0 + return 1 + fi + + tmp=$(($rtn_state & 1)) + if [ $tmp -eq 1 ];then + led_state=2 + return 1 + fi + + tmp=$(($rtn_state & 2)) + if [ $tmp -eq 2 ];then + led_state=3 + return 1 + fi + + tmp=$(($rtn_state & 4)) + if [ $tmp -eq 4 ];then + led_state=1 + return 1 + fi + + elif [ $1 -eq 2 ];then + rtn_state=$(echo $val | awk '{printf $2}') + rtn_state=$( printf "%d" 0x$rtn_state ) + if [ $rtn_state -eq 0 ];then + led_state=0 + return 1 + fi + + tmp=$(($rtn_state & 1)) + if [ $tmp -eq 1 ];then + led_state=2 + return 1 + fi + + tmp=$(($rtn_state & 2)) + if [ $tmp -eq 2 ];then + led_state=3 + return 1 + fi + + tmp=$(($rtn_state & 4)) + if [ $tmp -eq 4 ];then + led_state=1 + return 1 + fi + + elif [ $1 -eq 3 ];then + rtn_state=$(echo $val | awk '{printf $3}') + rtn_state=$( printf "%d" 0x$rtn_state ) + if [ $rtn_state -eq 0 ];then + led_state=0 + return 1 + fi + + tmp=$(($rtn_state & 1)) + if [ $tmp -eq 1 ];then + led_state=1 + return 1 + fi + + tmp=$(($rtn_state & 2)) + if [ $tmp -eq 2 ];then + led_state=2 + return 1 + fi + + elif [ $1 -eq 4 ];then + rtn_state=$(echo $val | awk '{printf $4}') + rtn_state=$( printf "%d" 0x$rtn_state ) + if [ $rtn_state -eq 0 ];then + led_state=0 + return 1 + fi + + tmp=$(($rtn_state & 1)) + if [ $tmp -eq 1 ];then + led_state=1 + return 1 + fi + + tmp=$(($rtn_state & 2)) + if [ $tmp -eq 2 ];then + led_state=2 + return 1 + fi + + else + rtn_state=$(echo $val | awk '{printf $5}') + rtn_state=$( printf "%d" 0x$rtn_state ) + if [ $rtn_state -eq 0 ];then + led_state=0 + return 1 + fi + + tmp=$(($rtn_state & 1)) + if [ $tmp -eq 1 ];then + led_state=1 + return 1 + fi + + tmp=$(($rtn_state & 2)) + if [ $tmp -eq 2 ];then + led_state=2 + return 1 + fi + + fi + fi + + return 0 +} + +#$1=led_no(1=loc, 2=diag, 3=fan, 4=psu1, 5=psu2) +#$2=led_val(0=off, 1=green, 2=amber, 3=blk_green) +bmc_led_write() +{ + led_val=$2 + val=$(ipmitool raw 0x30 0x97 2>>/dev/null) + loc_val=$(echo $val | awk '{printf $1}') + diag_val=$(echo $val | awk '{printf $2}') + fan_val=$(echo $val | awk '{printf $3}') + psu1_val=$(echo $val | awk '{printf $4}') + psu2_val=$(echo $val | awk '{printf $5}') + + loc_val=$( printf "%d" 0x$loc_val ) + diag_val=$( printf "%d" 0x$diag_val ) + fan_val=$( printf "%d" 0x$fan_val ) + psu1_val=$( printf "%d" 0x$psu1_val ) + psu2_val=$( printf "%d" 0x$psu2_val ) + + if [ $1 -eq 1 ];then + loc_val=$(($loc_val & $led_val)) + elif [ $1 -eq 2 ];then + diag_val=$(($diag_val & $led_val)) + elif [ $1 -eq 3 ];then + fan_val=$(($fan_val & $led_val)) + elif [ $1 -eq 4 ];then + psu1_val=$(($psu1_val & $led_val)) + else + psu2_val=$(($psu2_val & $led_val)) + fi + + ipmitool raw 0x30 0x96 $loc_val $diag_val $fan_val $psu1_val $psu2_val 1>>/dev/null 2>>/dev/null +} + +LED_monitor() +{ + local loc_state=0 + #default set loc led to off + echo $loc_state > /sys/bus/i2c/devices/0-0060/sys_led_loc + + while true + do + if [ -e /sys/bus/i2c/devices/0-0060/sys_led_diag ];then + loc_state=$(cat /sys/bus/i2c/devices/0-0060/sys_led_loc | awk '{printf $1}') + bmc_led_write 1 $loc_state + + bmc_led_read 2 + if [ $? -eq 1 ];then + echo $led_state > /sys/bus/i2c/devices/0-0060/sys_led_diag + fi + + bmc_led_read 3 + if [ $? -eq 1 ];then + echo $led_state > /sys/bus/i2c/devices/0-0060/sys_led_fan + fi + + bmc_led_read 4 + if [ $? -eq 1 ];then + echo $led_state > /sys/bus/i2c/devices/0-0060/sys_led_psu1 + fi + + bmc_led_read 5 + if [ $? -eq 1 ];then + echo $led_state > /sys/bus/i2c/devices/0-0060/sys_led_psu2 + fi + fi + + sleep 1 + done +} + +LED_monitor diff --git a/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/utils/sonic-psu-monitor b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/utils/sonic-psu-monitor new file mode 100755 index 0000000000..bcb3502e4a --- /dev/null +++ b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/utils/sonic-psu-monitor @@ -0,0 +1,328 @@ +#!/bin/bash + +result=0 +debug_flag=0 +bmc_fan_duty_cycle_ctrl() +{ + #control PSU 1 + fan_pwm_input=$(cat /sys/bus/i2c/devices/0-005a/psu_fan1_duty_cycle | awk '{print $1}') + lo_byte_1= $((fan_pwm_input & 0xff)) + hi_byte_1= $((fan_pwm_input >> 8)) + + #control PSU 2 + fan_pwm_input=$(cat /sys/bus/i2c/devices/0-0059/psu_fan1_duty_cycle | awk '{print $1}') + lo_byte_2= $((fan_pwm_input & 0xff)) + hi_byte_2= $((fan_pwm_input >> 8)) + + + ipmitool raw 0x30 0x95 hi_byte_1 lo_byte_1 hi_byte_2 lo_byte_2 + + return 1 +} +byte_read(){ + data=$(echo $val | awk '{print $'"$1"'}') + data=$(printf "%d" 0x$data) + Value=$data + return 1 + +} +add_byte(){ + hi_byte=$(echo $val | awk '{print $'"$1"'}') + lo_byte=$(echo $val | awk '{print $'"$2"'}') + hi_byte=$(printf "%d" 0x$hi_byte) + lo_byte=$(printf "%d" 0x$lo_byte) + ((hi_byte <<= 8)) + Value=$(($lo_byte+$hi_byte)) + return 1 +} +# string_read [start byte] [length] +string_read(){ + Value="" + seqnum=$(($1+$2-1)) + for i in $(seq $1 $seqnum) + do + data=$(echo $val | awk '{print $'"$i"'}') + data=$(printf "%d" 0x$data) + if [ $data -ne 0 ];then + Value=$Value$(printf "$(printf '\\x%x' $data)") + else + data=0x20 + Value=$Value$(printf "$(printf '\\x%x' $data)") + fi + done + return 1 +} +#$1=dev_addr, $2=reg, $3=val +get_PSU_information() +{ + val=$(ipmitool raw 0x30 0x93 2>>/dev/null) + ##################################################################################### + # BMC_command content resultfile algorithm # + # 93 2:5 vin 5a/59 psu_v_in LINEAR_11 # + # 93 6:9 vout 5a/59 psu_v_out LINEAR_16 # + # 93 10:13 Iin 5a/59 psu_i_in LINEAR_11 # + # 93 14:17 Iout 5a/59 psu_i_out LINEAR_11 # + # 93 18:21 Pin 5a/59 psu_p_in LINEAR_11 # + # 93 22:25 Pout 5a/59 psu_p_out LINEAR_11 # + # 93 26:27 temp1 5a/59 psu_temp1_input # + # 93 28:29 temp2 DISCARD # + # 93 30:31 temp3 DISCARD # + # 93 32:33 fan_fault 5a/59 psu_fan1_fault # + # 93 34:37 fan_command 5a/59 psu_fan1_duty_cycle # + # 93 38:41 fan_speed 5a/59 psu_fan1_speed_rpm LINEAR_11 # + # 93 42:43 psu_present 52/51 psu_present # + # 93 44:45 power_good 52/51 psu_power_good # + # 94 2:23 mfr_ID 5a/59 psu_mfr_id # + # 94 24:45 mfr_model 5a/59 psu_mfr_model # + # 94 46:49 mfr_rev 5a/59 psu_mfr_revision # + # 94 50:97 mfr_serial 5a/59 psu_mfr_serial # + # TBD pmbus_rev. 5a/59 psu_pmbus_revision # + # 98 2:21 psu_model_name 52/51 psu_model_name # + # 98 22:59 psu_serial 52/51 psu_serial_number # + ##################################################################################### +#_______________________with _LINEAR11&16 VIN IIN IOUT PIN POUT FAN_SPEED with _LINEAR16 VOUT + if [ -e /sys/bus/i2c/devices/0-005a/psu_mfr_id ] && [ -e /sys/bus/i2c/devices/0-0059/psu_mfr_id ];then + #PSU1 Vin + add_byte 1 2 + if [ $? -eq 1 ];then + echo $Value > /sys/bus/i2c/devices/0-005a/psu_v_in + fi + #PSU2 Vin + add_byte 3 4 + if [ $? -eq 1 ];then + echo $Value > /sys/bus/i2c/devices/0-0059/psu_v_in + fi + #PSU 1 Vout + add_byte 5 6 + if [ $? -eq 1 ];then + echo $Value > /sys/bus/i2c/devices/0-005a/psu_v_out + fi + #PSU 2 Vout + add_byte 7 8 + if [ $? -eq 1 ];then + echo $Value > /sys/bus/i2c/devices/0-0059/psu_v_out + fi + #PSU 1 Iin + add_byte 9 10 + if [ $? -eq 1 ];then + echo $Value > /sys/bus/i2c/devices/0-005a/psu_i_in + fi + #PSU 2 Iin + add_byte 11 12 + if [ $? -eq 1 ];then + echo $Value > /sys/bus/i2c/devices/0-0059/psu_i_in + fi + #PSU 1 Iout + add_byte 13 14 + if [ $? -eq 1 ];then + echo $Value > /sys/bus/i2c/devices/0-005a/psu_i_out + fi + #PSU 2 Iout + add_byte 15 16 + if [ $? -eq 1 ];then + echo $Value > /sys/bus/i2c/devices/0-0059/psu_i_out + fi + #PSU 1 Pin + add_byte 17 18 + if [ $? -eq 1 ];then + echo $Value > /sys/bus/i2c/devices/0-005a/psu_p_in + fi + #PSU 2 Pin + add_byte 19 20 + if [ $? -eq 1 ];then + echo $Value > /sys/bus/i2c/devices/0-0059/psu_p_in + fi + #PSU 1 Pout + add_byte 21 22 + if [ $? -eq 1 ];then + echo $Value > /sys/bus/i2c/devices/0-005a/psu_p_out + fi + #PSU 2 Pout + add_byte 23 24 + if [ $? -eq 1 ];then + echo $Value > /sys/bus/i2c/devices/0-0059/psu_p_out + fi + #PSU 1 Fan speed + add_byte 37 38 + if [ $? -eq 1 ];then + echo $Value > /sys/bus/i2c/devices/0-005a/psu_fan1_speed_rpm + fi + #PSU 2 Fan speed + add_byte 39 40 + if [ $? -eq 1 ];then + echo $Value > /sys/bus/i2c/devices/0-0059/psu_fan1_speed_rpm + fi +#_______________________with _LINEAR11&16 VIN IIN IOUT PIN POUT FAN_SPEED with _LINEAR16 VOUT +#----------------93->/58/59----psu_fan1_fault psu_temp1_input psu_fan1_duty_cycle + #PSU 1 Temp1 + byte_read 25 + echo $Value > /sys/bus/i2c/devices/0-005a/psu_temp1_input + #PSU 2 Temp1 + byte_read 26 + echo $Value > /sys/bus/i2c/devices/0-0059/psu_temp1_input + if [ $debug_flag -eq 0 ];then + #PSU 1 Fan command + add_byte 33 34 + if [ $? -eq 1 ];then + echo $Value > /sys/bus/i2c/devices/0-005a/psu_fan1_duty_cycle + fi + #PSU 2 Fan command + add_byte 35 36 + if [ $? -eq 1 ];then + echo $Value > /sys/bus/i2c/devices/0-0059/psu_fan1_duty_cycle + fi + fi + #PSU 1 2 Fan status check fault(0x81,bit 7, 0 for ignormal) + byte_read 31 + ((Value >>= 7)) + echo $Value > /sys/bus/i2c/devices/0-005a/psu_fan1_fault + + #PSU 2 Fan status check fault(0x81,bit 7, 0 for ignormal) + byte_read 32 + ((Value >>= 7)) + echo $Value > /sys/bus/i2c/devices/0-0059/psu_fan1_fault + fi + +#____________________________________ +#----------------93->/50/51 + if [ -e /sys/bus/i2c/devices/0-0051/psu_serial_number ] && [ -e /sys/bus/i2c/devices/0-0052/psu_serial_number ];then + #PSU 1 2 PSU present + byte_read 41 + if [ $Value -eq 0 ];then + Value=1 + else + Value=0 + fi + echo $Value > /sys/bus/i2c/devices/0-0052/psu_present + + byte_read 42 + if [ $Value -eq 0 ];then + Value=1 + else + Value=0 + fi + echo $Value > /sys/bus/i2c/devices/0-0051/psu_present + #PSU 1 2 PSU power good + byte_read 43 + echo $Value > /sys/bus/i2c/devices/0-0052/psu_power_good + + byte_read 44 + echo $Value > /sys/bus/i2c/devices/0-0051/psu_power_good + fi +#____________________________________________________________________________ + + val=$(ipmitool raw 0x30 0x94 2>>/dev/null) +#----------------94->/58/59 + if [ -e /sys/bus/i2c/devices/0-005a/psu_mfr_id ] && [ -e /sys/bus/i2c/devices/0-0059/psu_mfr_id ];then + #PSU1 mfr_ID + string_read 1 11 + if [ $? -eq 1 ];then + echo $Value > /sys/bus/i2c/devices/0-005a/psu_mfr_id + fi + #PSU2 mfr_ID + string_read 12 11 + if [ $? -eq 1 ];then + echo $Value > /sys/bus/i2c/devices/0-0059/psu_mfr_id + fi + #PSU1 mfr_model + string_read 23 11 + if [ $? -eq 1 ];then + echo $Value > /sys/bus/i2c/devices/0-005a/psu_mfr_model + fi + #PSU2 mfr_model + string_read 34 11 + if [ $? -eq 1 ];then + echo $Value > /sys/bus/i2c/devices/0-0059/psu_mfr_model + fi + #PSU1 mfr_revision + string_read 45 2 + if [ $? -eq 1 ];then + echo $Value > /sys/bus/i2c/devices/0-005a/psu_mfr_revision + fi + #PSU2 mfr_revision + string_read 47 2 + if [ $? -eq 1 ];then + echo $Value > /sys/bus/i2c/devices/0-0059/psu_mfr_revision + fi + #PSU1 mfr_serial + string_read 49 24 + if [ $? -eq 1 ];then + echo $Value > /sys/bus/i2c/devices/0-005a/psu_mfr_serial + fi + #PSU1 mfr_serial + string_read 73 24 + if [ $? -eq 1 ];then + echo $Value > /sys/bus/i2c/devices/0-0059/psu_mfr_serial + fi + fi +#____________________________________________________________________________ +#----------------98->/50/51 + val=$(ipmitool raw 0x30 0x98 2>>/dev/null) + if [ -e /sys/bus/i2c/devices/0-0051/psu_serial_number ] && [ -e /sys/bus/i2c/devices/0-0052/psu_serial_number ];then + #PSU 1 psu_model_name + string_read 1 10 + if [ $? -eq 1 ];then + echo $Value > /sys/bus/i2c/devices/0-0052/psu_model_name + fi + if [ "$(echo $Value |cut -c 5)" == 8 ];then #"082" for f2b "095" for b2f + echo 0 > /sys/bus/i2c/devices/0-0052/psu_fan_dir + else + echo 1 > /sys/bus/i2c/devices/0-0052/psu_fan_dir + fi + #PSU 2 psu_model_name + string_read 11 10 + if [ $? -eq 1 ];then + echo $Value > /sys/bus/i2c/devices/0-0051/psu_model_name + fi + if [ "$(echo $Value |cut -c 5)" == 8 ];then #"082" for f2b "095" for b2f + echo 0 > /sys/bus/i2c/devices/0-0051/psu_fan_dir + else + echo 1 > /sys/bus/i2c/devices/0-0051/psu_fan_dir + fi + if [ $(cat /sys/bus/i2c/devices/0-0052/psu_present) -eq 1 ];then + fan_dir=$(cat /sys/bus/i2c/devices/0-0052/psu_fan_dir) + else + fan_dir=$(cat /sys/bus/i2c/devices/0-0051/psu_fan_dir) + fi + echo $fan_dir > /sys/bus/i2c/devices/0-0066/fan1_direction + echo $fan_dir > /sys/bus/i2c/devices/0-0066/fan2_direction + echo $fan_dir > /sys/bus/i2c/devices/0-0066/fan3_direction + echo $fan_dir > /sys/bus/i2c/devices/0-0066/fan4_direction + echo $fan_dir > /sys/bus/i2c/devices/0-0066/fan5_direction + echo $fan_dir > /sys/bus/i2c/devices/0-0066/fan6_direction + echo $fan_dir > /sys/bus/i2c/devices/0-0066/fan7_direction + #PSU 1 psu_serial_number + string_read 21 19 + if [ $? -eq 1 ];then + echo $Value > /sys/bus/i2c/devices/0-0052/psu_serial_number + fi + #PSU 2 psu_serial_number + string_read 40 19 + if [ $? -eq 1 ];then + echo $Value > /sys/bus/i2c/devices/0-0051/psu_serial_number + fi + fi + + +#_____________________________________________ + +} + +#$1=dev_addr, $2=reg, $3=len + +PSU_monitor() +{ + + while true + do + + get_PSU_information + if [ $debug_flag -eq 1 ];then + bmc_fan_speed_ctrl + fi + + sleep 1 + done +} + +PSU_monitor diff --git a/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/utils/sonic-qsfp-monitor b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/utils/sonic-qsfp-monitor new file mode 100755 index 0000000000..e32f2ac8b7 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/utils/sonic-qsfp-monitor @@ -0,0 +1,302 @@ +#!/bin/bash + +debug_flag=0 +port_map=('00' '10' '11' '12' '13' '14' '15' '16' '17' '18' '19' '20' '21' '22' '23' '24' '25' '26' '27' '28' '29' '30' '31' '32' '33' '34' '35' '36' '37' '38' '39' '40' '41') +port_1_8_presence=0 +port_9_16_presence=0 +port_17_24_presence=0 +port_25_32_presence=0 +port_1_8_reset=0 +port_9_16_reset=0 +port_17_24_reset=0 +port_25_32_reset=0 + +result=0 + +#$1=dev_addr, $2=reg, $3=val +bmc_write() +{ + addr_8b=$(echo $(($1)) | awk '{printf $1}') + addr_8b=`expr $addr_8b \\* 2` + ipmitool raw 0x06 0x52 0x05 $addr_8b 0 $2 $3 1>>/dev/null 2>>/dev/null +} + +#$1=dev_addr, $2=reg, $3=len +bmc_read() +{ + addr_8b=$(echo $(($1)) | awk '{printf $1}') + addr_8b=`expr $addr_8b \\* 2` + val=$(ipmitool raw 0x06 0x52 0x05 $addr_8b $3 $2 2>>/dev/null) + if [ $? -eq 0 ];then + result=$val + return 1 + else + return 0 + fi +} + +bmc_qsfp_presence_read() +{ + val=$(ipmitool raw 0x30 0x92 2>>/dev/null) + if [ $? -eq 0 ];then + port_1_8_presence=$(echo $val | awk '{printf $36}') + port_9_16_presence=$(echo $val | awk '{printf $37}') + port_17_24_presence=$(echo $val | awk '{printf $40}') + port_25_32_presence=$(echo $val | awk '{printf $41}') + + port_1_8_presence=$( printf "%d" 0x$port_1_8_presence ) + port_9_16_presence=$( printf "%d" 0x$port_9_16_presence ) + port_17_24_presence=$( printf "%d" 0x$port_17_24_presence ) + port_25_32_presence=$( printf "%d" 0x$port_25_32_presence ) + return 1 + fi + + return 0 +} + +bmc_qsfp_reset_read() +{ + val=$(ipmitool raw 0x30 0x92 2>>/dev/null) + if [ $? -eq 0 ];then + port_1_8_reset=$(echo $val | awk '{printf $38}') + port_9_16_reset=$(echo $val | awk '{printf $39}') + port_17_24_reset=$(echo $val | awk '{printf $42}') + port_25_32_reset=$(echo $val | awk '{printf $43}') + + port_1_8_reset=$( printf "%d" 0x$port_1_8_reset ) + port_9_16_reset=$( printf "%d" 0x$port_9_16_reset ) + port_17_24_reset=$( printf "%d" 0x$port_17_24_reset ) + port_25_32_reset=$( printf "%d" 0x$port_25_32_reset ) + return 1 + fi + + return 0 +} + +#$1=port_no +bmc_qsfp_reset_write() +{ + local port=$1 + + val=$(ipmitool raw 0x30 0x92 2>>/dev/null) + if [ $? -eq 0 ];then + ori_1_8_reset=$(echo $val | awk '{printf $38}') + ori_9_16_reset=$(echo $val | awk '{printf $39}') + ori_17_24_reset=$(echo $val | awk '{printf $42}') + ori_25_32_reset=$(echo $val | awk '{printf $43}') + + ori_1_8_reset=$( printf "%d" 0x$ori_1_8_reset ) + ori_9_16_reset=$( printf "%d" 0x$ori_9_16_reset ) + ori_17_24_reset=$( printf "%d" 0x$ori_17_24_reset ) + ori_25_32_reset=$( printf "%d" 0x$ori_25_32_reset ) + else + return 0 + fi + + port=`expr $port - 1` + port_blk=0 + port_blk=`expr $port / 8` + bit_idx=`expr $port % 8` + bit_idx=$((1<<$bit_idx)) + + if [ $port_blk -eq 1 ];then + tmp_1_8_reset=$(($ori_1_8_reset ^ $bit_idx)) + elif [ $port_blk -eq 2 ];then + tmp_9_16_reset=$(($ori_9_16_reset ^ $bit_idx)) + elif [ $port_blk -eq 3 ];then + tmp_17_24_reset=$(($ori_17_24_reset ^ $bit_idx)) + else + tmp_25_32_reset=$(($ori_25_32_reset ^ $bit_idx)) + fi + + #set to reset state + ipmitool raw 0x30 0x91 $tmp_1_8_reset $tmp_9_16_reset $tmp_17_24_reset $tmp_25_32_reset 1>>/dev/null 2>>/dev/null + + #set back to normal state + ipmitool raw 0x30 0x91 $ori_1_8_reset $ori_9_16_reset $ori_17_24_reset $ori_25_32_reset 1>>/dev/null 2>>/dev/null +} + +#$1=port_no +bmc_qsfp_eeprom_read() +{ + local port=$1 + local eeprom_part1 + local eeprom_part2 + local eeprom_part3 + local eeprom_part4 + local eeprom1_full + local eeprom2_full + + port=`expr $port - 1` + i2cmux_dev=0 + i2cmux_dev=`expr $port / 8` + i2cmux_dev=`expr $i2cmux_dev + $((0x72))` + ch=`expr $port % 8` + ch=$((1<<$ch)) + + bmc_write $i2cmux_dev 0x00 $ch + + bmc_write 0x50 0x7f 0x00 + bmc_read 0x50 0 128 + if [ $? -eq 1 ];then + eeprom_part1=$result + else + bmc_write $i2cmux_dev 0x00 0x0 + return 1 + fi + + bmc_read 0x50 128 128 + if [ $? -eq 1 ];then + eeprom_part2=$result + else + bmc_write $i2cmux_dev 0x00 0x0 + return 1 + fi + + #QSFP-DD page2 + bmc_write 0x50 0x7f 0x02 + bmc_read 0x50 128 128 + if [ $? -eq 1 ];then + eeprom_part3=$result + else + bmc_write $i2cmux_dev 0x00 0x0 + return 1 + fi + + #QSFP-DD page11 + bmc_write 0x50 0x7f 0x11 + bmc_read 0x50 128 128 + if [ $? -eq 1 ];then + eeprom_part4=$result + else + bmc_write $i2cmux_dev 0x00 0x0 + return 1 + fi + + sfp_type=$(echo $eeprom_part1 | awk '{printf $1}') + sfp_type=$( printf "%d" 0x$sfp_type ) + + #get temperature + temp=$(echo $eeprom_part1 | awk '{printf $15}') + if [ $temp != "" ];then + temp=$( printf "%d" 0x$temp ) + temp_path="/sys/bus/i2c/devices/0-00"${port_map[$1]}"/temp" + echo $temp > $temp_path + fi + + #get lp_mode + lpmod_path="/sys/bus/i2c/devices/0-00"${port_map[$1]}"/lp_mode" + if [ $sfp_type -eq 24 ];then + lpmod=$(echo $eeprom_part1 | awk '{printf $27}') + if [ $lpmod != "" ];then + state=$((lpmod&0x10)) + if [ $state -eq 16 ];then + echo 1 > $lpmod_path + else + echo 0 > $lpmod_path + fi + fi + elif [ $sfp_type -eq 17 ];then + lpmod=$(echo $eeprom_part1 | awk '{printf $93}') + if [ $lpmod != "" ];then + state=$((lpmod&0x02)) + if [ $state -eq 2 ];then + echo 1 > $lpmod_path + else + echo 0 > $lpmod_path + fi + fi + else + lpmod="" + fi + + eeprom1_full=$eeprom_part1$eeprom_part2 + eeprom1_full=$(echo $eeprom1_full | sed 's/[[:space:]]//g') + eeprom2_full=$eeprom_part3$eeprom_part4 + eeprom2_full=$(echo $eeprom2_full | sed 's/[[:space:]]//g') + + if [ $debug_flag -eq 0 ];then + eeprom1_path="/sys/bus/i2c/devices/0-00"${port_map[$1]}"/eeprom1" + eeprom1_full=$(echo $eeprom1_full | sed -e 's/ //g') + echo $eeprom1_full > $eeprom1_path + eeprom2_path="/sys/bus/i2c/devices/0-00"${port_map[$1]}"/eeprom2" + eeprom2_full=$(echo $eeprom2_full | sed -e 's/ //g') + echo $eeprom2_full > $eeprom2_path + else + printf "\nPort %d EEPROM:" $1 + printf "-----------------------------------------------\n" + for i in $(seq 1 256); + do + printf "%s " ${eeprom1_full:0:2} + eeprom1_full=$(echo $eeprom1_full | sed 's/^..//') + + val=`expr $i % 16` + if [ $val -eq 0 ];then + printf "\n" + fi + done + printf "\n-----------------------------------------------\n" + fi + + bmc_write $i2cmux_dev 0x00 0x0 + return 0 +} + +#$1=port_no +bmc_qsfp_eeprom_clear() +{ + eeprom1_path="/sys/bus/i2c/devices/0-00"${port_map[$1]}"/eeprom1" + echo "" > $eeprom1_path + eeprom2_path="/sys/bus/i2c/devices/0-00"${port_map[$1]}"/eeprom2" + echo "" > $eeprom2_path +} + +QSFP_monitor() +{ + while true + do + if [ -e /sys/bus/i2c/devices/0-0061/module_present_1 ] && [ -e /sys/bus/i2c/devices/0-0062/module_present_32 ] && [ -e /sys/bus/i2c/devices/0-0041/eeprom1 ];then + bmc_qsfp_presence_read + mod_presence=$((port_25_32_presence<<8)) + mod_presence=`expr $mod_presence + $port_17_24_presence` + mod_presence=$((mod_presence<<8)) + mod_presence=`expr $mod_presence + $port_9_16_presence` + mod_presence=$((mod_presence<<8)) + mod_presence=`expr $mod_presence + $port_1_8_presence` + + for i in $(seq 1 32); + do + idx=`expr $i - 1` + check_bit=$((1<<$idx)) + is_presence=$(($mod_presence & $check_bit)) + if [ $i -le 16 ];then + cpld_path="/sys/bus/i2c/devices/0-0061/" + else + cpld_path="/sys/bus/i2c/devices/0-0062/" + fi + + if [ $is_presence -eq 0 ];then + bmc_qsfp_eeprom_read $i + if [ $? -eq 0 ];then + echo 1 > $cpld_path"module_present_"$i + + reset_path=$cpld_path"module_reset_"$i + reset_input=$(cat $reset_path | awk '{printf $1}') + if [ $reset_input -eq 1 ];then + bmc_qsfp_reset_write $i + echo 0 > $reset_path + fi + fi + else + echo 0 > $cpld_path"module_present_"$i + bmc_qsfp_eeprom_clear $i + fi + done + sleep 5 + else + sleep 1 + fi + done +} + +QSFP_monitor diff --git a/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/utils/wistron_sw_to3200k_util.py b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/utils/wistron_sw_to3200k_util.py new file mode 100755 index 0000000000..e1a6841cec --- /dev/null +++ b/platform/innovium/sonic-platform-modules-wistron/sw-to3200k/utils/wistron_sw_to3200k_util.py @@ -0,0 +1,442 @@ +#!/usr/bin/env python + +""" +Usage: %(scriptName)s [options] command object + +options: + -h | --help : this help message + -d | --debug : run with debug mode + -f | --force : ignore error during installation or clean +command: + install : install drivers and generate related sysfs nodes + clean : uninstall drivers and remove related sysfs nodes + show : show all systen status + sff : dump SFP eeprom +""" + +import commands +import sys, getopt +import logging +import re +import time + +PROJECT_NAME = 'sw_to3200k' +version = '0.0.1' +verbose = False +DEBUG = False +args = [] +ALL_DEVICE = {} +DEVICE_NO = {'led':5, 'fan':7, 'thermal':7, 'psu':2, 'qsfp':32} + +led_prefix ='/sys/devices/platform/wistron_sw_to3200k_led/leds/wistron_'+PROJECT_NAME+'_led::' +hwmon_types = {'led': ['diag','fan','loc','psu1','psu2']} +hwmon_nodes = {'led': ['brightness']} +hwmon_prefix ={'led': led_prefix} + +i2c_prefix = '/sys/bus/i2c/devices/' + +i2c_bus = {'fan': ['0-0066'], + 'thermal': ['0-0049','0-004a','0-004b','0-004c','0-004d','0-004e','0-004f'], + 'psu': ['0-0051','0-0052'], + 'qsfp': ['0-0061']} + +i2c_nodes = {'fan': ['front_speed_rpm', 'rear_speed_rpm'], + 'thermal': ['temp1_input'], + 'psu': ['psu_present', 'psu_power_good'], + 'qsfp': ['module_present_']} + +sfp_map = [10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41] + +mknod =[ +'echo sw_to3200k_fpga 0x60 > /sys/bus/i2c/devices/i2c-0/new_device', +'echo sw_to3200k_cpld1 0x61 > /sys/bus/i2c/devices/i2c-0/new_device', +'echo sw_to3200k_cpld2 0x62 > /sys/bus/i2c/devices/i2c-0/new_device', +# FAN +'echo sw_to3200k_fan 0x66 > /sys/bus/i2c/devices/i2c-0/new_device', +# Thermal +'echo sw_to3200k_thermal 0x49 > /sys/bus/i2c/devices/i2c-0/new_device', +'echo sw_to3200k_thermal 0x4a > /sys/bus/i2c/devices/i2c-0/new_device', +'echo sw_to3200k_thermal 0x4b > /sys/bus/i2c/devices/i2c-0/new_device', +'echo sw_to3200k_thermal 0x4c > /sys/bus/i2c/devices/i2c-0/new_device', +'echo sw_to3200k_thermal 0x4d > /sys/bus/i2c/devices/i2c-0/new_device', +'echo sw_to3200k_thermal 0x4e > /sys/bus/i2c/devices/i2c-0/new_device', +'echo sw_to3200k_thermal 0x4f > /sys/bus/i2c/devices/i2c-0/new_device', +# PSU-1 eeprom 0x51 +'echo sw_to3200k_psu1 0x51 > /sys/bus/i2c/devices/i2c-0/new_device', +'echo acbel_fshxxx 0x59 > /sys/bus/i2c/devices/i2c-0/new_device', +# PSU-2 eeprom 0x52 +'echo sw_to3200k_psu2 0x52 > /sys/bus/i2c/devices/i2c-0/new_device', +'echo acbel_fshxxx 0x5a > /sys/bus/i2c/devices/i2c-0/new_device', +# EEPROM +'echo 24c02 0x56 > /sys/bus/i2c/devices/i2c-0/new_device', +] + +FORCE = 0 +logging.basicConfig(filename= PROJECT_NAME+'.log', filemode='w',level=logging.DEBUG) +logging.basicConfig(level=logging.INFO) + +if DEBUG == True: + print sys.argv[0] + print 'ARGV :', sys.argv[1:] + +def main(): + global DEBUG + global args + global FORCE + + logging.basicConfig(level=logging.INFO) + + if len(sys.argv)<2: + show_help() + + options, args = getopt.getopt(sys.argv[1:], 'hdf', ['help', + 'debug', + 'force', + ]) + if DEBUG == True: + print options + print args + print len(sys.argv) + + for opt, arg in options: + if opt in ('-h', '--help'): + show_help() + elif opt in ('-d', '--debug'): + DEBUG = True + logging.basicConfig(level=logging.INFO) + elif opt in ('-f', '--force'): + FORCE = 1 + else: + logging.info('no option') + for arg in args: + if arg == 'install': + do_install() + elif arg == 'clean': + do_uninstall() + elif arg == 'show': + device_traversal() + elif arg == 'sff': + if len(args)!=2: + show_eeprom_help() + elif int(args[1]) > DEVICE_NO['qsfp'] -1: + show_eeprom_help() + else: + show_eeprom(args[1]) + return + else: + show_help() + + + return 0 + +def show_help(): + print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + sys.exit(0) + +def show_eeprom_help(): + cmd = sys.argv[0].split("/")[-1]+ " " + args[0] + print " use \""+ cmd + " 1-32 \" to dump sfp# eeprom" + sys.exit(0) + +def my_log(txt): + if DEBUG == True: + print "[WISTRON DBG]: "+txt + return + +def log_os_system(cmd, show): + logging.info('Run :'+cmd) + output = "" + status, output = commands.getstatusoutput(cmd) + my_log (cmd +"with result:" + str(status)) + my_log ("cmd:" + cmd) + my_log (" output:"+output) + if status: + logging.info('Failed :'+cmd) + if show: + print('Failed :'+cmd) + return status, output + +def driver_inserted(): + ret, lsmod = log_os_system("lsmod | grep wistron", 0) + logging.info('mods:'+lsmod) + if len(lsmod) ==0: + return False + + +kos = [ +'modprobe ipmi_msghandler', +'modprobe ipmi_si', +'modprobe ipmi_devintf', +'modprobe i2c_dev', +'modprobe at24', +'modprobe wistron_i2c_psu', +'modprobe wistron_sw_to3200k_cpld', +'modprobe wistron_sw_to3200k_fan', +'modprobe wistron_sw_to3200k_leds', +'modprobe wistron_sw_to3200k_psu', +'modprobe wistron_sw_to3200k_oom', +'modprobe wistron_sw_to3200k_thermal'] + +def driver_install(): + global FORCE + log_os_system("depmod", 1) + for i in range(0,len(kos)): + status, output = log_os_system(kos[i], 1) + time.sleep(1) + if status: + if FORCE == 0: + return status + return 0 + +def driver_uninstall(): + global FORCE + for i in range(0,len(kos)): + rm = kos[-(i+1)].replace("modprobe", "modprobe -rq") + lst = rm.split(" ") + print "lst=%s"%lst + if len(lst) > 3: + del(lst[3]) + rm = " ".join(lst) + status, output = log_os_system(rm, 1) + if status: + if FORCE == 0: + return status + return 0 + +def device_install(): + global FORCE + for i in range(0,len(mknod)): + print "init i2c device instance" + status, output = log_os_system(mknod[i], 1) + if status: + print output + if FORCE == 0: + return status + + for i in range(0,len(sfp_map)): + status, output = log_os_system("echo sw_to3200k_oom 0x"+str(sfp_map[i])+ " > /sys/bus/i2c/devices/i2c-0/new_device", 1) + if status: + print output + if FORCE == 0: + return status + + for i in range(0,len(sfp_map)): + status, output =log_os_system("echo port"+str(i+1)+" > /sys/bus/i2c/devices/0-00"+str(sfp_map[i])+"/port_name", 1) + if status: + print output + if FORCE == 0: + return status + return + +def device_uninstall(): + global FORCE + + for i in range(0,len(sfp_map)): + target = "echo 0x"+str(sfp_map[i])+ " > /sys/bus/i2c/devices/i2c-0/delete_device" + print(target) + status, output =log_os_system(target, 1) + if status: + print output + if FORCE == 0: + return status + + nodelist = mknod + + for i in range(len(nodelist)): + target = nodelist[-(i+1)] + temp = target.split() + del temp[1] + temp[-1] = temp[-1].replace('new_device', 'delete_device') + status, output = log_os_system(" ".join(temp), 1) + if status: + print output + if FORCE == 0: + return status + + return + +def system_ready(): + if driver_inserted() == False: + return False + if not device_exist(): + print "not device_exist()" + return False + return True + +def do_install(): + if driver_inserted() == False: + status = driver_install() + time.sleep(1) + if status: + if FORCE == 0: + return status + else: + print PROJECT_NAME.upper()+" drivers detected...." + + if not device_exist(): + status = device_install() + if status: + if FORCE == 0: + return status + else: + print PROJECT_NAME.upper()+" devices detected...." + + status, output = log_os_system( + "/bin/sh /usr/local/bin/platform_api_mgnt.sh init", 1) + if status: + print output + if FORCE == 0: + return status + return + +def do_uninstall(): + if not device_exist(): + print PROJECT_NAME.upper() +" has no device installed...." + else: + print "Removing device...." + status = device_uninstall() + if status: + if FORCE == 0: + return status + + if driver_inserted()== False : + print PROJECT_NAME.upper() +" has no driver installed...." + else: + print "Removing installed driver...." + status = driver_uninstall() + if status: + if FORCE == 0: + return status + + return + +def devices_info(): + global DEVICE_NO + global ALL_DEVICE + global i2c_bus, hwmon_types + for key in DEVICE_NO: + ALL_DEVICE[key]= {} + for i in range(0,DEVICE_NO[key]): + ALL_DEVICE[key][key+str(i+1)] = [] + + for key in i2c_bus: + buses = i2c_bus[key] + nodes = i2c_nodes[key] + for i in range(0,len(buses)): + for j in range(0,len(nodes)): + if 'fan' == key: + for k in range(0,DEVICE_NO[key]): + node = key+str(k+1) + path = i2c_prefix+ buses[i]+"/fan"+str(k+1)+"_"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][node].append(path) + elif 'qsfp' == key: + for k in range(0,DEVICE_NO[key]): + node = key+str(k+1) + if k < 16: + path = i2c_prefix+"0-0061/"+ nodes[j]+str(k+1) + else: + path = i2c_prefix+"0-0062/"+ nodes[j]+str(k+1) + my_log(node+": "+ path) + ALL_DEVICE[key][node].append(path) + else: + node = key+str(i+1) + path = i2c_prefix+ buses[i]+"/"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][node].append(path) + + for key in hwmon_types: + itypes = hwmon_types[key] + nodes = hwmon_nodes[key] + for i in range(0,len(itypes)): + for j in range(0,len(nodes)): + node = key+"_"+itypes[i] + path = hwmon_prefix[key]+ itypes[i]+"/"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][ key+str(i+1)].append(path) + + #show dict all in the order + if DEBUG == True: + for i in sorted(ALL_DEVICE.keys()): + print(i+": ") + for j in sorted(ALL_DEVICE[i].keys()): + print(" "+j) + for k in (ALL_DEVICE[i][j]): + print(" "+" "+k) + return + +def show_eeprom(index): + if system_ready()==False: + print("System's not ready.") + print("Please install first!") + return + + node= "/sys/bus/i2c/devices/0-00"+str(sfp_map[int(index)-1])+"/eeprom1" + # check if got hexdump command in current environment + ret, log = log_os_system("which hexdump", 0) + ret, log2 = log_os_system("which busybox hexdump", 0) + if len(log): + hex_cmd = 'hexdump' + elif len(log2): + hex_cmd = ' busybox hexdump' + else: + log = 'Failed : no hexdump cmd!!' + logging.info(log) + print log + return 1 + + print "node=%s"%node + ret, log = log_os_system(hex_cmd+" -C " + node, 1) + if ret==0: + print log + else: + print "**********device no found**********" + return + +#get digits inside a string. +#Ex: 31 for "sfp31" +def get_value(input): + digit = re.findall('\d+', input) + return int(digit[0]) + +def device_traversal(): + if system_ready()==False: + print("System's not ready.") + print("Please install first!") + return + + if len(ALL_DEVICE)==0: + devices_info() + for i in sorted(ALL_DEVICE.keys()): + print("============================================") + print(i.upper()+": ") + print("============================================") + + for j in sorted(ALL_DEVICE[i].keys(), key=get_value): + print " "+j+":", + for k in (ALL_DEVICE[i][j]): + ret, log = log_os_system("cat "+k, 0) + func = k.split("/")[-1].strip() + func = re.sub(j+'_','',func,1) + func = re.sub(i.lower()+'_','',func,1) + if ret==0: + print func+"="+log+" ", + else: + print func+"="+"X"+" ", + print + print("----------------------------------------------------------------") + + + print + return + +def device_exist(): + ret1, log = log_os_system("ls "+i2c_prefix+"*0060", 0) + ret2, log = log_os_system("ls "+i2c_prefix+"i2c-0", 0) + return not(ret1 or ret2) + +if __name__ == "__main__": + main()