usb-dbg: add meson option for enabling ME support

Add a meson option called me_support for enabling ME related feature.
Default value is true (enable)

Tested on Bletchley with me_support false

Signed-off-by: Potin Lai <potin.lai@quantatw.com>
Change-Id: I7e9f632b53c68b95f1d63f5408a9025f2a20fc3a
diff --git a/meson.build b/meson.build
index 9679cc5..4736ea0 100644
--- a/meson.build
+++ b/meson.build
@@ -47,6 +47,14 @@
     language : 'cpp')
 endif
 
+if get_option('me_support')
+  add_project_arguments(
+    cpp.get_supported_arguments([
+        '-DME_SUPPORT',
+    ]),
+    language : 'cpp')
+endif
+
 root_inc = include_directories('.', 'include')
 
 # Dependencies
diff --git a/meson_options.txt b/meson_options.txt
index 1887aa3..5c9d771 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -8,3 +8,8 @@
   'machine',
   type: 'string',
   description: 'Machine')
+option(
+  'me_support',
+  type : 'boolean',
+  value : true,
+  description: 'Enable ME support')
diff --git a/src/usb-dbg.cpp b/src/usb-dbg.cpp
index c030e4e..8b6c6e5 100644
--- a/src/usb-dbg.cpp
+++ b/src/usb-dbg.cpp
@@ -869,6 +869,7 @@
     return 0;
 }
 
+#ifdef ME_SUPPORT
 static int getMeStatus(std::string& status, size_t pos)
 {
     uint8_t cmd = 0x01;   // Get Device id command
@@ -918,6 +919,7 @@
 
     return 0;
 }
+#endif
 
 static int udbg_get_info_page(uint8_t, uint8_t page, uint8_t* next,
                               uint8_t* count, uint8_t* buffer)
@@ -1005,6 +1007,8 @@
                 frame_info.append("BIOS_FW_ver:", 0);
                 frame_info.append(biosVer.c_str(), 1);
             }
+
+#ifdef ME_SUPPORT
             // ME status
             std::string meStatus;
             if (getMeStatus(meStatus, pos) != 0)
@@ -1015,6 +1019,7 @@
             }
             frame_info.append("ME_status:", 0);
             frame_info.append(meStatus.c_str(), 1);
+#endif
         }
 
         /* TBD: Board ID needs implementation */