OpenBIC
OpenSource Bridge-IC
apml.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef APML_H
18#define APML_H
19
20#define APML_SUCCESS 0
21#define APML_ERROR 1
22
23#define RMI_SOFT_RESET_BIT BIT(0)
24
25#define SB_TSI_ADDR 0x4C
26#define SB_RMI_ADDR 0x3C
27
28#define SBRMI_CMD_CODE_LEN_DEFAULT 1
29#define SBRMI_CMD_CODE_LEN_TWO_BYTE 2
30#define SBRMI_REV_BRTH 0x21
31
32#define APML_BUS_UNKNOWN 0xFF
33
38};
39
47};
48
57};
58
64};
65
88};
89
90typedef struct _mailbox_WrData_ {
91 uint8_t command;
92 uint8_t data_in[4];
94
95typedef struct _mailbox_RdData_ {
96 uint8_t command;
97 uint8_t data_out[4];
98 uint8_t error_code;
100
101typedef struct _cpuid_WrData_ {
102 uint8_t thread;
103 uint8_t cpuid_func[4];
104 uint8_t ecx_value;
106
107/* RMI Rev 2.1 use 2 bytes thread */
109 uint8_t thread[2];
110 uint8_t cpuid_func[4];
111 uint8_t ecx_value;
113
114typedef struct _cpuid_RdData_ {
115 uint8_t status;
116 uint8_t data_out[8];
118
119typedef struct _mca_WrData_ {
120 uint8_t thread;
121 uint8_t register_addr[4];
123
124/* RMI Rev 2.1 use 2 bytes thread */
125typedef struct _mca_WrData_TwoPOne {
126 uint8_t thread[2];
127 uint8_t register_addr[4];
129
130typedef struct _mca_RdData_ {
131 uint8_t status;
132 uint8_t data_out[8];
134
135typedef __aligned(4) struct _apml_msg_ {
136 uint8_t msg_type;
137 uint8_t bus;
138 uint8_t target_addr;
139 uint8_t WrData[7];
140 uint8_t RdData[9];
141 void (*cb_fn)(struct _apml_msg_ *msg);
142 void (*error_cb_fn)(struct _apml_msg_ *msg);
143 void *ptr_arg;
144 uint32_t ui32_arg;
146
147typedef struct _apml_buffer_ {
148 uint8_t index;
151
152uint8_t apml_read_byte(uint8_t bus, uint8_t addr, uint8_t offset, uint8_t *read_data);
153uint8_t apml_write_byte(uint8_t bus, uint8_t addr, uint8_t offset, uint8_t write_data);
155uint8_t get_apml_response_by_index(apml_msg *msg, uint8_t index);
156uint8_t apml_read(apml_msg *msg);
161uint8_t pal_get_apml_bus();
162uint8_t apml_get_bus();
163int set_sbrmi_command_code_len(uint8_t value);
167
168#endif
void apml_recovery()
uint8_t apml_read_byte(uint8_t bus, uint8_t addr, uint8_t offset, uint8_t *read_data)
void apml_request_callback(apml_msg *msg)
__packed apml_msg
Definition: apml.h:145
int get_sbrmi_command_code_len()
SBRMI_REGISTER
Definition: apml.h:66
@ SBRMI_INBANDMSG_INST0
Definition: apml.h:78
@ SBRMI_INBANDMSG_INST6
Definition: apml.h:84
@ SBRMI_OUTBANDMSG_INST6
Definition: apml.h:76
@ SBRMI_INBANDMSG_INST1
Definition: apml.h:79
@ SBRMI_OUTBANDMSG_INST2
Definition: apml.h:72
@ SBRMI_OUTBANDMSG_INST0
Definition: apml.h:70
@ SBRMI_OUTBANDMSG_INST7
Definition: apml.h:77
@ SBRMI_INBANDMSG_INST7
Definition: apml.h:85
@ SBRMI_OUTBANDMSG_INST1
Definition: apml.h:71
@ SBRMI_INBANDMSG_INST5
Definition: apml.h:83
@ SBRMI_STATUS
Definition: apml.h:69
@ SBRMI_OUTBANDMSG_INST5
Definition: apml.h:75
@ SBRMI_OUTBANDMSG_INST4
Definition: apml.h:74
@ SBRMI_OUTBANDMSG_INST3
Definition: apml.h:73
@ SBRMI_INBANDMSG_INST3
Definition: apml.h:81
@ SBRMI_SOFTWARE_INTERRUPT
Definition: apml.h:86
@ SBRMI_REVISION
Definition: apml.h:67
@ SBRMI_INBANDMSG_INST4
Definition: apml.h:82
@ SBRMI_INBANDMSG_INST2
Definition: apml.h:80
@ SBRMI_CONTROL
Definition: apml.h:68
@ SBRMI_RAS_STATUS
Definition: apml.h:87
void fatal_error_happened()
uint8_t apml_get_bus()
struct _mca_WrData_ mca_WrData
struct _cpuid_RdData_ cpuid_RdData
typedef __aligned(4) struct _apml_msg_
Definition: apml.h:135
int pal_check_sbrmi_command_code_length()
Definition: plat_apml.c:31
struct _mailbox_WrData_ mailbox_WrData
struct _mca_RdData_ mca_RdData
APML_MSG_TYPE
Definition: apml.h:34
@ APML_MSG_TYPE_CPUID
Definition: apml.h:36
@ APML_MSG_TYPE_MAILBOX
Definition: apml.h:35
@ APML_MSG_TYPE_MCA
Definition: apml.h:37
SBTSI_REGISTER
Definition: apml.h:49
@ SBTSI_STATUS
Definition: apml.h:51
@ SBTSI_HIGH_TEMP_INTEGER_THRESHOLD
Definition: apml.h:54
@ SBTSI_CONFIG_WRITE
Definition: apml.h:55
@ SBTSI_CONFIG
Definition: apml.h:52
@ SBTSI_CPU_TEMP_INT
Definition: apml.h:50
@ SBTSI_CPU_TEMP_DEC
Definition: apml.h:56
@ SBTSI_UPDATE_RATE
Definition: apml.h:53
uint8_t pal_get_apml_bus()
Definition: plat_apml.c:69
struct _cpuid_WrData_TwoPOne_ cpuid_WrData_TwoPOne
struct _cpuid_WrData_ cpuid_WrData
uint8_t apml_write_byte(uint8_t bus, uint8_t addr, uint8_t offset, uint8_t write_data)
void enable_alert_signal()
void apml_init()
uint8_t apml_read(apml_msg *msg)
SBRMI_MAILBOX_CMD
Definition: apml.h:40
@ SBRMI_MAILBOX_REPORT_DIMM_TEMP
Definition: apml.h:44
@ SBRMI_MAILBOX_WRITE_DRAM_THROTTLE
Definition: apml.h:42
@ SBRMI_MAILBOX_REPORT_DIMM_POWER
Definition: apml.h:43
@ SBRMI_MAILBOX_PKGPWR
Definition: apml.h:41
@ SBRMI_MAILBOX_GET_DIMM_TEMP
Definition: apml.h:46
@ SBRMI_MAILBOX_GET_DIMM_PWR
Definition: apml.h:45
struct _apml_buffer_ apml_buffer
struct _mca_WrData_TwoPOne mca_WrData_TwoPOne
SBRMI_MAILBOX_ERR_CODE
Definition: apml.h:59
@ SBRMI_MAILBOX_NO_ERR
Definition: apml.h:60
@ SBRMI_MAILBOX_UNKNOWN_CMD
Definition: apml.h:62
@ SBRMI_MAILBOX_CMD_ABORT
Definition: apml.h:61
@ SBRMI_MAILBOX_INVALID_CORE
Definition: apml.h:63
struct _mailbox_RdData_ mailbox_RdData
uint8_t get_apml_response_by_index(apml_msg *msg, uint8_t index)
void disable_mailbox_completion_alert()
int set_sbrmi_command_code_len(uint8_t value)
uint8_t addr
Definition: isl69259.c:0
uint32_t offset
Definition: pldm_firmware_update.h:0
Definition: pex89000.c:64
Definition: apml.h:147
apml_msg msg
Definition: apml.h:149
uint8_t index
Definition: apml.h:148
Definition: apml.h:114
uint8_t status
Definition: apml.h:115
uint8_t data_out[8]
Definition: apml.h:116
Definition: apml.h:108
uint8_t ecx_value
Definition: apml.h:111
uint8_t thread[2]
Definition: apml.h:109
uint8_t cpuid_func[4]
Definition: apml.h:110
Definition: apml.h:101
uint8_t thread
Definition: apml.h:102
uint8_t ecx_value
Definition: apml.h:104
uint8_t cpuid_func[4]
Definition: apml.h:103
Definition: apml.h:95
uint8_t command
Definition: apml.h:96
uint8_t data_out[4]
Definition: apml.h:97
uint8_t error_code
Definition: apml.h:98
Definition: apml.h:90
uint8_t command
Definition: apml.h:91
uint8_t data_in[4]
Definition: apml.h:92
Definition: apml.h:130
uint8_t data_out[8]
Definition: apml.h:132
uint8_t status
Definition: apml.h:131
Definition: apml.h:125
uint8_t register_addr[4]
Definition: apml.h:127
uint8_t thread[2]
Definition: apml.h:126
Definition: apml.h:119
uint8_t register_addr[4]
Definition: apml.h:121
uint8_t thread
Definition: apml.h:120