gem5 v24.0.0.0
Loading...
Searching...
No Matches
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
46namespace gem5
47{
48
49namespace scmi
50{
51
52class Platform;
53struct Message;
54
69
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
110class 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,
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);
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
This protocol describes the properties of the implementation and provides generic error management.
void discoverImplVersion(Message &msg)
void version(Message &msg) override
void discoverVendor(Message &msg)
void messageAttributes(Message &msg) override
bool implementedProtocol(Commands message_id) const
void discoverListProtocols(Message &msg)
static const uint32_t PROTOCOL_VERSION
void discoverSubVendor(Message &msg)
void invalidCommand(Message &msg)
void discoverAgent(Message &msg)
BaseProtocol(Platform &_platform)
void handleMessage(Message &msg) override
const uint32_t implementationVersion
void attributes(Message &msg) override
const std::string subvendor
virtual void attributes(Message &msg)=0
const std::string name() const
static const uint32_t MAX_STRING_SIZE
Protocol(Platform &_platform)
virtual void handleMessage(Message &msg)=0
virtual void messageAttributes(Message &msg)=0
virtual void version(Message &msg)=0
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36

Generated on Tue Jun 18 2024 16:24:02 for gem5 by doxygen 1.11.0