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
|
/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
/* $Source: src/occ_405/pss/avsbus.h $ */
/* */
/* OpenPOWER OnChipController Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2011,2017 */
/* [+] 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 */
#ifndef _AVSBUS_H
#define _AVSBUS_H
#include <errl.h>
extern bool G_avsbus_vdd_monitoring;
extern bool G_avsbus_vdn_monitoring;
extern uint32_t G_check_vdd_current_10mA_for_rollover;
#define AVSBUS_STATUS_OVER_CURRENT_MASK 0x4000
#define AVSBUS_STATUS_UNDER_VOLTAGE_MASK 0x2000
#define AVSBUS_STATUS_OVER_TEMPERATURE_MASK 0x1000
#define AVSBUS_STATUS_OVER_POWER_MASK 0x0800
#define AVSBUS_STATUS_ONGOING 0x80000000 // o2s_ongoing
#define AVSBUS_STATUS_ERRORS 0x05000000 // write_while_bridge_busy_error | FSM error
typedef enum
{
AVSBUS_VDD = 0x00,
AVSBUS_VDN = 0x01,
AVSBUS_TYPE_MAX = 2 // Number of bus types
} avsbus_type_e;
typedef enum
{
// This enum contains the AVS Bus CmdDataType that can be read
AVSBUS_VOLTAGE = 0x00,
AVSBUS_CURRENT = 0x02,
AVSBUS_TEMPERATURE = 0x03,
AVSBUS_STATUS = 0x0E,
AVSBUS_CMDS_MAX = 4 // Number of supported AVS bus commands
} avsbus_cmdtype_e;
// Setup the AVS Bus for reading
void avsbus_init();
// Initiate AVS Bus read for specified cmdtype (Voltage / Current)
// (results can then be read on the next tick)
void initiate_avsbus_reads(avsbus_cmdtype_e i_cmdType);
// Initiate read for specified type (Vdd/Vdn) and cmd (Voltage/Current/Temperature)
void avsbus_read_start(const avsbus_type_e i_type,
const avsbus_cmdtype_e i_cmdtype);
// Process AVS Bus read results (or errors) for specified bus/cmdtype.
// Returns the data requested (voltage units are mV, current units are in 10mA)
// Predictive error will be logged after MAX_READ_ATTEMPTS failures on the specific
// bus/cmdtype and an OCC reset will be requested
uint16_t avsbus_read(const avsbus_type_e i_type,
const avsbus_cmdtype_e i_cmdtype);
// Initiate read of AVS Bus Status
// (results can then be read on the next tick)
void initiate_avsbus_read_status();
// Read the status from AVS Bus
// Error history counters will be incremented for any over-current condition.
void process_avsbus_status();
// Calculate chip voltage and power from AVSbus readings and update sensors
void update_avsbus_power_sensors(const avsbus_type_e i_type);
// Error history counters will be incremented for any over-current condition.
uint32_t clear_status_errors(const uint8_t i_bus, const uint32_t i_status_mask);
#endif //_AVSBUS_H
|