gem5  [DEVELOP-FOR-23.0]
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
scmi_protocols.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 ARM Limited
3  * All rights reserved
4  *
5  * The license below extends only to copyright in the software and shall
6  * not be construed as granting a license to any other intellectual
7  * property including but not limited to intellectual property relating
8  * to a hardware implementation of the functionality of the software
9  * licensed hereunder. You may use the software subject to the license
10  * terms below provided that you ensure that this notice is replicated
11  * unmodified and in its entirety in all distributions of the software,
12  * modified or unmodified, in source code or in binary form.
13  *
14  * Redistribution and use in source and binary forms, with or without
15  * modification, are permitted provided that the following conditions are
16  * met: redistributions of source code must retain the above copyright
17  * notice, this list of conditions and the following disclaimer;
18  * redistributions in binary form must reproduce the above copyright
19  * notice, this list of conditions and the following disclaimer in the
20  * documentation and/or other materials provided with the distribution;
21  * neither the name of the copyright holders nor the names of its
22  * contributors may be used to endorse or promote products derived from
23  * this software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  */
37 
38 #ifndef __DEV_ARM_CSS_SCMI_PROTOCOLS_H__
39 #define __DEV_ARM_CSS_SCMI_PROTOCOLS_H__
40 
41 #include <cstdint>
42 #include <string>
43 
44 #include "base/compiler.hh"
45 
46 namespace gem5
47 {
48 
49 namespace scmi
50 {
51 
52 class Platform;
53 struct Message;
54 
56 {
57  SUCCESS = 0,
60  DENIED = -3,
61  NOT_FOUND = -4,
63  BUSY = -6,
68 };
69 
70 class Protocol
71 {
72  public:
73  // All agent-platform communications in the SCMI protocol
74  // are using 15 as a maximum string size, considering the
75  // 16th byte is used for the NULL terminator
76  static const uint32_t MAX_STRING_SIZE = 15;
77 
78  Protocol(Platform &_platform)
79  : platform(_platform)
80  {}
81 
82  virtual ~Protocol() {}
83 
84  virtual void handleMessage(Message &msg) = 0;
85 
86  virtual void version(Message &msg) = 0;
87 
88  virtual void attributes(Message &msg) = 0;
89 
90  virtual void messageAttributes(Message &msg) = 0;
91 
92  const std::string name() const;
93 
94  protected:
96 };
97 
110 class BaseProtocol : public Protocol
111 {
112  static const uint32_t PROTOCOL_VERSION = 0x10000;
113 
114  public:
115  explicit BaseProtocol(Platform &_platform);
116 
117  enum class Commands
118  {
119  VERSION = 0x0,
120  ATTRIBUTES = 0x1,
121  MESSAGE_ATTRIBUTES = 0x2,
122  DISCOVER_VENDOR = 0x3,
123  DISCOVER_SUB_VENDOR = 0x4,
126  DISCOVER_AGENT = 0x7,
127  NOTIFY_ERRORS = 0x8,
131  };
132 
133  // Commands
134  void handleMessage(Message &msg) override;
135  void version(Message &msg) override;
136  void attributes(Message &msg) override;
137  void messageAttributes(Message &msg) override;
138  void discoverVendor(Message &msg);
139  void discoverSubVendor(Message &msg);
140  void discoverImplVersion(Message &msg);
141  void discoverListProtocols(Message &msg);
142  void discoverAgent(Message &msg);
143 
144  // Invalid Command
145  void invalidCommand(Message &msg);
146 
147  protected:
148  bool implementedProtocol(Commands message_id) const;
149 
150  const std::string vendor;
151  const std::string subvendor;
152  const uint32_t implementationVersion;
153 
154 };
155 
156 } // namespace scmi
157 } // namespace gem5
158 
159 #endif
gem5::scmi::BaseProtocol::Commands::SET_DEVICE_PERMISSIONS
@ SET_DEVICE_PERMISSIONS
gem5::scmi::Platform
Definition: scmi_platform.hh:264
gem5::auxv::Platform
@ Platform
Definition: aux_vector.hh:82
gem5::scmi::Protocol
Definition: scmi_protocols.hh:70
gem5::scmi::BaseProtocol::Commands::SET_PROTOCOL_PERMISSIONS
@ SET_PROTOCOL_PERMISSIONS
gem5::scmi::BUSY
@ BUSY
Definition: scmi_protocols.hh:63
gem5::scmi::BaseProtocol::Commands::ATTRIBUTES
@ ATTRIBUTES
gem5::scmi::BaseProtocol::Commands::DISCOVER_IMPLEMENTATION_VERSION
@ DISCOVER_IMPLEMENTATION_VERSION
gem5::scmi::Protocol::name
const std::string name() const
Definition: scmi_protocols.cc:49
gem5::scmi::BaseProtocol::BaseProtocol
BaseProtocol(Platform &_platform)
Definition: scmi_protocols.cc:54
gem5::scmi::BaseProtocol::vendor
const std::string vendor
Definition: scmi_protocols.hh:150
gem5::scmi::Protocol::platform
Platform & platform
Definition: scmi_protocols.hh:95
gem5::scmi::Protocol::handleMessage
virtual void handleMessage(Message &msg)=0
gem5::scmi::Protocol::MAX_STRING_SIZE
static const uint32_t MAX_STRING_SIZE
Definition: scmi_protocols.hh:76
gem5::scmi::BaseProtocol::Commands::DISCOVER_VENDOR
@ DISCOVER_VENDOR
gem5::scmi::BaseProtocol::discoverAgent
void discoverAgent(Message &msg)
Definition: scmi_protocols.cc:247
gem5::scmi::BaseProtocol::Commands::DISCOVER_LIST_PROTOCOLS
@ DISCOVER_LIST_PROTOCOLS
gem5::scmi::Protocol::Protocol
Protocol(Platform &_platform)
Definition: scmi_protocols.hh:78
gem5::scmi::Protocol::version
virtual void version(Message &msg)=0
gem5::scmi::NOT_FOUND
@ NOT_FOUND
Definition: scmi_protocols.hh:61
gem5::scmi::BaseProtocol
This protocol describes the properties of the implementation and provides generic error management.
Definition: scmi_protocols.hh:110
gem5::scmi::HARDWARE_ERROR
@ HARDWARE_ERROR
Definition: scmi_protocols.hh:66
gem5::scmi::BaseProtocol::Commands::DISCOVER_SUB_VENDOR
@ DISCOVER_SUB_VENDOR
gem5::scmi::Protocol::~Protocol
virtual ~Protocol()
Definition: scmi_protocols.hh:82
gem5::scmi::BaseProtocol::discoverImplVersion
void discoverImplVersion(Message &msg)
Definition: scmi_protocols.cc:202
gem5::scmi::NOT_SUPPORTED
@ NOT_SUPPORTED
Definition: scmi_protocols.hh:58
gem5::scmi::BaseProtocol::subvendor
const std::string subvendor
Definition: scmi_protocols.hh:151
gem5::scmi::BaseProtocol::discoverSubVendor
void discoverSubVendor(Message &msg)
Definition: scmi_protocols.cc:189
gem5::scmi::BaseProtocol::Commands::NOTIFY_ERRORS
@ NOTIFY_ERRORS
gem5::scmi::GENERIC_ERROR
@ GENERIC_ERROR
Definition: scmi_protocols.hh:65
gem5::scmi::BaseProtocol::invalidCommand
void invalidCommand(Message &msg)
Definition: scmi_protocols.cc:280
gem5::scmi::BaseProtocol::implementationVersion
const uint32_t implementationVersion
Definition: scmi_protocols.hh:152
gem5::scmi::BaseProtocol::messageAttributes
void messageAttributes(Message &msg) override
Definition: scmi_protocols.cc:156
compiler.hh
gem5::scmi::DENIED
@ DENIED
Definition: scmi_protocols.hh:60
gem5::scmi::BaseProtocol::PROTOCOL_VERSION
static const uint32_t PROTOCOL_VERSION
Definition: scmi_protocols.hh:112
gem5::scmi::BaseProtocol::discoverListProtocols
void discoverListProtocols(Message &msg)
Definition: scmi_protocols.cc:213
gem5::scmi::Protocol::messageAttributes
virtual void messageAttributes(Message &msg)=0
gem5::scmi::BaseProtocol::handleMessage
void handleMessage(Message &msg) override
Definition: scmi_protocols.cc:67
gem5::scmi::BaseProtocol::implementedProtocol
bool implementedProtocol(Commands message_id) const
Definition: scmi_protocols.cc:138
gem5::scmi::SUCCESS
@ SUCCESS
Definition: scmi_protocols.hh:57
gem5::scmi::StatusCode
StatusCode
Definition: scmi_protocols.hh:55
gem5::scmi::INVALID_PARAMETERS
@ INVALID_PARAMETERS
Definition: scmi_protocols.hh:59
gem5::scmi::COMMS_ERROR
@ COMMS_ERROR
Definition: scmi_protocols.hh:64
gem5::scmi::BaseProtocol::attributes
void attributes(Message &msg) override
Definition: scmi_protocols.cc:122
gem5::scmi::BaseProtocol::Commands::RESET_AGENT_CONFIGURATION
@ RESET_AGENT_CONFIGURATION
gem5::scmi::BaseProtocol::Commands::VERSION
@ VERSION
gem5::scmi::BaseProtocol::discoverVendor
void discoverVendor(Message &msg)
Definition: scmi_protocols.cc:176
gem5::scmi::PROTOCOL_ERROR
@ PROTOCOL_ERROR
Definition: scmi_protocols.hh:67
gem5::scmi::BaseProtocol::version
void version(Message &msg) override
Definition: scmi_protocols.cc:111
gem5::scmi::BaseProtocol::Commands::DISCOVER_AGENT
@ DISCOVER_AGENT
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: gpu_translation_state.hh:37
gem5::scmi::BaseProtocol::Commands
Commands
Definition: scmi_protocols.hh:117
gem5::scmi::Protocol::attributes
virtual void attributes(Message &msg)=0
gem5::scmi::Message
Definition: scmi_platform.hh:157
gem5::scmi::OUT_OF_RANGE
@ OUT_OF_RANGE
Definition: scmi_protocols.hh:62
gem5::scmi::BaseProtocol::Commands::MESSAGE_ATTRIBUTES
@ MESSAGE_ATTRIBUTES

Generated on Sun Jul 30 2023 01:56:54 for gem5 by doxygen 1.8.17