summaryrefslogtreecommitdiffstats
path: root/src/common/gpu_structs.h
blob: e0fffeeac066386b16cdf805a1043bdc8f1539ca (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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/common/gpu_structs.h $                                    */
/*                                                                        */
/* OpenPOWER OnChipController Project                                     */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2016,2018                        */
/* [+] International Business Machines Corp.                              */
/*                                                                        */
/*                                                                        */
/* Licensed under the Apache License, Version 2.0 (the "License");        */
/* you may not use this file except in compliance with the License.       */
/* You may obtain a copy of the License at                                */
/*                                                                        */
/*     http://www.apache.org/licenses/LICENSE-2.0                         */
/*                                                                        */
/* Unless required by applicable law or agreed to in writing, software    */
/* distributed under the License is distributed on an "AS IS" BASIS,      */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or        */
/* implied. See the License for the specific language governing           */
/* permissions and limitations under the License.                         */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */

/* This header file is used by both occ_405 and occ_gpe1.                 */
/* Contains common structures and globals.                                */

#ifndef _GPU_STRUCTS_H
#define _GPU_STRUCTS_H

#include "occ_util.h"
#include <gpe_export.h>
#include "gpe_err.h"

#define MAX_GPUS 3

#define GPU_RESET_REQ_MASTER        1
#define GPU_RESET_REQ_SLV           2
#define GPU_RESET_REQ_SLV_COMPLETE  3

typedef enum
{
    GPU_CAP_MEM     = 0x00,
    GPU_CAP_CORE    = 0x01
} GPU_CAPABILITIES;

typedef enum
{
    ID_GPU0 = 0x00,
    ID_GPU1 = 0x01,
    ID_GPU2 = 0x02,
    ID_ALL_GPUS = 0xFF
} GPU_ID;

typedef enum
{
    GPU_STATE_PRESENT = 0x00000001,
    GPU_STATE_FAILED  = 0x80000000,
} GPU_STATE;

// GPU Request Operations
typedef enum
{
    // Initialize the GPU state machine and I2C engine
    GPU_REQ_INIT                        = 0x01,

    // Read GPU core temperature
    GPU_REQ_READ_TEMP_START             = 0x02,
    GPU_REQ_READ_TEMP_FINISH            = 0x03,

    // Read GPU memory temperature
    GPU_REQ_READ_MEM_TEMP_START         = 0x04,
    GPU_REQ_READ_MEM_TEMP_2             = 0x05,
    GPU_REQ_READ_MEM_TEMP_3             = 0x06,
    GPU_REQ_READ_MEM_TEMP_FINISH        = 0x07,

    // Read thermal capabilities
    GPU_REQ_READ_CAPS_START             = 0x08,
    GPU_REQ_READ_CAPS_2                 = 0x09,
    GPU_REQ_READ_CAPS_3                 = 0x0A,
    GPU_REQ_READ_CAPS_FINISH            = 0x0B,

    // Set GPU power cap
    GPU_REQ_SET_PWR_LIMIT_1_START       = 0x20,
    GPU_REQ_SET_PWR_LIMIT_1_2           = 0x21,
    GPU_REQ_SET_PWR_LIMIT_1_3           = 0x22,
    GPU_REQ_SET_PWR_LIMIT_1_FINISH      = 0x23,
    GPU_REQ_SET_PWR_LIMIT_2_START       = 0x24,
    GPU_REQ_SET_PWR_LIMIT_2_2           = 0x25,
    GPU_REQ_SET_PWR_LIMIT_2_3           = 0x26,
    GPU_REQ_SET_PWR_LIMIT_2_FINISH      = 0x27,
    GPU_REQ_SET_PWR_LIMIT_3_START       = 0x28,
    GPU_REQ_SET_PWR_LIMIT_3_2           = 0x29,
    GPU_REQ_SET_PWR_LIMIT_3_3           = 0x2A,
    GPU_REQ_SET_PWR_LIMIT_3_FINISH      = 0x2B,
    GPU_REQ_SET_PWR_LIMIT_4_START       = 0x2C,
    GPU_REQ_SET_PWR_LIMIT_4_2           = 0x2D,
    GPU_REQ_SET_PWR_LIMIT_4_FINISH      = 0x2E,

    // Start check driver loaded
    GPU_REQ_CHECK_DRIVER_START          = 0x31,
    GPU_REQ_CHECK_DRIVER_2              = 0x32,
    GPU_REQ_CHECK_DRIVER_3              = 0x33,
    GPU_REQ_CHECK_DRIVER_FINISH         = 0x34,

    // Read power limit policy
    GPU_REQ_GET_PWR_LIMIT_1_START       = 0x40,
    GPU_REQ_GET_PWR_LIMIT_1_2           = 0x41,
    GPU_REQ_GET_PWR_LIMIT_1_3           = 0x42,
    GPU_REQ_GET_PWR_LIMIT_1_FINISH      = 0x43,
    GPU_REQ_GET_PWR_LIMIT_2_START       = 0x44,
    GPU_REQ_GET_PWR_LIMIT_2_2           = 0x45,
    GPU_REQ_GET_PWR_LIMIT_2_FINISH      = 0x46,
    GPU_REQ_GET_PWR_LIMIT_3_START       = 0x47,
    GPU_REQ_GET_PWR_LIMIT_3_2           = 0x48,
    GPU_REQ_GET_PWR_LIMIT_3_3           = 0x49,
    GPU_REQ_GET_PWR_LIMIT_3_FINISH      = 0x4A,
    GPU_REQ_GET_PWR_LIMIT_4_START       = 0x4B,
    GPU_REQ_GET_PWR_LIMIT_4_2           = 0x4C,
    GPU_REQ_GET_PWR_LIMIT_4_3           = 0x4D,
    GPU_REQ_GET_PWR_LIMIT_4_FINISH      = 0x4E,
    GPU_REQ_GET_PWR_LIMIT_5_START       = 0x4F,
    GPU_REQ_GET_PWR_LIMIT_5_2           = 0x50,
    GPU_REQ_GET_PWR_LIMIT_5_3           = 0x51,
    GPU_REQ_GET_PWR_LIMIT_5_FINISH      = 0x52,

    // Reset the I2C master and slave
    GPU_REQ_RESET                       = 0x60,
} gpu_op_req_e;

// GPU arguments
typedef struct
{
  GpeErrorStruct error;
  uint8_t gpu_id;
  uint8_t gpu_rc;
  uint8_t operation;
  uint64_t data[3];
} gpu_sm_args_t;

typedef struct
{
    uint32_t pib_master;
    uint32_t bus_voltage;
    uint32_t port[MAX_GPUS];
    uint32_t addr[MAX_GPUS];
} gpu_i2c_info_t;

typedef struct
{
  GpeErrorStruct error;
  gpu_i2c_info_t  gpu_i2c;
} gpu_init_args_t;

#endif // _GPU_STRUCTS_H

OpenPOWER on IntegriCloud