geopm  3.1.1.dev296+g5916b956
GEOPM - Global Extensible Open Power Manager
SSTControl.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 - 2024 Intel Corporation
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 
6 #ifndef SSTCONTROL_HPP_INCLUDE
7 #define SSTCONTROL_HPP_INCLUDE
8 
9 #include <memory>
10 
11 #include "Control.hpp"
12 
13 namespace geopm
14 {
15  class SSTIO;
16 
19  class SSTControl : public geopm::Control
20  {
21  public:
23  {
24  M_MBOX, // SST Mailbox interface
25  M_MMIO // SST MMIO interface
26  };
27 
50  SSTControl(std::shared_ptr<SSTIO> sstio, ControlType control_type,
51  int cpu_idx, uint32_t command, uint32_t subcommand,
52  uint32_t interface_parameter, uint32_t write_value, uint32_t begin_bit,
53  uint32_t end_bit, double scale, uint32_t rmw_subcommand,
54  uint32_t rmw_interface_parameter, uint32_t rmw_read_mask);
55  virtual ~SSTControl() = default;
56  void setup_batch(void) override;
57  void adjust(double value) override;
58  void write(double value) override;
59  void save(void) override;
60  void restore(void) override;
61  void set_write_dependency(uint64_t trigger_value, std::weak_ptr<geopm::Control> dependency, uint64_t dependency_write_value);
62 
63  private:
64  std::shared_ptr<SSTIO> m_sstio;
65  const ControlType m_control_type;
66  const int m_cpu_idx;
67  const uint32_t m_command;
68  const uint32_t m_subcommand;
69  const uint32_t m_interface_parameter;
70  const uint32_t m_write_value;
71  int m_adjust_idx;
72  const int m_shift;
73  const int m_num_bit;
74  const uint64_t m_mask;
75  const uint32_t m_rmw_subcommand;
76  const uint32_t m_rmw_interface_parameter;
77  const uint32_t m_rmw_read_mask;
78  const double m_multiplier;
79  uint32_t m_saved_value;
80 
81  uint64_t m_trigger_write_value;
82  std::weak_ptr<geopm::Control> m_dependency;
83  uint64_t m_dependency_write_value;
84  };
85 }
86 
87 #endif
Definition: Control.hpp:16
Definition: SSTControl.hpp:20
void save(void) override
Store the current setting of the control for use by a future call to restore().
Definition: SSTControl.cpp:80
virtual ~SSTControl()=default
void adjust(double value) override
Store values to be written by the owner's write_batch step.
Definition: SSTControl.cpp:54
void write(double value) override
Write the value of the control without affecting any pushed batch controls.
Definition: SSTControl.cpp:61
void restore(void) override
Restore the setting stored by save().
Definition: SSTControl.cpp:98
void setup_batch(void) override
Prepare the control for being written through side effects by the owner's write_batch step....
Definition: SSTControl.cpp:41
ControlType
Definition: SSTControl.hpp:23
@ M_MBOX
Definition: SSTControl.hpp:24
@ M_MMIO
Definition: SSTControl.hpp:25
void set_write_dependency(uint64_t trigger_value, std::weak_ptr< geopm::Control > dependency, uint64_t dependency_write_value)
Definition: SSTControl.cpp:117
SSTControl(std::shared_ptr< SSTIO > sstio, ControlType control_type, int cpu_idx, uint32_t command, uint32_t subcommand, uint32_t interface_parameter, uint32_t write_value, uint32_t begin_bit, uint32_t end_bit, double scale, uint32_t rmw_subcommand, uint32_t rmw_interface_parameter, uint32_t rmw_read_mask)
Create an SSTIO Control.
Definition: SSTControl.cpp:12
Definition: Agg.cpp:20