blob: 5b2c44d755ddf9c3aefbad1136a9d68e1feef03c [file] [log] [blame]
AppaRao Pulic532f552019-07-05 15:23:50 +05301/*
2// Copyright (c) 2019 Intel Corporation
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#pragma once
17
Chalapathi Venkataramashetty55e79342021-03-29 10:17:48 +000018#include <boost/algorithm/string/predicate.hpp>
19#include <boost/asio.hpp>
20#include <sdbusplus/asio/object_server.hpp>
21
AppaRao Pulic532f552019-07-05 15:23:50 +053022#include <string>
23
AppaRao Pulic532f552019-07-05 15:23:50 +053024namespace pfr
25{
26
27enum class ImageType
28{
Vikram Bodireddy3c6c8c32019-12-05 11:06:15 +053029 cpldActive,
30 cpldRecovery,
AppaRao Pulic532f552019-07-05 15:23:50 +053031 biosActive,
32 biosRecovery,
33 bmcActive,
Vikram Bodireddy8292dc62021-05-26 13:31:47 +053034 bmcRecovery,
35 afmActive,
36 afmRecovery
AppaRao Pulic532f552019-07-05 15:23:50 +053037};
38
AppaRao Puli88aa33b2019-07-18 23:49:55 +053039enum class ActionType
40{
41 recoveryCount,
42 recoveryReason,
43 panicCount,
44 panicReason,
45 majorError,
Chalapathi Venkataramashettybcc7ce12021-05-17 04:27:21 +000046 minorError,
47 readRoTRev
AppaRao Puli88aa33b2019-07-18 23:49:55 +053048};
49
AppaRao Pulidbe184d2019-10-09 18:04:22 +053050std::string toHexString(const uint8_t val);
AppaRao Puli67d184c2020-05-29 00:48:33 +053051std::string getFirmwareVersion(const ImageType& imgType);
Chalapathi Venkataramashettyf8819702021-02-03 09:43:46 +000052int getProvisioningStatus(bool& ufmLocked, bool& ufmProvisioned,
53 bool& ufmSupport);
Zhikui Renc96f37d2021-12-08 15:40:51 -080054int getPlatformState(uint8_t& state);
AppaRao Puli67d184c2020-05-29 00:48:33 +053055int readCpldReg(const ActionType& action, uint8_t& value);
Chalapathi Venkataramashettye6fb18e2021-02-03 14:51:00 +000056std::string readCPLDVersion();
sri anjaneyulu alapatibe132592023-07-17 10:16:39 +000057int setBMCBootCompleteChkPoint(const uint8_t checkPoint);
Chalapathi Venkataramashetty55e79342021-03-29 10:17:48 +000058void init(std::shared_ptr<sdbusplus::asio::connection> conn,
59 bool& i2cConfigLoaded);
deepak kumar agrawalb29a15c2022-03-25 07:45:57 +000060int setBMCBusy(bool setValue);
61int getMBRegister(uint32_t regAddr, uint8_t& mailBoxReply);
AppaRao Pulic532f552019-07-05 15:23:50 +053062
63} // namespace pfr