Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions device/nexthop/common/komodo/pcie-variables.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Commands to retrieve the bus number for each PCIe device.
# Context: PCIe bus numbers are non-deterministic and can be looked up
# from the root ports after boot.
#
# Strings in pcie.yaml.j2 matching "{{<name>}}" will be replaced with
# the result of the lookup_command, to generate /usr/share/sonic/platform/pcie.yaml.

- name: "asic_bus"
lookup_command: "setpci -s 00:01.2 0x19.b"

- name: "cpu_card_fpga_bus"
lookup_command: "setpci -s 00:02.1 0x19.b"

- name: "switchcard_fpga_bus"
lookup_command: "setpci -s 00:02.2 0x19.b"

- name: "nvme_bus"
lookup_command: "setpci -s 00:02.4 0x19.b"

- name: "amd_soc_group_1_bus"
lookup_command: "setpci -s 00:08.1 0x19.b"

- name: "amd_soc_group_2_bus"
lookup_command: "setpci -s 00:08.2 0x19.b"

- name: "amd_soc_group_3_bus"
lookup_command: "setpci -s 00:08.3 0x19.b"

# Commands to retrieve the PCIe address for each device.
# Strings in pddf-device.json.j2 matching "{{<name>}}"" will be replaced with
# the result of the lookup_command, to generate /usr/share/sonic/platform/pddf/pddf-device.json.

- name: "cpu_card_fpga_bdf"
lookup_command: "setpci -s 00:02.1 0x19.b | xargs printf '0000:%s:00.0'"

- name: "switchcard_fpga_bdf"
lookup_command: "setpci -s 00:02.2 0x19.b | xargs printf '0000:%s:00.0'"

# Commands to retrieve sysfs path for specific device.

- name: "hwmon_cpu_sysfs_path"
lookup_command: "readlink -f /sys/devices/pci0000:00/0000:00:18.3/hwmon/hwmon*"
42 changes: 0 additions & 42 deletions device/nexthop/x86_64-nexthop_4010-r0/pcie-variables.yaml

This file was deleted.

1 change: 1 addition & 0 deletions device/nexthop/x86_64-nexthop_4010-r0/pcie-variables.yaml
55 changes: 55 additions & 0 deletions device/nexthop/x86_64-nexthop_4010-r0/pddf/pddf-device.json.j2
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,15 @@
"std_kos": [
"at24",
"i2c-dev",
"spi-xilinx",
"adm1266",
"optoe"
],
"pddf_kos": [
"pddf_spi_module",
"pddf_multifpgapci_i2c_module",
"pddf_multifpgapci_gpio_module",
"pddf_multifpgapci_spi_module",
"pddf_client_module",
"pddf_multifpgapci_driver",
"pddf_multifpgapci_module",
Expand Down Expand Up @@ -253,6 +256,9 @@
}
]
},
{%- if platform == 'x86_64-nexthop_4010-r1' %}
"spi_controllers": ["CPUCARD_SPI_CONTROLLER"],
{%- endif %}
"gpio": {
"line0": {
"attr_list": [
Expand Down Expand Up @@ -13202,6 +13208,55 @@
]
}
},
{%- if platform == 'x86_64-nexthop_4010-r1' %}
"CPUCARD_SPI_CONTROLLER": {
"dev_info": {
"device_type": "SPI_CONTROLLER",
"device_parent": "MULTIFPGAPCIE0"
},
"spi_mode_commands": [
{
"enable": "fpga write32 CPUCARD_FPGA 0x4 --bits=0:0 0x1",
"disable": "fpga write32 CPUCARD_FPGA 0x4 --bits=0:0 0x0",
"comment": "Enable output to on-board SPI devices"
}
],
"dev_attr": {
"spi_base_addr": "0x50000",
"virt_spi_controllers": "1",
"virt_spi_controller_size": "0x200",
"spi_driver": "xilinx_spi",
"spi_num_cs": 5,
"spi_controller_name": "CPUCARD_SPI_CONTROLLER",
"spi_controller_idx": 1
},
"spi_devices": ["SWITCHCARD_CONFIG_FLASH"]
},
"SWITCHCARD_CONFIG_FLASH": {
"dev_info": {
"device_type": "SPI_DEVICE",
"device_name": "SWITCHCARD_CONFIG_FLASH",
"device_parent": "CPUCARD_SPI_CONTROLLER"
},
"is_persistent": false,
"spi_mode_commands": [
{
"enable": "fpga write32 CPUCARD_FPGA 0x44 --bits=11:11 0x1",
"disable": "fpga write32 CPUCARD_FPGA 0x44 --bits=11:11 0x0",
"comment": "Komodo controls Switch Card SPI config Flash"
},
{
"enable": "fpga write32 CPUCARD_FPGA 0x44 --bits=10:10 0x0",
"comment": "Select SPI protocol for config flash"
}
],
"dev_attr": {
"spi_device_driver": "spi-nor",
"max_speed_hz": 26000000,
"chip_select": 0
}
},
{%- endif %}
"WATCHDOG": {
"dev_info": {
"device_type": "WATCHDOG",
Expand Down
2 changes: 1 addition & 1 deletion device/nexthop/x86_64-nexthop_4010-r1/pcie-variables.yaml
2 changes: 1 addition & 1 deletion device/nexthop/x86_64-nexthop_4220-r0/pcie-variables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,14 @@
"std_kos": [
"at24",
"i2c-dev",
"spi-xilinx",
"optoe"
],
"pddf_kos": [
"pddf_spi_module",
"pddf_multifpgapci_i2c_module",
"pddf_multifpgapci_gpio_module",
"pddf_multifpgapci_spi_module",
"pddf_client_module",
"pddf_multifpgapci_driver",
"pddf_multifpgapci_module",
Expand Down
97 changes: 97 additions & 0 deletions device/nexthop/x86_64-nexthop_5010-r0/pddf/pddf-device.json.j2
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,15 @@
"std_kos": [
"at24",
"i2c-dev",
"spi-xilinx",
"optoe"
],
"pddf_kos": [
"pddf_spi_module",
"pddf_multifpgapci_i2c_module",
"pddf_multifpgapci_gpio_module",
"pddf_multifpgapci_mdio_module",
"pddf_multifpgapci_spi_module",
"pddf_client_module",
"pddf_multifpgapci_driver",
"pddf_multifpgapci_module",
Expand Down Expand Up @@ -799,6 +802,7 @@
}
]
},
"spi_controllers": ["CPUCARD_SPI_CONTROLLER"],
"gpio": {
"line0": {
"attr_list": [
Expand Down Expand Up @@ -2450,6 +2454,7 @@
}
]
},
"spi_controllers": ["SWITCHCARD_SPI_CONTROLLER"],
"gpio": {
"line0": {
"attr_list": [
Expand Down Expand Up @@ -17472,6 +17477,98 @@
]
}
},
"CPUCARD_SPI_CONTROLLER": {
"dev_info": {
"device_type": "SPI_CONTROLLER",
"device_parent": "MULTIFPGAPCIE0"
},
"spi_mode_commands": [
{
"enable": "fpga write32 CPUCARD_FPGA 0x4 --bits=0:0 0x1",
"disable": "fpga write32 CPUCARD_FPGA 0x4 --bits=0:0 0x0",
"comment": "Enable output to on-board SPI devices"
}
],
"dev_attr": {
"spi_base_addr": "0x50000",
"virt_spi_controllers": "1",
"virt_spi_controller_size": "0x200",
"spi_driver": "xilinx_spi",
"spi_num_cs": 5,
"spi_controller_name": "CPUCARD_SPI_CONTROLLER",
"spi_controller_idx": 1
},
"spi_devices": ["SWITCHCARD_CONFIG_FLASH"]
},
"SWITCHCARD_CONFIG_FLASH": {
"dev_info": {
"device_type": "SPI_DEVICE",
"device_name": "SWITCHCARD_CONFIG_FLASH",
"device_parent": "CPUCARD_SPI_CONTROLLER"
},
"is_persistent": false,
"spi_mode_commands": [
{
"enable": "fpga write32 CPUCARD_FPGA 0x44 --bits=11:11 0x1",
"disable": "fpga write32 CPUCARD_FPGA 0x44 --bits=11:11 0x0",
"comment": "Komodo controls Switch Card SPI config Flash"
},
{
"enable": "fpga write32 CPUCARD_FPGA 0x44 --bits=10:10 0x0",
"comment": "Select SPI protocol for config flash"
}
],
"dev_attr": {
"spi_device_driver": "spi-nor",
"max_speed_hz": 26000000,
"chip_select": 0
}
},
"SWITCHCARD_SPI_CONTROLLER": {
"dev_info": {
"device_type": "SPI_CONTROLLER",
"device_parent": "MULTIFPGAPCIE1"
},
"spi_mode_commands": [],
"dev_attr": {
"spi_base_addr": "0x50000",
"virt_spi_controllers": "1",
"virt_spi_controller_size": "0x200",
"spi_driver": "xilinx_spi",
"spi_num_cs": 5,
"spi_controller_name": "SWITCHCARD_SPI_CONTROLLER",
"spi_controller_idx": 2
},
"spi_devices": ["MEZZCARD_CONFIG_FLASH"]
},
"MEZZCARD_CONFIG_FLASH": {
"dev_info": {
"device_type": "SPI_DEVICE",
"device_name": "MEZZCARD_CONFIG_FLASH",
"device_parent": "SWITCHCARD_SPI_CONTROLLER"
},
"is_persistent": false,
"spi_mode_commands": [
{
"enable": "fpga write32 SWITCHCARD_FPGA 0x30 --bits=19:19 0x1",
"disable": "fpga write32 SWITCHCARD_FPGA 0x30 --bits=19:19 0x0",
"comment": "Switch Card controls Mezz Card SPI config Flash"
},
{
"enable": "fpga write32 SWITCHCARD_FPGA 0x24 --bits=31:31 0x0",
"comment": "Select SPI for Switch Card to Mezz Card programming interface"
},
{
"enable": "fpga write32 SWITCHCARD_FPGA 0x30 --bits=18:18 0x0",
"comment": "Select SPI protocol for config flash"
}
],
"dev_attr": {
"spi_device_driver": "spi-nor",
"max_speed_hz": 26000000,
"chip_select": 0
}
},
"WATCHDOG": {
"dev_info": {
"device_type": "WATCHDOG",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import syslog

from nexthop import pcie_lib
from sonic_py_common import device_info

PLATFORM_FOLDER = "/usr/share/sonic/platform"
PDDF_FOLDER = "/usr/share/sonic/platform/pddf"
Expand Down Expand Up @@ -114,6 +115,14 @@ def pddf_device_json(template_filepath, vars_filepath, platform_json_filepath, o
return

vars["model_name"] = model_name

platform = device_info.get_platform()
if platform is None:
syslog.syslog(syslog.LOG_ERR, f"Skipping {output_filepath} generation due to missing platform.")
return

vars["platform"] = platform

generate_file_from_jinja2_template(template_filepath, vars, output_filepath)


Expand Down
Loading
Loading