blob: e58cff471f328b3b55c4372231b70f47e87bafd3 [file]
#ifndef THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_HAL_SYSTEM_REGISTRY_H_
#define THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_HAL_SYSTEM_REGISTRY_H_
#include <cstdint>
#include <string>
#include <string_view>
#include "gbmc_settings/bios_settings.pb.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
// This class will store all of the registries that the system is exposed to via
// the HAL. The goal of this registry is to instantiate all of the HAL startup
// logic exactly once and have one interface into the HAL registries.
// Currently, there may need to be multiple owners here due to tlBMC URLs and
// non-tLBMC URLs both needing to access the same registry, but the eventual end
// goal is to only have tlBMC store own the registry.
namespace milotic_tlbmc {
class SystemRegistry {
public:
virtual ~SystemRegistry() = default;
virtual absl::StatusOr<uint32_t> GetCoreCount(
std::string_view redfish_system_id) = 0;
virtual absl::Status SetCoreCount(std::string_view redfish_system_id,
uint32_t core_count) = 0;
virtual absl::Status SetInitialCoreCounts() = 0;
// Retrieves the Base64 encoded IFS pattern for the given redfish system id.
//
// Expected Inputs:
// redfish_system_id: The redfish system id, e.g. "system" or "system1"
//
// Expected Outputs:
// Success: The Base64 encoded pattern string ("" if not yet set)
// Failure: kInvalidArgument if the system id is invalid, or kInternal
// if filesystem operations fail.
virtual absl::StatusOr<std::string> GetBase64EncodedIfsPattern(
std::string_view redfish_system_id) = 0;
virtual absl::Status SetIfsPattern(std::string_view redfish_system_id,
std::string_view base64_ifs_pattern) = 0;
virtual absl::Status ResetIfsPattern(std::string_view redfish_system_id) = 0;
/**
* @brief Retrieves the BootNext setting for a given Redfish system ID.
* @param redfish_system_id The Redfish system ID, e.g. "system" or "system1"
* @return The BootNext value as a string, or an error status (e.g.
* kNotFound).
*/
virtual absl::StatusOr<std::string> GetBootNext(
std::string_view redfish_system_id) = 0;
/**
* @brief Sets the BootNext setting for a given Redfish system ID.
* @param redfish_system_id The Redfish system ID, e.g. "system" or "system1"
* @param boot_next The boot option string to set as BootNext.
* @return absl::OkStatus() on success, or an error status on failure.
*/
virtual absl::Status SetBootNext(std::string_view redfish_system_id,
std::string_view boot_next) = 0;
/**
* @brief Retrieves the BootSourceOverrideTarget setting for a given Redfish
* system ID.
* @param redfish_system_id The Redfish system ID, e.g. "system" or "system1"
* @return The BootSourceOverrideTarget value as an enum, or an error status
* (e.g. kNotFound).
*/
virtual absl::StatusOr<::gbmc::settings::BootSourceOverrideTarget>
GetBootSourceOverrideTarget(std::string_view redfish_system_id) = 0;
/**
* @brief Sets the BootSourceOverrideTarget setting for a given Redfish system
* ID.
* @param redfish_system_id The Redfish system ID, e.g. "system" or "system1"
* @param boot_source_override_target The boot source override target to set.
* @return absl::OkStatus() on success, or an error status on failure.
*/
virtual absl::Status SetBootSourceOverrideTarget(
std::string_view redfish_system_id,
::gbmc::settings::BootSourceOverrideTarget
boot_source_override_target) = 0;
/**
* @brief Retrieves the Memory Capacity (in GiB) for a given Redfish system
* ID.
* @param redfish_system_id The Redfish system ID, e.g. "system" or "system1"
* @return The memory capacity in GiB (0 if unset), or an error status.
*/
virtual absl::StatusOr<uint32_t> GetMemoryCapacityGib(
std::string_view redfish_system_id) = 0;
/**
* @brief Sets the Memory Capacity (in GiB) for a given Redfish system ID.
* @param redfish_system_id The Redfish system ID, e.g. "system" or "system1"
* @param capacity_gib The target memory capacity in GiB.
* @return absl::OkStatus() on success, or an error status on failure.
*/
virtual absl::Status SetMemoryCapacityGib(std::string_view redfish_system_id,
uint32_t capacity_gib) = 0;
};
} // namespace milotic_tlbmc
#endif // THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_HAL_SYSTEM_REGISTRY_H_