gem5  v21.1.0.2
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 GEM5_DEPRECATED_NAMESPACE(SCMI, scmi);
50 namespace scmi
51 {
52 
53 class Platform;
54 struct Message;
55 
57 {
58  SUCCESS = 0,
61  DENIED = -3,
62  NOT_FOUND = -4,
64  BUSY = -6,
69 };
70 
71 class Protocol
72 {
73  public:
74  // All agent-platform communications in the SCMI protocol
75  // are using 15 as a maximum string size, considering the
76  // 16th byte is used for the NULL terminator
77  static const uint32_t MAX_STRING_SIZE = 15;
78 
79  Protocol(Platform &_platform)
80  : platform(_platform)
81  {}
82 
83  virtual ~Protocol() {}
84 
85  virtual void handleMessage(Message &msg) = 0;
86 
87  virtual void version(Message &msg) = 0;
88 
89  virtual void attributes(Message &msg) = 0;
90 
91  virtual void messageAttributes(Message &msg) = 0;
92 
93  const std::string name() const;
94 
95  protected:
97 };
98 
111 class BaseProtocol : public Protocol
112 {
113  static const uint32_t PROTOCOL_VERSION = 0x10000;
114 
115  public:
116  explicit BaseProtocol(Platform &_platform);
117 
118  enum class Commands
119  {
120  VERSION = 0x0,
121  ATTRIBUTES = 0x1,
122  MESSAGE_ATTRIBUTES = 0x2,
123  DISCOVER_VENDOR = 0x3,
124  DISCOVER_SUB_VENDOR = 0x4,
127  DISCOVER_AGENT = 0x7,
128  NOTIFY_ERRORS = 0x8,
132  };
133 
134  // Commands
135  void handleMessage(Message &msg) override;
136  void version(Message &msg) override;
137  void attributes(Message &msg) override;
138  void messageAttributes(Message &msg) override;
139  void discoverVendor(Message &msg);
140  void discoverSubVendor(Message &msg);
141  void discoverImplVersion(Message &msg);
142  void discoverListProtocols(Message &msg);
143  void discoverAgent(Message &msg);
144 
145  // Invalid Command
146  void invalidCommand(Message &msg);
147 
148  protected:
149  bool implementedProtocol(Commands message_id) const;
150 
151  const std::string vendor;
152  const std::string subvendor;
153  const uint32_t implementationVersion;
154 
155 };
156 
157 } // namespace scmi
158 } // namespace gem5
159 
160 #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:84
gem5::scmi::Protocol
Definition: scmi_protocols.hh:71
gem5::scmi::BaseProtocol::Commands::SET_PROTOCOL_PERMISSIONS
@ SET_PROTOCOL_PERMISSIONS
gem5::scmi::BUSY
@ BUSY
Definition: scmi_protocols.hh:64
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:151
gem5::scmi::Protocol::platform
Platform & platform
Definition: scmi_protocols.hh:96
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:77
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:79
gem5::scmi::Protocol::version
virtual void version(Message &msg)=0
gem5::scmi::NOT_FOUND
@ NOT_FOUND
Definition: scmi_protocols.hh:62
gem5::scmi::BaseProtocol
This protocol describes the properties of the implementation and provides generic error management.
Definition: scmi_protocols.hh:111
gem5::scmi::HARDWARE_ERROR
@ HARDWARE_ERROR
Definition: scmi_protocols.hh:67
gem5::scmi::BaseProtocol::Commands::DISCOVER_SUB_VENDOR
@ DISCOVER_SUB_VENDOR
gem5::scmi::Protocol::~Protocol
virtual ~Protocol()
Definition: scmi_protocols.hh:83
gem5::scmi::BaseProtocol::discoverImplVersion
void discoverImplVersion(Message &msg)
Definition: scmi_protocols.cc:202
gem5::scmi::NOT_SUPPORTED
@ NOT_SUPPORTED
Definition: scmi_protocols.hh:59
gem5::scmi::BaseProtocol::subvendor
const std::string subvendor
Definition: scmi_protocols.hh:152
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:66
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:153
gem5::scmi::BaseProtocol::messageAttributes
void messageAttributes(Message &msg) override
Definition: scmi_protocols.cc:156
compiler.hh
gem5::scmi::DENIED
@ DENIED
Definition: scmi_protocols.hh:61
gem5::scmi::BaseProtocol::PROTOCOL_VERSION
static const uint32_t PROTOCOL_VERSION
Definition: scmi_protocols.hh:113
gem5::scmi::BaseProtocol::discoverListProtocols
void discoverListProtocols(Message &msg)
Definition: scmi_protocols.cc:213
gem5::GEM5_DEPRECATED_NAMESPACE
GEM5_DEPRECATED_NAMESPACE(GuestABI, guest_abi)
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:58
gem5::scmi::StatusCode
StatusCode
Definition: scmi_protocols.hh:56
gem5::scmi::INVALID_PARAMETERS
@ INVALID_PARAMETERS
Definition: scmi_protocols.hh:60
gem5::scmi::COMMS_ERROR
@ COMMS_ERROR
Definition: scmi_protocols.hh:65
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:68
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: decoder.cc:40
gem5::scmi::BaseProtocol::Commands
Commands
Definition: scmi_protocols.hh:118
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:63
gem5::scmi::BaseProtocol::Commands::MESSAGE_ATTRIBUTES
@ MESSAGE_ATTRIBUTES

Generated on Tue Sep 21 2021 12:25:09 for gem5 by doxygen 1.8.17