blob: daee76475f14ae362a53badc4ccc827f5f19e271 [file]
#ifndef THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_CONFIGS_BLOCKLIST_PARSER_H_
#define THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_CONFIGS_BLOCKLIST_PARSER_H_
#include <cstddef>
#include <optional>
#include "absl/container/flat_hash_map.h"
#include "absl/container/flat_hash_set.h"
#include "absl/status/statusor.h"
#include "absl/strings/string_view.h"
namespace milotic_tlbmc {
using BusBlocklist =
absl::flat_hash_map<size_t, std::optional<absl::flat_hash_set<size_t>>>;
// Parses the blocklist from the json file at the path and returns a map of
// blocked buses. Optionally, addresses can be specified for each bus to be
// blocked. If no addresses are specified for a bus, the entire bus is skipped
// in I2C scan.
// Syntax of the blocklist file follows the OpenBMC implementation.
// Source:
// https://github.com/openbmc/entity-manager/blob/79b2075688eac9fabf3c2e9e2f2346ffb7a1fd2c/docs/blacklist_configuration.md
absl::StatusOr<BusBlocklist> GetBusBlocklist(absl::string_view blocklist_path);
} // namespace milotic_tlbmc
#endif // THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_CONFIGS_BLOCKLIST_PARSER_H_