Skip to content

Commit

Permalink
Report per PciSubDevice type failure
Browse files Browse the repository at this point in the history
Reviewed By: somasun

Differential Revision: D69815540

fbshipit-source-id: c8cb52e2016571507ddd8da8bf91f31c810d4dd2
  • Loading branch information
Justin Kim authored and facebook-github-bot committed Feb 20, 2025
1 parent d7a0766 commit 32e0d56
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 4 deletions.
27 changes: 27 additions & 0 deletions fboss/platform/platform_manager/ExplorationSummary.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ enum class ExplorationErrorType {
I2C_DEVICE_EXPLORE,
RUN_DEVMAP_SYMLINK,
PCI_DEVICE_EXPLORE,
PCI_SUB_DEVICE_CREATE_I2C_ADAPTER,
PCI_SUB_DEVICE_CREATE_SPI_MASTER,
PCI_SUB_DEVICE_CREATE_GPIO_CHIP,
PCI_SUB_DEVICE_CREATE_WATCH_DOG,
PCI_SUB_DEVICE_CREATE_FAN_CTRL,
PCI_SUB_DEVICE_CREATE_LED_CTRL,
PCI_SUB_DEVICE_CREATE_XCVR_CTRL,
PCI_SUB_DEVICE_CREATE_INFO_ROM,
PCI_SUB_DEVICE_CREATE_MISC_CTRL,
IDPROM_READ,
SLOT_PM_UNIT_ABSENCE,
SLOT_PRESENCE_CHECK,
Expand Down Expand Up @@ -46,6 +55,24 @@ constexpr const char* toExplorationErrorTypeStr(
return "run_devmap_symlink";
case ExplorationErrorType::PCI_DEVICE_EXPLORE:
return "pci_device_explore";
case ExplorationErrorType::PCI_SUB_DEVICE_CREATE_I2C_ADAPTER:
return "pci_sub_device_create_i2c_adapter";
case ExplorationErrorType::PCI_SUB_DEVICE_CREATE_SPI_MASTER:
return "pci_sub_device_create_spi_master";
case ExplorationErrorType::PCI_SUB_DEVICE_CREATE_GPIO_CHIP:
return "pci_sub_device_create_gpio_chip";
case ExplorationErrorType::PCI_SUB_DEVICE_CREATE_WATCH_DOG:
return "pci_sub_device_create_watch_dog";
case ExplorationErrorType::PCI_SUB_DEVICE_CREATE_FAN_CTRL:
return "pci_sub_device_create_fan_ctrl";
case ExplorationErrorType::PCI_SUB_DEVICE_CREATE_LED_CTRL:
return "pci_sub_device_create_led_ctrl";
case ExplorationErrorType::PCI_SUB_DEVICE_CREATE_XCVR_CTRL:
return "pci_sub_device_create_xcvr_ctrl";
case ExplorationErrorType::PCI_SUB_DEVICE_CREATE_INFO_ROM:
return "pci_sub_device_create_info_rom";
case ExplorationErrorType::PCI_SUB_DEVICE_CREATE_MISC_CTRL:
return "pci_sub_device_create_misc_ctrl";
case ExplorationErrorType::IDPROM_READ:
return "idprom_read";
case ExplorationErrorType::SLOT_PM_UNIT_ABSENCE:
Expand Down
15 changes: 11 additions & 4 deletions fboss/platform/platform_manager/PlatformExplorer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,7 @@ void PlatformExplorer::explorePciDevices(
createPciSubDevices(
slotPath,
*pciDeviceConfig.i2cAdapterConfigs(),
ExplorationErrorType::PCI_SUB_DEVICE_CREATE_I2C_ADAPTER,
[&](const auto& i2cAdapterConfig) {
auto busNums = pciExplorer_.createI2cAdapter(
pciDevice, i2cAdapterConfig, instId++);
Expand All @@ -507,6 +508,7 @@ void PlatformExplorer::explorePciDevices(
createPciSubDevices(
slotPath,
*pciDeviceConfig.spiMasterConfigs(),
ExplorationErrorType::PCI_SUB_DEVICE_CREATE_SPI_MASTER,
[&](const auto& spiMasterConfig) {
auto spiCharDevPaths = pciExplorer_.createSpiMaster(
pciDevice, spiMasterConfig, instId++);
Expand All @@ -520,6 +522,7 @@ void PlatformExplorer::explorePciDevices(
createPciSubDevices(
slotPath,
*pciDeviceConfig.gpioChipConfigs(),
ExplorationErrorType::PCI_SUB_DEVICE_CREATE_GPIO_CHIP,
[&](const auto& gpioChipConfig) {
auto gpioCharDevPath =
pciExplorer_.createGpioChip(pciDevice, gpioChipConfig, instId++);
Expand All @@ -531,6 +534,7 @@ void PlatformExplorer::explorePciDevices(
createPciSubDevices(
slotPath,
*pciDeviceConfig.watchdogConfigs(),
ExplorationErrorType::PCI_SUB_DEVICE_CREATE_WATCH_DOG,
[&](const auto& watchdogConfig) {
auto watchdogCharDevPath =
pciExplorer_.createWatchdog(pciDevice, watchdogConfig, instId++);
Expand All @@ -542,6 +546,7 @@ void PlatformExplorer::explorePciDevices(
createPciSubDevices(
slotPath,
*pciDeviceConfig.fanTachoPwmConfigs(),
ExplorationErrorType::PCI_SUB_DEVICE_CREATE_FAN_CTRL,
[&](const auto& fanPwmCtrlConfig) {
auto fanCtrlSysfsPath = pciExplorer_.createFanPwmCtrl(
pciDevice, fanPwmCtrlConfig, instId++);
Expand All @@ -554,12 +559,14 @@ void PlatformExplorer::explorePciDevices(
createPciSubDevices(
slotPath,
*pciDeviceConfig.ledCtrlConfigs(),
ExplorationErrorType::PCI_SUB_DEVICE_CREATE_LED_CTRL,
[&](const auto& ledCtrlConfig) {
pciExplorer_.createLedCtrl(pciDevice, ledCtrlConfig, instId++);
});
createPciSubDevices(
slotPath,
*pciDeviceConfig.xcvrCtrlConfigs(),
ExplorationErrorType::PCI_SUB_DEVICE_CREATE_XCVR_CTRL,
[&](const auto& xcvrCtrlConfig) {
auto devicePath = Utils().createDevicePath(
slotPath,
Expand All @@ -571,6 +578,7 @@ void PlatformExplorer::explorePciDevices(
createPciSubDevices(
slotPath,
*pciDeviceConfig.infoRomConfigs(),
ExplorationErrorType::PCI_SUB_DEVICE_CREATE_INFO_ROM,
[&](const auto& infoRomConfig) {
auto infoRomSysfsPath =
pciExplorer_.createInfoRom(pciDevice, infoRomConfig, instId++);
Expand All @@ -582,6 +590,7 @@ void PlatformExplorer::explorePciDevices(
createPciSubDevices(
slotPath,
*pciDeviceConfig.miscCtrlConfigs(),
ExplorationErrorType::PCI_SUB_DEVICE_CREATE_MISC_CTRL,
[&](const auto& miscCtrlConfig) {
pciExplorer_.createFpgaIpBlock(pciDevice, miscCtrlConfig, instId++);
});
Expand Down Expand Up @@ -776,6 +785,7 @@ template <typename T>
void PlatformExplorer::createPciSubDevices(
const std::string& slotPath,
const std::vector<T>& pciSubDeviceConfigs,
ExplorationErrorType errorType,
auto&& deviceCreationLambda) {
for (const auto& pciSubDeviceConfig : pciSubDeviceConfigs) {
try {
Expand All @@ -788,10 +798,7 @@ void PlatformExplorer::createPciSubDevices(
ex.what());
XLOG(ERR) << errMsg;
explorationSummary_.addError(
ExplorationErrorType::PCI_DEVICE_EXPLORE,
slotPath,
ex.getPmUnitScopedName(),
errMsg);
errorType, slotPath, ex.getPmUnitScopedName(), errMsg);
}
}
}
Expand Down
1 change: 1 addition & 0 deletions fboss/platform/platform_manager/PlatformExplorer.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ class PlatformExplorer {
void createPciSubDevices(
const std::string& slotPath,
const std::vector<T>& pciSubDeviceConfigs,
ExplorationErrorType errorType,
auto&& deviceCreationLambda);

PlatformConfig platformConfig_{};
Expand Down

0 comments on commit 32e0d56

Please sign in to comment.