op-pdbg-host-control: Fix boot scripts for pdbg

The current scripts use ecmd-style bit ranges and call a "putcfam"
function/command that doesn't exist.

Use latest VCS fix and IPL start commands from Dean Sanner (including
scratch register 8 value), converted to pdbg masked read-modify-write
format.

Add optional argument to scripts for specifying pdbg's '-d' flag.

Scripts tested to boot a Zaius machine, but not tested with systemd
services for sequencing.

Partially resolves openbmc/openbmc#647.

Signed-off-by: Xo Wang <xow@google.com>
Change-Id: I87761d1454306ebf4ad597057d2160eae10dc8cb
diff --git a/common/recipes-phosphor/host/op-pdbg-host-control/start_host.sh b/common/recipes-phosphor/host/op-pdbg-host-control/start_host.sh
old mode 100644
new mode 100755
index c68c9ab..909cde0
--- a/common/recipes-phosphor/host/op-pdbg-host-control/start_host.sh
+++ b/common/recipes-phosphor/host/op-pdbg-host-control/start_host.sh
@@ -1,4 +1,14 @@
-#!/bin/sh
+#!/bin/sh -e
+# Starts POWER9 IPL (boot)
 
-# send putcfam command to have SBE start IPL
-putcfam pu 2801 0 1 1 -ib
+PDBG=${PDBG:-pdbg}
+# Argument [device]: if provided, pass to pdbg as "-d [device]"
+DEVICE_OPT=${1:+-d $1}
+
+putcfam()
+{
+    $PDBG -b fsi $DEVICE_OPT putcfam $1 $2 $3
+}
+
+putcfam 0x283f 0x20000000             # Write scratch register 8
+putcfam 0x2801 0x80000000 0x80000000  # Set SBE start bit to start IPL