summaryrefslogtreecommitdiffstats
path: root/src/occ_405/dimm/dimm.h
blob: db674ccd789a2d58e2f864f3bbb6f46a38ae9624 (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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/occ_405/dimm/dimm.h $                                     */
/*                                                                        */
/* OpenPOWER OnChipController Project                                     */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2011,2015                        */
/* [+] 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 _DIMM_H
#define _DIMM_H

#include <occ_common.h>
#include <trac_interface.h>
#include <errl.h>
#include <rtls.h>

// If DIMM has huid/sensor then it is present
#define NIMBUS_DIMM_PRESENT(port,dimm) (0 != G_sysConfigData.dimm_huids[port][dimm])

// A bit vector that indicated the dimms (mbas) configured in a system.
// Bit 0 (MSB) encodes the configuration status for port 0 on MC01
// (or mba01 on centaur 0) a 1 indicated a dimm (mba) is configured
// for throttling. Only most significant 8 bits used in Nimbus.
extern uint16_t G_configured_mbas;

// DIMM Throttle Limits have been configured?
#define NIMBUS_DIMM_THROTTLING_CONFIGURED(vector,mc,port) \
    (0 != (vector & (0x8000 >> ((port) + ((mc) * (MAX_NUM_MCU_PORTS))))))

#define NIMBUS_DIMM_INDEX_THROTTLING_CONFIGURED(memIndex) \
    (0 != (G_configured_mbas & (0x8000 >> memIndex)))

#define NIMBUS_DIMM_PORT_THROTTLING_CONFIGURED(mc,port)            \
    (0 != (G_configured_mbas & (0x8000 >> ((mc) * (MAX_NUM_MCU_PORTS)))))

// Configure NIMBUS_DIMM Throttling data on MC01/MC02's (0/1) port (0-3)
#define CONFIGURE_NIMBUS_DIMM_THROTTLING(vector,mc,port)  \
    vector |= (0x8000 >> ((port) + (mc) * (MAX_NUM_MCU_PORTS)))


#define NUM_DIMM_PORTS           2
// On Nimbus, we are using the centaur number as the I2C port (keep same structure)
// There can be 8 DIMMs under a Centaur and 8 DIMMs per I2C port (max of 2 ports)
// DIMM code assumed that NUM_DIMMS_PER_I2CPORT == NUM_DIMMS_PER_CENTAUR
#define NUM_DIMMS_PER_I2CPORT           8


#define DIMM_TICK (CURRENT_TICK % MAX_NUM_TICKS)

typedef enum
{
    DIMM_READ_SUCCESS =             0x00,
    DIMM_READ_IN_PROGRESS =         0x01,
    DIMM_READ_SCHEDULE_FAILED =     0xFA,
    DIMM_READ_NOT_COMPLETE =        0xFF,
} readStatus_e;

typedef enum
{
    PIB_I2C_ENGINE_C = 0x01,
    PIB_I2C_ENGINE_D = 0x02,
    PIB_I2C_ENGINE_E = 0x03,
    PIB_I2C_ENGINE_ALL = 0xFF,
} PIB_I2C_ENGINE;

typedef enum
{
    MEM_TYPE_CUMULUS = 0x00,
    MEM_TYPE_NIMBUS  = 0xFF
} MEMORY_TYPE;

// Generic memory initialization to handle init for all memory types
void memory_init();

// Nimbus specific init
void memory_nimbus_init();

// DIMM I2C state machine (for NIMBUS)
void task_dimm_sm(struct task *i_self);

#endif //_DIMM_H
OpenPOWER on IntegriCloud