geopm  3.1.1.dev296+g5916b956
GEOPM - Global Extensible Open Power Manager
SSTIO.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 SSTIO_HPP_INCLUDE
7 #define SSTIO_HPP_INCLUDE
8 
9 #include <cstdint>
10 
11 #include <vector>
12 #include <memory>
13 
14 namespace geopm
15 {
16  class SSTIO
17  {
18  public:
19  SSTIO() = default;
20  virtual ~SSTIO() = default;
21 
29  virtual int add_mbox_read(uint32_t cpu_index, uint16_t command,
30  uint16_t subcommand, uint32_t subcommand_arg) = 0;
31 
44  virtual int add_mbox_write(uint32_t cpu_index, uint16_t command,
45  uint16_t subcommand, uint32_t interface_parameter,
46  uint16_t read_subcommand,
47  uint32_t read_interface_parameter,
48  uint32_t read_mask) = 0;
49 
54  virtual int add_mmio_read(uint32_t cpu_index, uint16_t register_offset) = 0;
55 
64  virtual int add_mmio_write(uint32_t cpu_index, uint16_t register_offset,
65  uint32_t register_value,
66  uint32_t read_mask) = 0;
67 
69  virtual void read_batch(void) = 0;
70 
74  virtual uint64_t sample(int batch_idx) const = 0;
75 
77  virtual void write_batch(void) = 0;
78 
86  virtual uint32_t read_mbox_once(uint32_t cpu_index, uint16_t command,
87  uint16_t subcommand, uint32_t subcommand_arg) = 0;
88 
103  virtual void write_mbox_once(uint32_t cpu_index, uint16_t command,
104  uint16_t subcommand,
105  uint32_t interface_parameter,
106  uint16_t read_subcommand,
107  uint32_t read_interface_parameter,
108  uint32_t read_mask, uint64_t write_value,
109  uint64_t write_mask) = 0;
110 
115  virtual uint32_t read_mmio_once(uint32_t cpu_index, uint16_t register_offset) = 0;
116 
127  virtual void write_mmio_once(uint32_t cpu_index, uint16_t register_offset,
128  uint32_t register_value,
129  uint32_t read_mask, uint64_t write_value,
130  uint64_t write_mask) = 0;
131 
136  virtual void adjust(int batch_idx, uint64_t write_value, uint64_t write_mask) = 0;
137 
140  virtual uint32_t get_punit_from_cpu(uint32_t cpu_index) = 0;
141 
145  static std::shared_ptr<SSTIO> make_shared(uint32_t max_cpus);
146  };
147 
148 }
149 
150 #endif
Definition: SSTIO.hpp:17
virtual uint32_t read_mmio_once(uint32_t cpu_index, uint16_t register_offset)=0
Immediately read a value from the SST MMIO interface.
virtual int add_mbox_write(uint32_t cpu_index, uint16_t command, uint16_t subcommand, uint32_t interface_parameter, uint16_t read_subcommand, uint32_t read_interface_parameter, uint32_t read_mask)=0
Interact with the mailbox on commands that are not expected to return data.
virtual uint64_t sample(int batch_idx) const =0
Sample a value from the most recent batch read.
virtual ~SSTIO()=default
virtual int add_mmio_write(uint32_t cpu_index, uint16_t register_offset, uint32_t register_value, uint32_t read_mask)=0
Interact with the mmio interface on commands that are not expected to return data.
virtual void write_batch(void)=0
Issue a batch write.
virtual uint32_t read_mbox_once(uint32_t cpu_index, uint16_t command, uint16_t subcommand, uint32_t subcommand_arg)=0
Immediately query the SST mailbox for a read operation.
virtual void write_mmio_once(uint32_t cpu_index, uint16_t register_offset, uint32_t register_value, uint32_t read_mask, uint64_t write_value, uint64_t write_mask)=0
Immediately write a value to the SST MMIO interface.
virtual int add_mbox_read(uint32_t cpu_index, uint16_t command, uint16_t subcommand, uint32_t subcommand_arg)=0
Interact with the mailbox on commands that are expected to return data.
virtual void write_mbox_once(uint32_t cpu_index, uint16_t command, uint16_t subcommand, uint32_t interface_parameter, uint16_t read_subcommand, uint32_t read_interface_parameter, uint32_t read_mask, uint64_t write_value, uint64_t write_mask)=0
Immediately query the SST mailbox for a write operation.
SSTIO()=default
static std::shared_ptr< SSTIO > make_shared(uint32_t max_cpus)
Create an SSTIO object.
Definition: SSTIO.cpp:21
virtual int add_mmio_read(uint32_t cpu_index, uint16_t register_offset)=0
Interact with the mmio interface on commands that are expected to return data.
virtual uint32_t get_punit_from_cpu(uint32_t cpu_index)=0
Get the punit index associated with a CPU index.
virtual void read_batch(void)=0
Issue a batch read.
virtual void adjust(int batch_idx, uint64_t write_value, uint64_t write_mask)=0
Adjust a value for the next batch write.
Definition: Agg.cpp:20