vpnor: Isolate relevant code in vpnor directory

This is prepatory work for introducing more vpnor-specific behaviours to
window handling. We will be introducing more objects to link, in order
to hook some of the window command handlers.

This change takes the opportunity to revert back to the upstream names
for some of the original C files.

Change-Id: I6b67ae466a2695054035e65ba752881be9c32d1a
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
diff --git a/.gitignore b/.gitignore
index 7b18612..af6c720 100644
--- a/.gitignore
+++ b/.gitignore
@@ -40,6 +40,7 @@
 *.swp
 /libtool
 /*.o
+/vpnor/*.o
 /config.h
 /config.h.in~
 /config.log
diff --git a/Makefile.am b/Makefile.am
index 84c5772..1bc69c6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -13,19 +13,10 @@
 mboxd_CFLAGS = $(LIBSYSTEMD_CFLAGS)
 
 if VIRTUAL_PNOR_ENABLED
-mboxd_SOURCES += pnor_partition_table.cpp \
-	mboxd_pnor_partition_table.cpp \
-	mboxd_flash_virtual.cpp \
-	pnor_partition.cpp \
-	mboxd_lpc_virtual.cpp
-
-mboxd_LDFLAGS += -lstdc++fs \
-	$(SDBUSPLUS_LIBS) \
-	$(PHOSPHOR_LOGGING_LIBS) \
-	$(PHOSPHOR_DBUS_INTERFACES_LIBS)
+include vpnor/Makefile.am.include
 else
-mboxd_SOURCES += mboxd_flash_physical.c \
-	mboxd_lpc_physical.c
+mboxd_SOURCES += mboxd_flash.c \
+	mboxd_lpc_reset.c
 endif
 
 mboxctl_SOURCES = mboxctl.c
diff --git a/mbox.h b/mbox.h
index eca0ea1..67d5622 100644
--- a/mbox.h
+++ b/mbox.h
@@ -8,7 +8,7 @@
 #include <systemd/sd-bus.h>
 #include <poll.h>
 #include <stdbool.h>
-#include "mboxd_pnor_partition_table.h"
+#include "vpnor/mboxd_pnor_partition_table.h"
 
 enum api_version {
 	API_VERSION_INVAL	= 0,
diff --git a/mboxd.c b/mboxd.c
index b944998..f92d9fb 100644
--- a/mboxd.c
+++ b/mboxd.c
@@ -35,7 +35,7 @@
 #include "mboxd_lpc.h"
 #include "mboxd_msg.h"
 #include "mboxd_windows.h"
-#include "mboxd_pnor_partition_table.h"
+#include "vpnor/mboxd_pnor_partition_table.h"
 
 #define USAGE \
 "\nUsage: %s [-V | --version] [-h | --help] [-v[v] | --verbose] [-s | --syslog]\n" \
diff --git a/mboxd_flash_physical.c b/mboxd_flash.c
similarity index 100%
rename from mboxd_flash_physical.c
rename to mboxd_flash.c
diff --git a/mboxd_lpc_physical.c b/mboxd_lpc_reset.c
similarity index 100%
rename from mboxd_lpc_physical.c
rename to mboxd_lpc_reset.c
diff --git a/test/Makefile.am.include b/test/Makefile.am.include
index 6e687ed..4251247 100644
--- a/test/Makefile.am.include
+++ b/test/Makefile.am.include
@@ -7,19 +7,19 @@
 
 test_copy_flash_SOURCES = \
 	%reldir%/copy_flash.c \
-	mboxd_flash_physical.c \
+	mboxd_flash.c \
 	common.c mtd.c \
 	%reldir%/tmpf.c
 
 test_erase_flash_SOURCES = \
 	%reldir%/erase_flash.c \
-	mboxd_flash_physical.c \
+	mboxd_flash.c \
 	common.c \
 	%reldir%/tmpf.c
 
 test_write_flash_SOURCES = \
 	%reldir%/write_flash.c \
-	mboxd_flash_physical.c \
+	mboxd_flash.c \
 	common.c \
 	%reldir%/tmpf.c
 
@@ -27,9 +27,9 @@
 	mboxd_msg.c \
 	mboxd_windows.c \
 	mboxd_lpc.c \
-	mboxd_lpc_physical.c \
+	mboxd_lpc_reset.c \
 	common.c \
-	mboxd_flash_physical.c
+	mboxd_flash.c
 
 TEST_MOCK_SRCS = %reldir%/tmpf.c %reldir%/mbox.c %reldir%/system.c
 
diff --git a/test/vpnor/Makefile.am.include b/test/vpnor/Makefile.am.include
index 0abb82c..0e6e030 100644
--- a/test/vpnor/Makefile.am.include
+++ b/test/vpnor/Makefile.am.include
@@ -1,5 +1,19 @@
-TEST_MBOX_VPNOR_SRCS = common.c pnor_partition_table.cpp \
-		       %reldir%/tmpd.cpp
+TEST_MBOX_VPNOR_SRCS = \
+	common.c \
+	vpnor/pnor_partition_table.cpp \
+	%reldir%/tmpd.cpp
+
+TEST_MBOX_VPNOR_INTEG_SRCS = \
+	common.c \
+	mboxd_msg.c \
+	mboxd_windows.c \
+	mboxd_lpc.c \
+	vpnor/mboxd_lpc_reset.cpp \
+	vpnor/mboxd_pnor_partition_table.cpp \
+	vpnor/mboxd_flash.cpp \
+	vpnor/pnor_partition.cpp \
+	vpnor/pnor_partition_table.cpp \
+	%reldir%/tmpd.cpp
 
 VPNOR_LDADD = -lstdc++fs \
 	$(SDBUSPLUS_LIBS) \
@@ -7,323 +21,212 @@
 	$(PHOSPHOR_DBUS_INTERFACES_LIBS)
 
 test_vpnor_create_pnor_partition_table_SOURCES = \
-	$(TEST_MBOX_VPNOR_SRCS) \
 	$(TEST_MOCK_SRCS) \
-	mboxd_msg.c \
-	mboxd_windows.c \
-	mboxd_lpc.c \
-	mboxd_lpc_virtual.cpp \
-	mboxd_pnor_partition_table.cpp \
-	mboxd_flash_virtual.cpp \
-	pnor_partition.cpp \
+	$(TEST_MBOX_VPNOR_INTEG_SRCS) \
 	%reldir%/create_pnor_partition_table.cpp
 test_vpnor_create_pnor_partition_table_LDFLAGS = $(OESDK_TESTCASE_FLAGS)
 test_vpnor_create_pnor_partition_table_LDADD = $(VPNOR_LDADD)
 
 test_vpnor_create_read_window_partition_exists_SOURCES = \
-	$(TEST_MBOX_VPNOR_SRCS) $(TEST_MOCK_SRCS) \
-	mboxd_msg.c \
-	mboxd_windows.c \
-	mboxd_lpc.c \
-	mboxd_lpc_virtual.cpp \
-	mboxd_pnor_partition_table.cpp \
-	mboxd_flash_virtual.cpp \
-	pnor_partition.cpp \
+	$(TEST_MOCK_SRCS) \
+	$(TEST_MBOX_VPNOR_INTEG_SRCS) \
 	%reldir%/create_read_window_partition_exists.cpp
 test_vpnor_create_read_window_partition_exists_LDFLAGS = $(OESDK_TESTCASE_FLAGS)
 test_vpnor_create_read_window_partition_exists_LDADD = $(VPNOR_LDADD)
 
 test_vpnor_write_patch_SOURCES = \
 	$(TEST_MBOX_VPNOR_SRCS) \
-	mboxd_pnor_partition_table.cpp \
-	mboxd_flash_virtual.cpp \
 	mtd.c \
-	pnor_partition.cpp \
+	vpnor/mboxd_pnor_partition_table.cpp \
+	vpnor/mboxd_flash.cpp \
+	vpnor/pnor_partition.cpp \
 	%reldir%/write_patch.cpp
 test_vpnor_write_patch_LDFLAGS = $(OESDK_TESTCASE_FLAGS)
 test_vpnor_write_patch_LDADD = $(VPNOR_LDADD)
 
 test_vpnor_write_prsv_SOURCES = \
 	$(TEST_MBOX_VPNOR_SRCS) \
-	mboxd_pnor_partition_table.cpp \
-	mboxd_flash_virtual.cpp \
 	mtd.c \
-	pnor_partition.cpp \
+	vpnor/mboxd_pnor_partition_table.cpp \
+	vpnor/mboxd_flash.cpp \
+	vpnor/pnor_partition.cpp \
 	%reldir%/write_prsv.cpp
 test_vpnor_write_prsv_LDFLAGS = $(OESDK_TESTCASE_FLAGS)
 test_vpnor_write_prsv_LDADD = $(VPNOR_LDADD)
 
 test_vpnor_write_ro_SOURCES = \
 	$(TEST_MBOX_VPNOR_SRCS) \
-	mboxd_pnor_partition_table.cpp \
-	mboxd_flash_virtual.cpp \
 	mtd.c \
-	pnor_partition.cpp \
+	vpnor/mboxd_pnor_partition_table.cpp \
+	vpnor/mboxd_flash.cpp \
+	vpnor/pnor_partition.cpp \
 	%reldir%/write_ro.cpp
 test_vpnor_write_ro_LDFLAGS = $(OESDK_TESTCASE_FLAGS)
 test_vpnor_write_ro_LDADD = $(VPNOR_LDADD)
 
 test_vpnor_write_rw_SOURCES = \
 	$(TEST_MBOX_VPNOR_SRCS) \
-	mboxd_pnor_partition_table.cpp \
-	mboxd_flash_virtual.cpp \
 	mtd.c \
-	pnor_partition.cpp \
+	vpnor/mboxd_pnor_partition_table.cpp \
+	vpnor/mboxd_flash.cpp \
+	vpnor/pnor_partition.cpp \
 	%reldir%/write_rw.cpp
 test_vpnor_write_rw_LDFLAGS = $(OESDK_TESTCASE_FLAGS)
 test_vpnor_write_rw_LDADD = $(VPNOR_LDADD)
 
 test_vpnor_toc_no_name_SOURCES = \
 	common.c \
-	pnor_partition_table.cpp \
+	vpnor/pnor_partition_table.cpp \
 	%reldir%/toc_no_name.cpp
 test_vpnor_toc_no_name_LDFLAGS = $(OESDK_TESTCASE_FLAGS)
 test_vpnor_toc_no_name_LDADD = $(VPNOR_LDADD)
 
 test_vpnor_toc_start_gt_end_SOURCES = \
 	common.c \
-	pnor_partition_table.cpp \
+	vpnor/pnor_partition_table.cpp \
 	%reldir%/toc_start_gt_end.cpp
 test_vpnor_toc_start_gt_end_LDFLAGS = $(OESDK_TESTCASE_FLAGS)
 test_vpnor_toc_start_gt_end_LDADD = $(VPNOR_LDADD)
 
 test_vpnor_toc_no_start_SOURCES = \
 	common.c \
-	pnor_partition_table.cpp \
+	vpnor/pnor_partition_table.cpp \
 	%reldir%/toc_no_start.cpp
 test_vpnor_toc_no_start_LDFLAGS = $(OESDK_TESTCASE_FLAGS)
 test_vpnor_toc_no_start_LDADD = $(VPNOR_LDADD)
 
 test_vpnor_toc_no_end_SOURCES = \
 	common.c \
-	pnor_partition_table.cpp \
+	vpnor/pnor_partition_table.cpp \
 	%reldir%/toc_no_end.cpp
 test_vpnor_toc_no_end_LDFLAGS = $(OESDK_TESTCASE_FLAGS)
 test_vpnor_toc_no_end_LDADD = $(VPNOR_LDADD)
 
 test_vpnor_toc_no_version_SOURCES = \
 	common.c \
-	pnor_partition_table.cpp \
+	vpnor/pnor_partition_table.cpp \
 	%reldir%/toc_no_version.cpp
 test_vpnor_toc_no_version_LDFLAGS = $(OESDK_TESTCASE_FLAGS)
 test_vpnor_toc_no_version_LDADD = $(VPNOR_LDADD)
 
 test_vpnor_toc_flags_SOURCES = \
 	common.c \
-	pnor_partition_table.cpp \
+	vpnor/pnor_partition_table.cpp \
 	%reldir%/toc_flags.cpp
 test_vpnor_toc_flags_LDFLAGS = $(OESDK_TESTCASE_FLAGS)
 test_vpnor_toc_flags_LDADD = $(VPNOR_LDADD)
 
 test_vpnor_toc_overlap_SOURCES = \
 	$(TEST_MOCK_SRCS) \
-	mboxd_msg.c \
-	mboxd_windows.c \
-	mboxd_lpc.c \
-	mboxd_lpc_virtual.cpp \
-	mboxd_pnor_partition_table.cpp \
-	mboxd_flash_virtual.cpp \
-	pnor_partition.cpp \
-	common.c \
-	pnor_partition_table.cpp \
+	$(TEST_MBOX_VPNOR_INTEG_SRCS) \
 	%reldir%/toc_overlap.cpp
 test_vpnor_toc_overlap_LDFLAGS = $(OESDK_TESTCASE_FLAGS)
 test_vpnor_toc_overlap_LDADD = $(VPNOR_LDADD)
 
 test_vpnor_toc_lookup_found_SOURCES = \
 	$(TEST_MOCK_SRCS) \
-	mboxd_msg.c \
-	mboxd_windows.c \
-	mboxd_lpc.c \
-	mboxd_lpc_virtual.cpp \
-	mboxd_pnor_partition_table.cpp \
-	mboxd_flash_virtual.cpp \
-	pnor_partition.cpp \
-	common.c \
-	pnor_partition_table.cpp \
+	$(TEST_MBOX_VPNOR_INTEG_SRCS) \
 	%reldir%/toc_lookup_found.cpp
 test_vpnor_toc_lookup_found_LDFLAGS = $(OESDK_TESTCASE_FLAGS)
 test_vpnor_toc_lookup_found_LDADD = $(VPNOR_LDADD)
 
 test_vpnor_toc_lookup_failed_SOURCES = \
 	$(TEST_MOCK_SRCS) \
-	mboxd_msg.c \
-	mboxd_windows.c \
-	mboxd_lpc.c \
-	mboxd_lpc_virtual.cpp \
-	mboxd_pnor_partition_table.cpp \
-	mboxd_flash_virtual.cpp \
-	pnor_partition.cpp \
-	common.c \
-	pnor_partition_table.cpp \
+	$(TEST_MBOX_VPNOR_INTEG_SRCS) \
 	%reldir%/toc_lookup_failed.cpp
 test_vpnor_toc_lookup_failed_LDFLAGS = $(OESDK_TESTCASE_FLAGS)
 test_vpnor_toc_lookup_failed_LDADD = $(VPNOR_LDADD)
 
 test_vpnor_toc_missing_file_SOURCES = \
 	$(TEST_MOCK_SRCS) \
-	mboxd_msg.c \
-	mboxd_windows.c \
-	mboxd_lpc.c \
-	mboxd_lpc_virtual.cpp \
-	mboxd_pnor_partition_table.cpp \
-	mboxd_flash_virtual.cpp \
-	pnor_partition.cpp \
-	common.c \
-	pnor_partition_table.cpp \
+	$(TEST_MBOX_VPNOR_INTEG_SRCS) \
 	%reldir%/toc_missing_file.cpp
 test_vpnor_toc_missing_file_LDFLAGS = $(OESDK_TESTCASE_FLAGS)
 test_vpnor_toc_missing_file_LDADD = $(VPNOR_LDADD)
 
 test_vpnor_create_read_window_oob_SOURCES = \
-	$(TEST_MBOX_VPNOR_SRCS) $(TEST_MOCK_SRCS) \
-	mboxd_msg.c \
-	mboxd_windows.c \
-	mboxd_lpc.c \
-	mboxd_lpc_virtual.cpp \
-	mboxd_pnor_partition_table.cpp \
-	mboxd_flash_virtual.cpp \
-	pnor_partition.cpp \
+	$(TEST_MOCK_SRCS) \
+	$(TEST_MBOX_VPNOR_INTEG_SRCS) \
 	%reldir%/create_read_window_oob.cpp
 test_vpnor_create_read_window_oob_LDFLAGS = $(OESDK_TESTCASE_FLAGS)
 test_vpnor_create_read_window_oob_LDADD = $(VPNOR_LDADD)
 
 test_vpnor_create_read_window_toc_SOURCES = \
-	$(TEST_MBOX_VPNOR_SRCS) $(TEST_MOCK_SRCS) \
-	mboxd_msg.c \
-	mboxd_windows.c \
-	mboxd_lpc.c \
-	mboxd_lpc_virtual.cpp \
-	mboxd_pnor_partition_table.cpp \
-	mboxd_flash_virtual.cpp \
-	pnor_partition.cpp \
+	$(TEST_MOCK_SRCS) \
+	$(TEST_MBOX_VPNOR_INTEG_SRCS) \
 	%reldir%/create_read_window_toc.cpp
 test_vpnor_create_read_window_toc_LDFLAGS = $(OESDK_TESTCASE_FLAGS)
 test_vpnor_create_read_window_toc_LDADD = $(VPNOR_LDADD)
 
 test_vpnor_create_read_window_straddle_partitions_SOURCES = \
-	$(TEST_MBOX_VPNOR_SRCS) $(TEST_MOCK_SRCS) \
-	mboxd_msg.c \
-	mboxd_windows.c \
-	mboxd_lpc.c \
-	mboxd_lpc_virtual.cpp \
-	mboxd_pnor_partition_table.cpp \
-	mboxd_flash_virtual.cpp \
-	pnor_partition.cpp \
+	$(TEST_MOCK_SRCS) \
+	$(TEST_MBOX_VPNOR_INTEG_SRCS) \
 	%reldir%/create_read_window_straddle_partitions.cpp
 test_vpnor_create_read_window_straddle_partitions_LDFLAGS = $(OESDK_TESTCASE_FLAGS)
 test_vpnor_create_read_window_straddle_partitions_LDADD = $(VPNOR_LDADD)
 
 test_vpnor_create_read_window_partition_invalid_SOURCES = \
-	$(TEST_MBOX_VPNOR_SRCS) $(TEST_MOCK_SRCS) \
-	mboxd_msg.c \
-	mboxd_windows.c \
-	mboxd_lpc.c \
-	mboxd_lpc_virtual.cpp \
-	mboxd_pnor_partition_table.cpp \
-	mboxd_flash_virtual.cpp \
-	pnor_partition.cpp \
+	$(TEST_MOCK_SRCS) \
+	$(TEST_MBOX_VPNOR_INTEG_SRCS) \
 	%reldir%/create_read_window_partition_invalid.cpp
 test_vpnor_create_read_window_partition_invalid_LDFLAGS = $(OESDK_TESTCASE_FLAGS)
 test_vpnor_create_read_window_partition_invalid_LDADD = $(VPNOR_LDADD)
 
 test_vpnor_read_patch_SOURCES = \
-	$(TEST_MBOX_VPNOR_SRCS) $(TEST_MOCK_SRCS) \
-	mboxd_msg.c \
-	mboxd_windows.c \
-	mboxd_lpc.c \
-	mboxd_lpc_virtual.cpp \
-	mboxd_pnor_partition_table.cpp \
-	mboxd_flash_virtual.cpp \
-	pnor_partition.cpp \
+	$(TEST_MOCK_SRCS) \
+	$(TEST_MBOX_VPNOR_INTEG_SRCS) \
 	%reldir%/read_patch.cpp
 test_vpnor_read_patch_LDFLAGS = $(OESDK_TESTCASE_FLAGS)
 test_vpnor_read_patch_LDADD = $(VPNOR_LDADD)
 
 test_vpnor_write_patch_resize_SOURCES = \
 	$(TEST_MBOX_VPNOR_SRCS) \
-	mboxd_pnor_partition_table.cpp \
-	mboxd_flash_virtual.cpp \
 	mtd.c \
-	pnor_partition.cpp \
+	vpnor/mboxd_pnor_partition_table.cpp \
+	vpnor/mboxd_flash.cpp \
+	vpnor/pnor_partition.cpp \
 	%reldir%/write_patch_resize.cpp
 test_vpnor_write_patch_resize_LDFLAGS = $(OESDK_TESTCASE_FLAGS)
 test_vpnor_write_patch_resize_LDADD = $(VPNOR_LDADD)
 
 test_vpnor_dump_flash_SOURCES = \
-	$(TEST_MBOX_VPNOR_SRCS) $(TEST_MOCK_SRCS) \
-	mboxd_msg.c \
-	mboxd_windows.c \
-	mboxd_lpc.c \
-	mboxd_lpc_virtual.cpp \
-	mboxd_pnor_partition_table.cpp \
-	mboxd_flash_virtual.cpp \
-	pnor_partition.cpp \
+	$(TEST_MOCK_SRCS) \
+	$(TEST_MBOX_VPNOR_INTEG_SRCS) \
 	%reldir%/dump_flash.cpp
 test_vpnor_dump_flash_LDFLAGS = $(OESDK_TESTCASE_FLAGS)
 test_vpnor_dump_flash_LDADD = $(VPNOR_LDADD)
 
 test_vpnor_create_read_window_size_SOURCES = \
-	$(TEST_MBOX_VPNOR_SRCS) $(TEST_MOCK_SRCS) \
-	mboxd_msg.c \
-	mboxd_windows.c \
-	mboxd_lpc.c \
-	mboxd_lpc_virtual.cpp \
-	mboxd_pnor_partition_table.cpp \
-	mboxd_flash_virtual.cpp \
-	pnor_partition.cpp \
+	$(TEST_MOCK_SRCS) \
+	$(TEST_MBOX_VPNOR_INTEG_SRCS) \
 	%reldir%/create_read_window_size.cpp
 test_vpnor_create_read_window_size_LDFLAGS = $(OESDK_TESTCASE_FLAGS)
 test_vpnor_create_read_window_size_LDADD = $(VPNOR_LDADD)
 
 test_vpnor_create_read_window_remap_SOURCES = \
-	$(TEST_MBOX_VPNOR_SRCS) $(TEST_MOCK_SRCS) \
-	mboxd_msg.c \
-	mboxd_windows.c \
-	mboxd_lpc.c \
-	mboxd_lpc_virtual.cpp \
-	mboxd_pnor_partition_table.cpp \
-	mboxd_flash_virtual.cpp \
-	pnor_partition.cpp \
+	$(TEST_MOCK_SRCS) \
+	$(TEST_MBOX_VPNOR_INTEG_SRCS) \
 	%reldir%/create_read_window_remap.cpp
 test_vpnor_create_read_window_remap_LDFLAGS = $(OESDK_TESTCASE_FLAGS)
 test_vpnor_create_read_window_remap_LDADD = $(VPNOR_LDADD)
 
 test_vpnor_create_write_window_ro_partition_SOURCES = \
-	$(TEST_MBOX_VPNOR_SRCS) $(TEST_MOCK_SRCS) \
-	mboxd_msg.c \
-	mboxd_windows.c \
-	mboxd_lpc.c \
-	mboxd_lpc_virtual.cpp \
-	mboxd_pnor_partition_table.cpp \
-	mboxd_flash_virtual.cpp \
-	pnor_partition.cpp \
+	$(TEST_MOCK_SRCS) \
+	$(TEST_MBOX_VPNOR_INTEG_SRCS) \
 	%reldir%/create_write_window_ro_partition.cpp
 test_vpnor_create_write_window_ro_partition_LDFLAGS = $(OESDK_TESTCASE_FLAGS)
 test_vpnor_create_write_window_ro_partition_LDADD = $(VPNOR_LDADD)
 
 test_vpnor_create_write_window_rw_partition_SOURCES = \
-	$(TEST_MBOX_VPNOR_SRCS) $(TEST_MOCK_SRCS) \
-	mboxd_msg.c \
-	mboxd_windows.c \
-	mboxd_lpc.c \
-	mboxd_lpc_virtual.cpp \
-	mboxd_pnor_partition_table.cpp \
-	mboxd_flash_virtual.cpp \
-	pnor_partition.cpp \
+	$(TEST_MOCK_SRCS) \
+	$(TEST_MBOX_VPNOR_INTEG_SRCS) \
 	%reldir%/create_write_window_rw_partition.cpp
 test_vpnor_create_write_window_rw_partition_LDFLAGS = $(OESDK_TESTCASE_FLAGS)
 test_vpnor_create_write_window_rw_partition_LDADD = $(VPNOR_LDADD)
 
 test_vpnor_create_write_window_unmapped_SOURCES = \
-	$(TEST_MBOX_VPNOR_SRCS) $(TEST_MOCK_SRCS) \
-	mboxd_msg.c \
-	mboxd_windows.c \
-	mboxd_lpc.c \
-	mboxd_lpc_virtual.cpp \
-	mboxd_pnor_partition_table.cpp \
-	mboxd_flash_virtual.cpp \
-	pnor_partition.cpp \
+	$(TEST_MOCK_SRCS) \
+	$(TEST_MBOX_VPNOR_INTEG_SRCS) \
 	%reldir%/create_write_window_unmapped.cpp
 test_vpnor_create_write_window_unmapped_LDFLAGS = $(OESDK_TESTCASE_FLAGS)
 test_vpnor_create_write_window_unmapped_LDADD = $(VPNOR_LDADD)
diff --git a/test/vpnor/create_pnor_partition_table.cpp b/test/vpnor/create_pnor_partition_table.cpp
index 761b5cd..1c664f9 100644
--- a/test/vpnor/create_pnor_partition_table.cpp
+++ b/test/vpnor/create_pnor_partition_table.cpp
@@ -4,7 +4,7 @@
 #include <string.h>
 
 #include "config.h"
-#include "pnor_partition_table.hpp"
+#include "vpnor/pnor_partition_table.hpp"
 
 extern "C" {
 #include "test/mbox.h"
diff --git a/test/vpnor/create_read_window_oob.cpp b/test/vpnor/create_read_window_oob.cpp
index 8b2b0f4..e827b70 100644
--- a/test/vpnor/create_read_window_oob.cpp
+++ b/test/vpnor/create_read_window_oob.cpp
@@ -5,7 +5,7 @@
 #include <string.h>
 
 #include "config.h"
-#include "mboxd_pnor_partition_table.h"
+#include "vpnor/mboxd_pnor_partition_table.h"
 
 extern "C" {
 #include "test/mbox.h"
diff --git a/test/vpnor/create_read_window_partition_exists.cpp b/test/vpnor/create_read_window_partition_exists.cpp
index f0466c9..983435f 100644
--- a/test/vpnor/create_read_window_partition_exists.cpp
+++ b/test/vpnor/create_read_window_partition_exists.cpp
@@ -8,7 +8,7 @@
 #include <vector>
 
 #include "config.h"
-#include "mboxd_pnor_partition_table.h"
+#include "vpnor/mboxd_pnor_partition_table.h"
 
 extern "C" {
 #include "test/mbox.h"
diff --git a/test/vpnor/create_read_window_partition_invalid.cpp b/test/vpnor/create_read_window_partition_invalid.cpp
index cdd895b..796f90b 100644
--- a/test/vpnor/create_read_window_partition_invalid.cpp
+++ b/test/vpnor/create_read_window_partition_invalid.cpp
@@ -5,7 +5,7 @@
 #include <string.h>
 
 #include "config.h"
-#include "mboxd_pnor_partition_table.h"
+#include "vpnor/mboxd_pnor_partition_table.h"
 
 extern "C" {
 #include "test/mbox.h"
diff --git a/test/vpnor/create_read_window_remap.cpp b/test/vpnor/create_read_window_remap.cpp
index 97e0abc..dc3bb00 100644
--- a/test/vpnor/create_read_window_remap.cpp
+++ b/test/vpnor/create_read_window_remap.cpp
@@ -8,7 +8,7 @@
 #include <vector>
 
 #include "config.h"
-#include "mboxd_pnor_partition_table.h"
+#include "vpnor/mboxd_pnor_partition_table.h"
 
 extern "C" {
 #include "test/mbox.h"
diff --git a/test/vpnor/create_read_window_size.cpp b/test/vpnor/create_read_window_size.cpp
index cfbb881..eb19299 100644
--- a/test/vpnor/create_read_window_size.cpp
+++ b/test/vpnor/create_read_window_size.cpp
@@ -5,7 +5,7 @@
 #include <experimental/filesystem>
 
 #include "config.h"
-#include "mboxd_pnor_partition_table.h"
+#include "vpnor/mboxd_pnor_partition_table.h"
 
 extern "C" {
 #include "test/mbox.h"
diff --git a/test/vpnor/create_read_window_straddle_partitions.cpp b/test/vpnor/create_read_window_straddle_partitions.cpp
index 67149fa..48b6414 100644
--- a/test/vpnor/create_read_window_straddle_partitions.cpp
+++ b/test/vpnor/create_read_window_straddle_partitions.cpp
@@ -6,7 +6,7 @@
 #include <assert.h>
 #include <string.h>
 
-#include "mboxd_pnor_partition_table.h"
+#include "vpnor/mboxd_pnor_partition_table.h"
 
 extern "C" {
 #include "test/mbox.h"
diff --git a/test/vpnor/create_read_window_toc.cpp b/test/vpnor/create_read_window_toc.cpp
index 1f68371..b663032 100644
--- a/test/vpnor/create_read_window_toc.cpp
+++ b/test/vpnor/create_read_window_toc.cpp
@@ -5,7 +5,7 @@
 #include <string.h>
 
 #include "config.h"
-#include "pnor_partition_table.hpp"
+#include "vpnor/pnor_partition_table.hpp"
 
 extern "C" {
 #include "test/mbox.h"
diff --git a/test/vpnor/create_write_window_ro_partition.cpp b/test/vpnor/create_write_window_ro_partition.cpp
index e09ac69..684cd39 100644
--- a/test/vpnor/create_write_window_ro_partition.cpp
+++ b/test/vpnor/create_write_window_ro_partition.cpp
@@ -4,7 +4,7 @@
 #include <assert.h>
 
 #include "config.h"
-#include "mboxd_pnor_partition_table.h"
+#include "vpnor/mboxd_pnor_partition_table.h"
 
 extern "C" {
 #include "test/mbox.h"
diff --git a/test/vpnor/create_write_window_rw_partition.cpp b/test/vpnor/create_write_window_rw_partition.cpp
index d205e22..38b0d7b 100644
--- a/test/vpnor/create_write_window_rw_partition.cpp
+++ b/test/vpnor/create_write_window_rw_partition.cpp
@@ -4,7 +4,7 @@
 #include <assert.h>
 
 #include "config.h"
-#include "mboxd_pnor_partition_table.h"
+#include "vpnor/mboxd_pnor_partition_table.h"
 
 extern "C" {
 #include "test/mbox.h"
diff --git a/test/vpnor/create_write_window_unmapped.cpp b/test/vpnor/create_write_window_unmapped.cpp
index b493fad..27dc931 100644
--- a/test/vpnor/create_write_window_unmapped.cpp
+++ b/test/vpnor/create_write_window_unmapped.cpp
@@ -4,7 +4,7 @@
 #include <assert.h>
 
 #include "config.h"
-#include "mboxd_pnor_partition_table.h"
+#include "vpnor/mboxd_pnor_partition_table.h"
 
 extern "C" {
 #include "test/mbox.h"
diff --git a/test/vpnor/dump_flash.cpp b/test/vpnor/dump_flash.cpp
index 8ee4b05..6757c90 100644
--- a/test/vpnor/dump_flash.cpp
+++ b/test/vpnor/dump_flash.cpp
@@ -6,7 +6,7 @@
 
 #include "config.h"
 #include "mboxd_msg.h"
-#include "mboxd_pnor_partition_table.h"
+#include "vpnor/mboxd_pnor_partition_table.h"
 
 extern "C" {
 #include "test/mbox.h"
diff --git a/test/vpnor/read_patch.cpp b/test/vpnor/read_patch.cpp
index 2a91b66..b1e6dbb 100644
--- a/test/vpnor/read_patch.cpp
+++ b/test/vpnor/read_patch.cpp
@@ -3,7 +3,7 @@
 
 #include "config.h"
 #include "common.h"
-#include "mboxd_pnor_partition_table.h"
+#include "vpnor/mboxd_pnor_partition_table.h"
 
 #include <assert.h>
 
diff --git a/test/vpnor/tmpd.hpp b/test/vpnor/tmpd.hpp
index 2ebb6c6..45260ca 100644
--- a/test/vpnor/tmpd.hpp
+++ b/test/vpnor/tmpd.hpp
@@ -9,7 +9,7 @@
 
 #include "config.h"
 #include "mbox.h"
-#include "pnor_partition_table.hpp"
+#include "vpnor/pnor_partition_table.hpp"
 
 namespace openpower
 {
diff --git a/test/vpnor/toc_flags.cpp b/test/vpnor/toc_flags.cpp
index 6e134e5..c30f7ad 100644
--- a/test/vpnor/toc_flags.cpp
+++ b/test/vpnor/toc_flags.cpp
@@ -5,8 +5,8 @@
 #include <assert.h>
 
 #include "common.h"
-#include "pnor_partition_defs.h"
-#include "pnor_partition_table.hpp"
+#include "vpnor/pnor_partition_defs.h"
+#include "vpnor/pnor_partition_table.hpp"
 
 static constexpr auto BLOCK_SIZE = 4 * 1024;
 static constexpr auto DATA_MASK = ((1 << 24) - 1);
diff --git a/test/vpnor/toc_lookup_failed.cpp b/test/vpnor/toc_lookup_failed.cpp
index 5230ab1..eb9be4c 100644
--- a/test/vpnor/toc_lookup_failed.cpp
+++ b/test/vpnor/toc_lookup_failed.cpp
@@ -4,7 +4,7 @@
 #include <string.h>
 
 #include "config.h"
-#include "pnor_partition_table.hpp"
+#include "vpnor/pnor_partition_table.hpp"
 #include "xyz/openbmc_project/Common/error.hpp"
 
 extern "C" {
diff --git a/test/vpnor/toc_lookup_found.cpp b/test/vpnor/toc_lookup_found.cpp
index fdc5a10..3d5dfd0 100644
--- a/test/vpnor/toc_lookup_found.cpp
+++ b/test/vpnor/toc_lookup_found.cpp
@@ -4,7 +4,7 @@
 #include <string.h>
 
 #include "config.h"
-#include "pnor_partition_table.hpp"
+#include "vpnor/pnor_partition_table.hpp"
 
 extern "C" {
 #include "test/mbox.h"
diff --git a/test/vpnor/toc_missing_file.cpp b/test/vpnor/toc_missing_file.cpp
index dd602bb..2b2b423 100644
--- a/test/vpnor/toc_missing_file.cpp
+++ b/test/vpnor/toc_missing_file.cpp
@@ -4,7 +4,7 @@
 #include <string.h>
 
 #include "config.h"
-#include "pnor_partition_table.hpp"
+#include "vpnor/pnor_partition_table.hpp"
 
 extern "C" {
 #include "test/mbox.h"
diff --git a/test/vpnor/toc_no_end.cpp b/test/vpnor/toc_no_end.cpp
index 0d90b91..f9c5187 100644
--- a/test/vpnor/toc_no_end.cpp
+++ b/test/vpnor/toc_no_end.cpp
@@ -4,7 +4,7 @@
 #include "config.h"
 #include <assert.h>
 
-#include "pnor_partition_table.hpp"
+#include "vpnor/pnor_partition_table.hpp"
 
 static constexpr auto BLOCK_SIZE = 4 * 1024;
 
diff --git a/test/vpnor/toc_no_name.cpp b/test/vpnor/toc_no_name.cpp
index 06dea8c..d62056f 100644
--- a/test/vpnor/toc_no_name.cpp
+++ b/test/vpnor/toc_no_name.cpp
@@ -4,7 +4,7 @@
 #include "config.h"
 #include <assert.h>
 
-#include "pnor_partition_table.hpp"
+#include "vpnor/pnor_partition_table.hpp"
 
 static constexpr auto BLOCK_SIZE = 4 * 1024;
 
diff --git a/test/vpnor/toc_no_start.cpp b/test/vpnor/toc_no_start.cpp
index 0ef47a8..1d20a46 100644
--- a/test/vpnor/toc_no_start.cpp
+++ b/test/vpnor/toc_no_start.cpp
@@ -4,7 +4,7 @@
 #include "config.h"
 #include <assert.h>
 
-#include "pnor_partition_table.hpp"
+#include "vpnor/pnor_partition_table.hpp"
 
 static constexpr auto BLOCK_SIZE = 4 * 1024;
 
diff --git a/test/vpnor/toc_no_version.cpp b/test/vpnor/toc_no_version.cpp
index b607322..68cb057 100644
--- a/test/vpnor/toc_no_version.cpp
+++ b/test/vpnor/toc_no_version.cpp
@@ -4,7 +4,7 @@
 #include "config.h"
 #include <assert.h>
 
-#include "pnor_partition_table.hpp"
+#include "vpnor/pnor_partition_table.hpp"
 
 static constexpr auto BLOCK_SIZE = 4 * 1024;
 
diff --git a/test/vpnor/toc_overlap.cpp b/test/vpnor/toc_overlap.cpp
index 97748e2..c87ae54 100644
--- a/test/vpnor/toc_overlap.cpp
+++ b/test/vpnor/toc_overlap.cpp
@@ -4,7 +4,7 @@
 #include <string.h>
 
 #include "config.h"
-#include "pnor_partition_table.hpp"
+#include "vpnor/pnor_partition_table.hpp"
 
 extern "C" {
 #include "test/mbox.h"
diff --git a/test/vpnor/toc_start_gt_end.cpp b/test/vpnor/toc_start_gt_end.cpp
index c5c83ef..69edc63 100644
--- a/test/vpnor/toc_start_gt_end.cpp
+++ b/test/vpnor/toc_start_gt_end.cpp
@@ -4,7 +4,7 @@
 #include "config.h"
 #include <assert.h>
 
-#include "pnor_partition_table.hpp"
+#include "vpnor/pnor_partition_table.hpp"
 
 static constexpr auto BLOCK_SIZE = 4 * 1024;
 
diff --git a/vpnor/Makefile.am.include b/vpnor/Makefile.am.include
new file mode 100644
index 0000000..edb97b7
--- /dev/null
+++ b/vpnor/Makefile.am.include
@@ -0,0 +1,10 @@
+mboxd_SOURCES += %reldir%/pnor_partition_table.cpp \
+	%reldir%/mboxd_pnor_partition_table.cpp \
+	%reldir%/mboxd_flash.cpp \
+	%reldir%/pnor_partition.cpp \
+	%reldir%/mboxd_lpc_reset.cpp
+
+mboxd_LDFLAGS += -lstdc++fs \
+	$(SDBUSPLUS_LIBS) \
+	$(PHOSPHOR_LOGGING_LIBS) \
+	$(PHOSPHOR_DBUS_INTERFACES_LIBS)
diff --git a/mboxd_flash_virtual.cpp b/vpnor/mboxd_flash.cpp
similarity index 100%
rename from mboxd_flash_virtual.cpp
rename to vpnor/mboxd_flash.cpp
diff --git a/mboxd_lpc_virtual.cpp b/vpnor/mboxd_lpc_reset.cpp
similarity index 100%
rename from mboxd_lpc_virtual.cpp
rename to vpnor/mboxd_lpc_reset.cpp
diff --git a/mboxd_pnor_partition_table.cpp b/vpnor/mboxd_pnor_partition_table.cpp
similarity index 100%
rename from mboxd_pnor_partition_table.cpp
rename to vpnor/mboxd_pnor_partition_table.cpp
diff --git a/mboxd_pnor_partition_table.h b/vpnor/mboxd_pnor_partition_table.h
similarity index 100%
rename from mboxd_pnor_partition_table.h
rename to vpnor/mboxd_pnor_partition_table.h
diff --git a/pnor_partition.cpp b/vpnor/pnor_partition.cpp
similarity index 100%
rename from pnor_partition.cpp
rename to vpnor/pnor_partition.cpp
diff --git a/pnor_partition.hpp b/vpnor/pnor_partition.hpp
similarity index 100%
rename from pnor_partition.hpp
rename to vpnor/pnor_partition.hpp
diff --git a/pnor_partition_defs.h b/vpnor/pnor_partition_defs.h
similarity index 100%
rename from pnor_partition_defs.h
rename to vpnor/pnor_partition_defs.h
diff --git a/pnor_partition_table.cpp b/vpnor/pnor_partition_table.cpp
similarity index 100%
rename from pnor_partition_table.cpp
rename to vpnor/pnor_partition_table.cpp
diff --git a/pnor_partition_table.hpp b/vpnor/pnor_partition_table.hpp
similarity index 100%
rename from pnor_partition_table.hpp
rename to vpnor/pnor_partition_table.hpp