From 161c501efe16a93c6f1a7fccfa07ee5542a00f6a Mon Sep 17 00:00:00 2001 From: dzarista Date: Thu, 29 Jan 2026 22:53:10 +0000 Subject: [PATCH] BLACKWOLF800BANW: LED service support --- cmake/LedService.cmake | 3 + fboss/led_service/BUCK | 4 + .../Blackwolf800banwLedManager.cpp | 21 ++++ .../led_service/Blackwolf800banwLedManager.h | 35 ++++++ fboss/led_service/LedManagerInit.cpp | 3 + fboss/platform/config_lib/ConfigLibTest.cpp | 2 + .../configs/blackwolf800banw/led_manager.json | 108 ++++++++++++++++++ 7 files changed, 176 insertions(+) create mode 100644 fboss/led_service/Blackwolf800banwLedManager.cpp create mode 100644 fboss/led_service/Blackwolf800banwLedManager.h create mode 100644 fboss/platform/configs/blackwolf800banw/led_manager.json diff --git a/cmake/LedService.cmake b/cmake/LedService.cmake index 07babb9eabe43..a54697ff0032d 100644 --- a/cmake/LedService.cmake +++ b/cmake/LedService.cmake @@ -74,6 +74,7 @@ add_library(led_manager_lib fboss/led_service/Wedge800BACTLedManager.cpp fboss/led_service/Wedge800CACTLedManager.cpp fboss/led_service/Ladakh800bclsLedManager.cpp + fboss/led_service/Blackwolf800banwLedManager.cpp ) target_link_libraries(led_manager_lib @@ -95,6 +96,7 @@ target_link_libraries(led_manager_lib morgan800cc_bsp tahansb800bc_bsp ladakh800bcls_bsp + blackwolf800banw_bsp darwin_platform_mapping elbert_platform_mapping fuji_platform_mapping @@ -110,6 +112,7 @@ target_link_libraries(led_manager_lib tahan800bc_platform_mapping tahansb800bc_platform_mapping ladakh800bcls_platform_mapping + blackwolf800banw_platform_mapping wedge400_fpga wedge400_platform_mapping wedge800bact_platform_mapping diff --git a/fboss/led_service/BUCK b/fboss/led_service/BUCK index d15e8707d85bb..0145d39c0bc91 100644 --- a/fboss/led_service/BUCK +++ b/fboss/led_service/BUCK @@ -44,6 +44,7 @@ cpp_library( name = "led_manager", srcs = [ "BspLedManager.cpp", + "Blackwolf800banwLedManager.cpp", "FsdbSwitchStateSubscriber.cpp", "Icecube800bcLedManager.cpp", "Icetea800bcLedManager.cpp", @@ -72,6 +73,7 @@ cpp_library( "facebook/YampLedManager.cpp", ], headers = [ + "Blackwolf800banwLedManager.h", "BspLedManager.h", "DarwinLedManager.h", "ElbertLedManager.h", @@ -110,6 +112,7 @@ cpp_library( "//fboss/agent/platforms/common/darwin:darwin_platform_mapping", "//fboss/agent/platforms/common/elbert:elbert_platform_mapping", "//fboss/agent/platforms/common/fuji:fuji_platform_mapping", + "//fboss/agent/platforms/common/blackwolf800banw:blackwolf800banw_platform_mapping", "//fboss/agent/platforms/common/icecube800bc:icecube800bc_platform_mapping", "//fboss/agent/platforms/common/icetea800bc:icetea800bc_platform_mapping", "//fboss/agent/platforms/common/janga800bic:janga800bic_platform_mapping", @@ -134,6 +137,7 @@ cpp_library( "//fboss/lib:common_file_utils", "//fboss/lib:common_port_utils", "//fboss/lib/bsp:bsp_core", + "//fboss/lib/bsp/blackwolf800banw:blackwolf800banw_bsp", "//fboss/lib/bsp/icecube800bc:icecube800bc_bsp", "//fboss/lib/bsp/icetea800bc:icetea800bc_bsp", "//fboss/lib/bsp/janga800bic:janga800bic_bsp", diff --git a/fboss/led_service/Blackwolf800banwLedManager.cpp b/fboss/led_service/Blackwolf800banwLedManager.cpp new file mode 100644 index 0000000000000..7258118ad670e --- /dev/null +++ b/fboss/led_service/Blackwolf800banwLedManager.cpp @@ -0,0 +1,21 @@ +// (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary. + +#include "fboss/led_service/Blackwolf800banwLedManager.h" +#include "fboss/agent/platforms/common/blackwolf800banw/Blackwolf800banwPlatformMapping.h" +#include "fboss/lib/bsp/BspGenericSystemContainer.h" +#include "fboss/lib/bsp/blackwolf800banw/Blackwolf800banwBspPlatformMapping.h" + +namespace facebook::fboss { + +/* + * Blackwolf800banwLedManager ctor() + * + * Blackwolf800banwLedManager constructor will create the LedManager object for + * blackwolf800banw platform + */ +Blackwolf800banwLedManager::Blackwolf800banwLedManager() : BspLedManager() { + init(); + XLOG(INFO) << "Created Blackwolf800banw BSP LED Manager"; +} + +} // namespace facebook::fboss diff --git a/fboss/led_service/Blackwolf800banwLedManager.h b/fboss/led_service/Blackwolf800banwLedManager.h new file mode 100644 index 0000000000000..34e777394871b --- /dev/null +++ b/fboss/led_service/Blackwolf800banwLedManager.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2018-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ +#pragma once + +#include "fboss/led_service/BspLedManager.h" +#include "fboss/lib/bsp/BspSystemContainer.h" + +namespace facebook::fboss { + +/* + * Blackwolf800banwLedManager class definition: + * + * The BspLedManager class managing all LED in the system. The object is spawned + * by LED Service. This will subscribe to Fsdb to get Switch state update and + * then update the LED in hardware + */ +class Blackwolf800banwLedManager : public BspLedManager { + public: + Blackwolf800banwLedManager(); + virtual ~Blackwolf800banwLedManager() override {} + + // Forbidden copy constructor and assignment operator + Blackwolf800banwLedManager(Blackwolf800banwLedManager const&) = delete; + Blackwolf800banwLedManager& operator=(Blackwolf800banwLedManager const&) = + delete; +}; + +} // namespace facebook::fboss diff --git a/fboss/led_service/LedManagerInit.cpp b/fboss/led_service/LedManagerInit.cpp index 108902ba6f030..c323a3601cb9a 100644 --- a/fboss/led_service/LedManagerInit.cpp +++ b/fboss/led_service/LedManagerInit.cpp @@ -1,6 +1,7 @@ // (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary. #include "fboss/led_service/LedManagerInit.h" +#include "fboss/led_service/Blackwolf800banwLedManager.h" #include "fboss/led_service/DarwinLedManager.h" #include "fboss/led_service/ElbertLedManager.h" #include "fboss/led_service/FujiLedManager.h" @@ -80,6 +81,8 @@ std::unique_ptr createLedManager() { return std::make_unique(); } else if (mode == PlatformType::PLATFORM_LADAKH800BCLS) { return std::make_unique(); + } else if (mode == PlatformType::PLATFORM_BLACKWOLF800BANW) { + return std::make_unique(); } return nullptr; } diff --git a/fboss/platform/config_lib/ConfigLibTest.cpp b/fboss/platform/config_lib/ConfigLibTest.cpp index 5c034e49c0f50..3a404973f807f 100644 --- a/fboss/platform/config_lib/ConfigLibTest.cpp +++ b/fboss/platform/config_lib/ConfigLibTest.cpp @@ -16,6 +16,7 @@ const std::string kMeru800bfa = "meru800bfa"; const std::string kMorgan800cc = "morgan800cc"; const std::string kJanga800bic = "janga800bic"; const std::string kTahan800bc = "tahan800bc"; +const std::string kBlackwolf800banw = "blackwolf800banw"; const std::string kSample = "sample"; const std::string kNonExistentPlatform = "nonExistentPlatform"; } // namespace @@ -68,6 +69,7 @@ TEST(ConfigLibTest, Basic) { // LedManager Configs EXPECT_NO_THROW(ConfigLib().getLedManagerConfig(kDarwin)); EXPECT_NO_THROW(ConfigLib().getLedManagerConfig(kMorgan800cc)); + EXPECT_NO_THROW(ConfigLib().getLedManagerConfig(kBlackwolf800banw)); EXPECT_THROW( ConfigLib().getLedManagerConfig(kNonExistentPlatform), std::runtime_error); diff --git a/fboss/platform/configs/blackwolf800banw/led_manager.json b/fboss/platform/configs/blackwolf800banw/led_manager.json new file mode 100644 index 0000000000000..46bfe80a754fe --- /dev/null +++ b/fboss/platform/configs/blackwolf800banw/led_manager.json @@ -0,0 +1,108 @@ +{ + "systemLedConfig": { + "presentLedSysfsPath": "/sys/class/leds/sys_led:blue:status/brightness", + "absentLedSysfsPath": "/sys/class/leds/sys_led:amber:status/brightness" + }, + "fruTypeLedConfigs": { + "FAN": { + "presentLedSysfsPath": "/sys/class/leds/fan_led:blue:status/brightness", + "absentLedSysfsPath": "/sys/class/leds/fan_led:amber:status/brightness" + }, + "PSU": { + "presentLedSysfsPath": "/sys/class/leds/psu_led:blue:status/brightness", + "absentLedSysfsPath": "/sys/class/leds/psu_led:amber:status/brightness" + } + }, + "fruConfigs": [ + { + "fruName": "FAN1", + "fruType": "FAN", + "presenceDetection": { + "sysfsFileHandle": { + "presenceFilePath": "/run/devmap/sensors/FAN_CPLD/fan1_present", + "desiredValue": 1 + } + } + }, + { + "fruName": "FAN2", + "fruType": "FAN", + "presenceDetection": { + "sysfsFileHandle": { + "presenceFilePath": "/run/devmap/sensors/FAN_CPLD/fan2_present", + "desiredValue": 1 + } + } + }, + { + "fruName": "FAN3", + "fruType": "FAN", + "presenceDetection": { + "sysfsFileHandle": { + "presenceFilePath": "/run/devmap/sensors/FAN_CPLD/fan3_present", + "desiredValue": 1 + } + } + }, + { + "fruName": "FAN4", + "fruType": "FAN", + "presenceDetection": { + "sysfsFileHandle": { + "presenceFilePath": "/run/devmap/sensors/FAN_CPLD/fan4_present", + "desiredValue": 1 + } + } + }, + { + "fruName": "FAN5", + "fruType": "FAN", + "presenceDetection": { + "sysfsFileHandle": { + "presenceFilePath": "/run/devmap/sensors/FAN_CPLD/fan5_present", + "desiredValue": 1 + } + } + }, + { + "fruName": "PSU1", + "fruType": "PSU", + "presenceDetection": { + "sysfsFileHandle": { + "presenceFilePath": "/run/devmap/cplds/CHASSIS_CPLD/psu1_present", + "desiredValue": 1 + } + } + }, + { + "fruName": "PSU2", + "fruType": "PSU", + "presenceDetection": { + "sysfsFileHandle": { + "presenceFilePath": "/run/devmap/cplds/CHASSIS_CPLD/psu2_present", + "desiredValue": 1 + } + } + }, + { + "fruName": "PSU3", + "fruType": "PSU", + "presenceDetection": { + "sysfsFileHandle": { + "presenceFilePath": "/run/devmap/cplds/CHASSIS_CPLD/psu3_present", + "desiredValue": 1 + } + } + }, + { + "fruName": "PSU4", + "fruType": "PSU", + "presenceDetection": { + "sysfsFileHandle": { + "presenceFilePath": "/run/devmap/cplds/CHASSIS_CPLD/psu4_present", + "desiredValue": 1 + } + } + } + ] +}