blob: 406240862e37a8777e4d258eec0a30548e8c0c8a [file] [log] [blame] [edit]
#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_