blob: ba2389ab098f17e2c94d796e18d6f6f121e573ff [file] [log] [blame]
Patrick Venture148cd652018-11-06 10:59:47 -08001#include "config.h"
2
Patrick Venturec7ca2912018-11-02 11:38:33 -07003#include "firmware_handler.hpp"
4
5#include <blobs-ipmid/manager.hpp>
Patrick Venture192d60f2018-11-06 11:11:59 -08006#include <cstdint>
Patrick Venturec7ca2912018-11-02 11:38:33 -07007#include <memory>
8#include <phosphor-logging/log.hpp>
9
10namespace blobs
11{
12using namespace phosphor::logging;
13
Patrick Venture148cd652018-11-06 10:59:47 -080014std::vector<std::string> supportedFirmware = {
Patrick Venture148cd652018-11-06 10:59:47 -080015#ifdef ENABLE_STATIC_LAYOUT
16 "/flash/image",
17#endif
18};
19
Patrick Venture192d60f2018-11-06 11:11:59 -080020std::uint32_t supportedTransports =
21 static_cast<std::uint32_t>(FirmwareUpdateFlags::bt);
22
Patrick Venturec7ca2912018-11-02 11:38:33 -070023void setupFirmwareHandler() __attribute__((constructor));
24
25void setupFirmwareHandler()
26{
Patrick Venture192d60f2018-11-06 11:11:59 -080027#ifdef ENABLE_PCI_BRIDGE
28 supportedTransports |= static_cast<std::uint32_t>(FirmwareUpdateFlags::p2a);
29#endif
30#ifdef ENABLE_LPC_BRIDGE
31 supportedTransports |= static_cast<std::uint32_t>(FirmwareUpdateFlags::lpc);
32#endif
33
Patrick Venturec7ca2912018-11-02 11:38:33 -070034 auto* manager = getBlobManager();
Patrick Venture68cf64f2018-11-06 10:46:51 -080035 if (!manager->registerHandler(
Patrick Venture192d60f2018-11-06 11:11:59 -080036 FirmwareBlobHandler::CreateFirmwareBlobHandler(
37 supportedFirmware, supportedTransports)))
Patrick Venturec7ca2912018-11-02 11:38:33 -070038 {
39 log<level::ERR>("Failed to register Firmware Handler");
40 }
41}
42
43} // namespace blobs