/** * Copyright © 2021 IBM Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once #include "../zone.hpp" #include "action.hpp" #include "group.hpp" #include "utils/pcie_card_metadata.hpp" #include namespace phosphor::fan::control::json { using json = nlohmann::json; class Manager; /** * @class PCIeCardFloors - Action to set the PCIe card floor index parameter * based on the PCIe cards plugged in the system. * * - Loads PCIe card metadata files using the PCIeCardMetadata class. * - Watches for PCIe slots to be powered on (or off). * - Reads four properties off of the PCIeDevice interface on the powered * on cards. * - Looks up the floor index for the card by calling PCIeCardMetadata::lookup * and passing in the PCIeDevice properties. * - Sets the pcie_floor_index parameter with the highest floor index found. * - If no PCIe cards are found, it removes the parameter. * - If a card isn't recognized, it's ignored since it isn't considered a * hot card. * - If a powered on card has its own temperature sensor, then it doesn't * have a floor index. * - Since the slot powered on indications are all sent at once, it has a * small delay that gets started in each run() call that must expire * before the body of the action is run, so it only runs once. * * The JSON configuration has two entries: * { * "settle_time":