meta-quanta: gbs: fix getting SATA/PE gpio present status

Add mapper wait for the GPIO present dbus to make sure we get
the SATA/PE GPIO Present status successfully

(From meta-quanta rev: ac35d89c6a02f67ae2b7a40aa014570f279f5426)

Signed-off-by: George Hung <george.hung@quantatw.com>
Change-Id: I67cfd417b6d4e7ee04dd0ef2b01a82fca63b5b92
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
diff --git a/meta-quanta/meta-gbs/recipes-gbs/gbs-sysinit/files/gbs-sysinit.sh b/meta-quanta/meta-gbs/recipes-gbs/gbs-sysinit/files/gbs-sysinit.sh
index 68adfed..d0453ec 100644
--- a/meta-quanta/meta-gbs/recipes-gbs/gbs-sysinit/files/gbs-sysinit.sh
+++ b/meta-quanta/meta-gbs/recipes-gbs/gbs-sysinit/files/gbs-sysinit.sh
@@ -116,11 +116,10 @@
 set_hdd_prsnt() {
   # On PVT need to forward SATA0_PRSNT_N to HDD_PRSNT_N
   # The signal is safe to set on DVT boards so just set universally.
+  mapper wait ${SATA0_PRESENT_OBJPATH}
   sata_prsnt_n="$(busctl get-property $SERVICE_NAME ${SATA0_PRESENT_OBJPATH} \
                  $INTERFACE_NAME Present)"
-  if [[ "$?" == "0" && ${sata_prsnt_n} == "b false" ]]; then
-    return 1
-  fi
+
   # sata_prsnt_n is active low => value "true" means low
   if [[ ${sata_prsnt_n} == "b true" ]]; then
     set_gpio_direction 'HDD_PRSNT_N' low
@@ -185,10 +184,11 @@
   pe_fruid=3
   for i in {1..2};
   do
+     mapper wait ${PE_PRESENT_OBJPATH[$(($i-1))]}
      pe_prsnt_n="$(busctl get-property $SERVICE_NAME ${PE_PRESENT_OBJPATH[$(($i-1))]} \
                   $INTERFACE_NAME Present)"
 
-     if [[ "$?" == "0" && ${pe_prsnt_n} == "b false" ]]; then
+     if [[ ${pe_prsnt_n} == "b false" ]]; then
          pe_fruid=$(($pe_fruid+1))
          continue
      fi
@@ -238,8 +238,6 @@
 
   check_board_sku
 
-  set_hdd_prsnt
-
   reset_phy
 
   if [[ $(check_power_status) != \
@@ -263,6 +261,7 @@
     echo "Host is already running, doing nothing!" >&2
   fi
 
+  set_hdd_prsnt
   parse_pe_fru
 }