blob: c66653b568deafedc6b1cb387ec17bbb835a5192 (
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
|
#pragma once
#include "internal/sys.hpp"
#include "window_hw_interface.hpp"
#include <cstdint>
#include <memory>
#include <utility>
#include <vector>
namespace ipmi_flash
{
class LpcMapperNuvoton : public HardwareMapperInterface
{
public:
static std::unique_ptr<HardwareMapperInterface>
createNuvotonMapper(std::uint32_t regionAddress,
std::uint32_t regionSize);
/**
* Create an LpcMapper for Nuvoton.
*
* @param[in] regionAddress - where to map the window into BMC memory.
* @param[in] regionSize - the size to map for copying data.
* @param[in] a sys call interface pointer.
* @todo Needs reserved memory region's physical address and size.
*/
LpcMapperNuvoton(std::uint32_t regionAddress, std::uint32_t regionSize,
const internal::Sys* sys = &internal::sys_impl) :
regionAddress(regionAddress),
memoryRegionSize(regionSize), sys(sys){};
/** Attempt to map the window for copying bytes, after mapWindow is called.
* throws MapperException
*/
MemorySet open() override;
void close() override;
WindowMapResult mapWindow(std::uint32_t address,
std::uint32_t length) override;
private:
std::uint32_t regionAddress;
std::uint32_t memoryRegionSize;
const internal::Sys* sys;
/* The file handle to /dev/mem. */
int mappedFd = -1;
/* The pointer to the memory-mapped region. */
std::uint8_t* mapped = nullptr;
};
} // namespace ipmi_flash
|