summaryrefslogtreecommitdiffstats
path: root/src/usr/vpd/ocmb_spd.H
blob: 91123dfd41df2c01ac759a57c1fb7f0d149c7daf (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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/vpd/ocmb_spd.H $                                      */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2019                             */
/* [+] 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 __OCMB_SPD_H
#define __OCMB_SPD_H

#include <i2c/eeprom_const.H>

namespace SPD
{

/*
 * @brief Read keyword from SPD
 *
 * @param[in]     i_target     OCMB target to read data from
 * @param[in/out] io_buffer    databuffer SPD will be written to
 * @param[in/out] io_buflen    length of the given data buffer
 * @param[in]     i_keyword    keyword from spdenums.H to read
 * @param[in]     i_memType    The memory type of this target.
 * @param[in]     i_location   The EEPROM source (CACHE/HARDWARE).
 *
 * @return        errlHndl_t   nullptr on success. Otherwise, error log.
 */
errlHndl_t ocmbGetSPD(TARGETING::TargetHandle_t        i_target,
                      void*                            io_buffer,
                      size_t&                          io_buflen,
                      const VPD::vpdKeyword            i_keyword,
                      const uint8_t                    i_memType,
                      EEPROM::EEPROM_SOURCE            i_location);

/*
 * @brief Determine if the given DIMM type is a known DIMM type or not
 *
 * @param[in] i_dimmType - The DIMM to verify if valid
 *
 * @return boolean - return true if given parameter is a known DIMM type,
 *                   false otherwise
 */
bool isValidOcmbDimmType(const uint8_t i_dimmType);

/*
 * @brief This function will read the DIMM memory type for OCMBs.
 *
 * @param[out] o_memType     - The memory type value to return.
 *
 * @param[in] i_target       - The target to read data from.
 *
 * @param[in] i_eepromSource - The EEPROM source (CACHE/HARDWARE).
 *
 * @return errlHndl_t - NULL if successful, otherwise a pointer
 *      to the error log.
 */
errlHndl_t getMemType(uint8_t&                      o_memType,
                      TARGETING::TargetHandle_t     i_target,
                      EEPROM::EEPROM_SOURCE         i_eepromSource);

/**
 * @param This function is a wrapper for reading the correct keyword.
 *
 * @param[in]  i_target     The target DDIMM to access.
 *
 * @param[in]  i_byteAddr   The offset into the JEDEC SPD layout.
 *
 * @param[in]  i_numbytes   Number of bytes to read.
 *
 * @param[out] o_data       The data buffer that will return the data read.
 *
 * @param[in]  i_location   The EEPROM source (CACHE/HARDWARE).
 *
 * @return     errlHndl_t   nullptr if successful, otherwise a pointer to the
 *                          error log.
 */
errlHndl_t ocmbFetchData(TARGETING::TargetHandle_t    i_target,
                         uint64_t                     i_byteAddr,
                         size_t                       i_numBytes,
                         void*                        o_data,
                         EEPROM::EEPROM_SOURCE        i_location);

}

#endif
OpenPOWER on IntegriCloud