blob: 8a1f9e6f9560037683750a31b03b5063e1d635bf [file] [log] [blame]
Jason M. Bills2d582472021-11-01 12:33:09 -07001/*
2// Copyright (c) 2022 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#include <error_monitors/base_gpio_monitor.hpp>
18#include <host_error_monitor.hpp>
19#include <sdbusplus/asio/object_server.hpp>
20
21namespace host_error_monitor::mcerr_monitor
22{
23class MCERRMonitor :
24 public host_error_monitor::base_gpio_monitor::BaseGPIOMonitor
25{
Jason M. Bills2d582472021-11-01 12:33:09 -070026 const size_t cpuNum;
27
28 void logEvent() override
29 {
Jason M. Bills87315f52022-06-22 08:30:36 -070030 std::string msg = "MCERR on CPU " + std::to_string(cpuNum);
Jason M. Bills2d582472021-11-01 12:33:09 -070031
32 sd_journal_send("MESSAGE=HostError: %s", msg.c_str(), "PRIORITY=%i",
33 LOG_INFO, "REDFISH_MESSAGE_ID=%s",
34 "OpenBMC.0.1.CPUError", "REDFISH_MESSAGE_ARGS=%s",
35 msg.c_str(), NULL);
36 }
37
38 public:
Jason M. Billsc99b8c92022-06-14 09:18:36 -070039 MCERRMonitor(
Ed Tanousee00ccc2023-03-01 10:37:43 -080040 boost::asio::io_context& io,
Jason M. Billsc99b8c92022-06-14 09:18:36 -070041 std::shared_ptr<sdbusplus::asio::connection> conn,
42 const std::string& signalName,
43 const host_error_monitor::base_gpio_monitor::AssertValue assertValue,
44 const size_t cpuNum) :
Jason M. Bills2d582472021-11-01 12:33:09 -070045 BaseGPIOMonitor(io, conn, signalName, assertValue),
46 cpuNum(cpuNum)
47 {
48 if (valid)
49 {
50 startMonitoring();
51 }
52 }
53};
54} // namespace host_error_monitor::mcerr_monitor