bmc: move the memoryRegionSize out of the method
This information is not always used, and we need to also avoid it being
re-declared.
Tested: meta-gsj was built which uses the net config
Tested: meta-X that was built using p2a config.
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: Id9f355d63d78baaca1d6715367a6252636c5c4c7
diff --git a/bmc/main.cpp b/bmc/main.cpp
index 031871f..eeca589 100644
--- a/bmc/main.cpp
+++ b/bmc/main.cpp
@@ -60,26 +60,15 @@
return HandlerPack(name, std::make_unique<FileHandler>(path));
}
-/**
- * Returns the corresponding memory region size given the compiled
- * configuration.
- *
- * @return the size.
- */
-std::size_t GetMemoryRegionSize()
-{
#ifdef NUVOTON_P2A_MBOX
- constexpr std::size_t memoryRegionSize = 16 * 1024UL;
+static constexpr std::size_t memoryRegionSize = 16 * 1024UL;
#elif defined NUVOTON_P2A_VGA
- constexpr std::size_t memoryRegionSize = 4 * 1024 * 1024UL;
+static constexpr std::size_t memoryRegionSize = 4 * 1024 * 1024UL;
#else
- /* The maximum external buffer size we expect is 64KB. */
- constexpr std::size_t memoryRegionSize = 64 * 1024UL;
+/* The maximum external buffer size we expect is 64KB. */
+static constexpr std::size_t memoryRegionSize = 64 * 1024UL;
#endif
- return memoryRegionSize;
-}
-
} // namespace
} // namespace ipmi_flash
@@ -99,8 +88,7 @@
#ifdef ENABLE_PCI_BRIDGE
supportedTransports.emplace_back(
FirmwareFlags::UpdateFlags::p2a,
- std::make_unique<PciDataHandler>(MAPPED_ADDRESS,
- GetMemoryRegionSize()));
+ std::make_unique<PciDataHandler>(MAPPED_ADDRESS, memoryRegionSize));
#endif
#ifdef ENABLE_LPC_BRIDGE
@@ -108,12 +96,12 @@
supportedTransports.emplace_back(
FirmwareFlags::UpdateFlags::lpc,
std::make_unique<LpcDataHandler>(LpcMapperAspeed::createAspeedMapper(
- MAPPED_ADDRESS, GetMemoryRegionSize())));
+ MAPPED_ADDRESS, memoryRegionSize)));
#elif defined(NUVOTON_LPC)
supportedTransports.emplace_back(
FirmwareFlags::UpdateFlags::lpc,
std::make_unique<LpcDataHandler>(LpcMapperNuvoton::createNuvotonMapper(
- MAPPED_ADDRESS, GetMemoryRegionSize())));
+ MAPPED_ADDRESS, memoryRegionSize)));
#else
#error "You must specify a hardware implementation."
#endif