summaryrefslogtreecommitdiff
path: root/DynamicTablesPkg/Include/RiscVNameSpaceObjects.h
blob: 0685dba1c4cc85bc815e3b4c863fc6c6dc19dac7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
/** @file

  Copyright (c) 2024, Ventana Micro Systems Inc. All rights reserved.<BR>

  SPDX-License-Identifier: BSD-2-Clause-Patent

  @par Glossary:
    - Cm or CM   - Configuration Manager
    - Obj or OBJ - Object
    - Std or STD - Standard
**/

#pragma once

#include <AcpiObjects.h>
#include <StandardNameSpaceObjects.h>

#define MAX_ISA_STRING_LENGTH  1024
#define RISCV_HWID_LENGTH      8

#pragma pack(1)

/** The ERISCV_OBJECT_ID enum describes the Object IDs
    in the RISCV Namespace

  Note: Whenever an entry in this enum is updated,
        the following data structures must also be
        updated:
        - CM_OBJECT_TOKEN_FIXER TokenFixer[] in
          Library\Common\DynamicPlatRepoLib\CmObjectTokenFixer.c
*/
typedef enum RiscVObjectID {
  ERiscVObjReserved,                                             ///< 0 - Reserved
  ERiscVObjRintcInfo,                                            ///< 1 - RISC-V RINTC Info
  ERiscVObjImsicInfo,                                            ///< 2 - RISC-V IMSIC Info
  ERiscVObjAplicInfo,                                            ///< 3 - RISC-V APLIC Frame Info
  ERiscVObjPlicInfo,                                             ///< 4 - RISC-V PLIC Info
  ERiscVObjIsaStringInfo,                                        ///< 5 - RISC-V ISA String Info
  ERiscVObjCmoInfo,                                              ///< 6 - RISC-V CMO Info
  ERiscVObjMmuInfo,                                              ///< 7 - RISC-V MMU Type Info
  ERiscVObjTimerInfo,                                            ///< 8 - RISC-V Timer Type Info
  ERiscVObjProcessorSpecificBlockInfo,                           ///< 9 - RISC-V Processor Specific Block Info
  ERiscVObjMax
} ERISCV_OBJECT_ID;

/** A structure that describes the
    RINTC for the Platform.

    ID: ERiscVObjRintcInfo
*/
typedef struct CmRiscVRintcInfo {
  /// Version
  UINT8              Version;

  /** The flags field as described by the RINTC structure
      in the ACPI Specification.
  */
  UINT32             Flags;

  /// Hart ID
  UINT64             HartId;

  /** The ACPI Processor UID. This must match the
      _UID of the CPU Device object information described
      in the DSDT/SSDT for the CPU.
  */
  UINT32             AcpiProcessorUid;

  /// External Interrupt Controller ID
  UINT32             ExtIntcId;

  /// IMSIC Base address
  UINT64             ImsicBaseAddress;

  /// IMSIC Size
  UINT32             ImsicSize;

  /** The proximity domain to which the logical processor belongs.
      This field is used to populate the RINTC affinity structure
      in the SRAT table.
  */
  UINT32             ProximityDomain;

  /** The clock domain to which the logical processor belongs.
      This field is used to populate the RINTC affinity structure
      in the SRAT table.
  */
  UINT32             ClockDomain;

  /** The RINTC Affinity flags field as described by the RINTC Affinity structure
      in the SRAT table.
  */
  UINT32             AffinityFlags;

  /// Reference Token for the CMO info of this processor.
  CM_OBJECT_TOKEN    CmoInfoToken;

  /// Reference Token for the ISA String info of this processor.
  CM_OBJECT_TOKEN    IsaStringInfoToken;

  /// Reference Token for the MMU info of this processor.
  CM_OBJECT_TOKEN    MmuInfoToken;

  /// Reference Token for the CPC info of this processor.
  CM_OBJECT_TOKEN    CpcToken;

  /** Optional field: Reference Token to the ProximityDomain this object
      belongs to. If set to CM_NULL_TOKEN, the following field is used:
        CM_RISCV_RINTC_INFO.ProximityDomain
  */
  CM_OBJECT_TOKEN    ProximityDomainToken;

  /** Optional field: Reference Token to the ClockDomain this object belongs to.
      If set to CM_NULL_TOKEN, the following field is used:
        CM_RISCV_RINTC_INFO.ClockDomain
  */
  CM_OBJECT_TOKEN    ClockDomainToken;
} CM_RISCV_RINTC_INFO;

/** A structure that describes the
    IMSIC information for the Platform.

    ID: ERiscVObjImsicInfo
*/
typedef struct CmRiscVImsicInfo {
  /// Version
  UINT8     Version;

  /** The flags field as described by the IMSIC structure
      in the ACPI Specification.
  */
  UINT32    Flags;

  /// Number of S-mode Interrupt Identities
  UINT16    NumIds;

  /// Number of guest mode Interrupt Identities
  UINT16    NumGuestIds;

  /// Guest Index Bits
  UINT8     GuestIndexBits;

  /// Hart Index Bits
  UINT8     HartIndexBits;

  /// Group Index Bits
  UINT8     GroupIndexBits;

  /// Group Index Shift
  UINT8     GroupIndexShift;
} CM_RISCV_IMSIC_INFO;

typedef struct CmRiscVPlicAplicCommonInfo {
  /// Version
  UINT8     Version;

  /// PLIC/APLIC ID
  UINT8     Id;

  /// Number of Interrupt Sources
  UINT16    NumSources;

  /** The flags field as described by the PLIC/APLIC structure
      in the ACPI Specification.
  */
  UINT32    Flags;

  /// Hardware ID
  UINT64    Hid;

  /// Base address
  UINT64    BaseAddress;

  /// Size
  UINT32    Size;

  /// GSI Base
  UINT32    GsiBase;
} PLIC_APLIC_COMMON_INFO;

/** A structure that describes the
    APLIC information for the Platform.

    ID: ERiscVObjAplicInfo
*/
typedef struct CmRiscVAplicInfo {
  PLIC_APLIC_COMMON_INFO    PlicAplicCommonInfo;

  /// Number of IDCs
  UINT16                    NumIdcs;
} CM_RISCV_APLIC_INFO;

/** A structure that describes the
    PLIC information for the Platform.

    ID: ERiscVObjPlicInfo
*/
typedef struct CmRiscVPlicInfo {
  PLIC_APLIC_COMMON_INFO    PlicAplicCommonInfo;

  /// Max Priority
  UINT16                    MaxPriority;
} CM_RISCV_PLIC_INFO;

/** A structure that describes the
    ISA string for the Platform.

    ID: ERiscVObjIsaStringInfo
*/
typedef struct CmRiscVIsaStringInfo {
  /// Reference Token
  CM_OBJECT_TOKEN    Token;

  /// ISA Length
  UINT16             Length;

  /// ISA String
  CHAR8              IsaString[MAX_ISA_STRING_LENGTH];
} CM_RISCV_ISA_STRING_NODE;

/** A structure that describes the
    CMO of the CPU.

    ID: ERiscVObjCmoInfo
*/
typedef struct CmRiscVCmoInfo {
  /// Reference Token
  CM_OBJECT_TOKEN    Token;

  /// Cbom Block Size
  UINT8              CbomBlockSize;

  /// Cbop Block Size
  UINT8              CbopBlockSize;

  /// Cboz Block Size
  UINT8              CbozBlockSize;
} CM_RISCV_CMO_NODE;

/** A structure that describes the
    MMU of the CPU.

    ID: ERiscVObjMmuInfo
*/
typedef struct CmRiscVMmuInfo {
  /// Reference Token
  CM_OBJECT_TOKEN    Token;

  /// MMU Type
  UINT8              MmuType;
} CM_RISCV_MMU_NODE;

/** A structure that describes the
    Timer for the Platform.

    ID: ERiscVObjTimerInfo
*/
typedef struct CmRiscVTimerInfo {
  /// Flags
  UINT32    Flags;

  /// Time Base Frequency
  UINT64    TimeBaseFrequency;
} CM_RISCV_TIMER_INFO;

/** A structure that describes the
    Processor Specific Block for Smbios type 44 record.

    ID: ERiscVObjProcessorSpecificBlockInfo
*/
typedef struct CmRiscVProcessorSpecificBlockInfo {
  /// Revision
  UINT16    Revision;

  /// The ID of this RISC-V hart.
  UINT64    HartId;

  /// Vendor ID.
  UINT64    VendorId;

  /// Machine Architecture ID.
  UINT64    ArchId;

  /// Machine Implementation ID.
  UINT64    ImplId;
} CM_RISCV_PROCESSOR_SPECIFIC_BLOCK_INFO;

#pragma pack()