Enhance sys_info and postcode for multi-host
This patch enhances multi-host platform support in the OCP debug card
display (sys_info and postcode pages) and OEM command modules.
It replaces hard-coded D-Bus paths and single-interface networkqueries
with dynamic lookups based on the current host selector position.
-Sys_Info page now retrieves the correct FRU path.
-POSTCODE page dynamically calls Boot.PostCode<N> service/object for
each host slot.
-Network information Network information now supports fetching from
eth1 when eth0 is unavailable, preventing missing data or crashes.
Motivation:
Original implementation used hardcoded D-Bus paths such as PostCode0
and only checked eth0 for network-related data. On multi-host platforms,
each host has a separate PostCode service, and FRU/FW data may differ
or be present in alternate paths. Moreover, some systems expose IP/MAC
data on eth1, causing failures when only eth0 is queried. These issue
led to incomplete data being shown or crashes in the sys_info display.
Design:
- Introduced logic to dynamically determine the current host position
and fetch the corresponding PostCode service (PostCode0 ~ PostCode7).
- Enhance `getNetworkData` to check both eth0 and eth1 for IP and MAC
addresses, and avoid crashes if a value is not found.
- Updated FRU retrieval to support multiple motherboard paths and
fallback paths, using filtered D-Bus object mapping
via interface matching and predicate.
- Ensured all std::string results are checked before accessing to
prevent null dereferencing and crashes.
Change-Id: I0c88eb58c3b416437a02994c4c202d5c2269d32a
Signed-off-by: Liora Guo <liora.guo.wiwynn@gmail.com>
diff --git a/include/usb-dbg.hpp b/include/usb-dbg.hpp
index 1344150..0d7f2ef 100644
--- a/include/usb-dbg.hpp
+++ b/include/usb-dbg.hpp
@@ -60,6 +60,9 @@
static constexpr size_t FRAME_PAGE_BUF_SIZE = 256;
#define FRU_ALL 0
+#define BOOT_POSTCODE_SERVICE "xyz.openbmc_project.State.Boot.PostCode"
+#define BOOT_POSTCODE_OBJECTPATH "/xyz/openbmc_project/State/Boot/PostCode"
+#define BOOT_POSTCODE_INTERFACE "xyz.openbmc_project.State.Boot.PostCode"
static constexpr auto DEBUG_GPIO_KEY = "GpioDesc";
static constexpr auto GPIO_ARRAY_SIZE = 4;