palo v1.98 release, fixes console on rp34x0 machines
diff --git a/debian/changelog b/debian/changelog
index 40d5273..80751b0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+palo (1.98) unstable; urgency=medium
+
+  * Default to console=ttyS1 on rp34x0 machines
+
+ -- Helge Deller <deller@gmx.de>  Tue, 30 May 2017 13:12:20 -0700
+
 palo (1.97) unstable; urgency=medium
 
   * Enable support for cross-building of iplboot: (Closes: #851792)
diff --git a/ipl/ipl.c b/ipl/ipl.c
index b3eb68c..19111d8 100644
--- a/ipl/ipl.c
+++ b/ipl/ipl.c
@@ -410,6 +410,37 @@
     }
 }
 
+/*
+ * On some server models the serial port of the GSP/Management card which
+ * mirrors the console port shows up as ttyS1 instead of ttyS0.  This is due
+ * how the pci code in Linux kernel scans the PCI bus.  Check the relevant
+ * models and return ttyS1 for such machines.
+ * Beware: pdc_model_sysmodel() may return a machine name which has trailing
+ * spaces.
+ */
+static char *
+get_default_serial_console()
+{
+	char sys_model_name[81];
+	char *ttyS1_models[] = {
+		"9000/800/rp3410",
+		"9000/800/rp3420",
+		"9000/800/rp3440",
+		NULL
+	};
+
+	if (pdc_model_sysmodel(sys_model_name) == PDC_OK) {
+	   char **check = ttyS1_models;
+	   while (*check) {
+		if (strncmp(*check, sys_model_name, strlen(*check)) == 0)
+			return "ttyS1";
+		check++;
+	   }
+	}
+
+	return "ttyS0";
+}
+
 unsigned
 iplmain(int is_interactive, char *initialstackptr, int started_wide)
 {
@@ -523,7 +554,7 @@
             if(is_mux)
 	        chk_strcat(commandline, "ttyB0", CMDLINELEN, &ok);
             else
-	        chk_strcat(commandline, "ttyS0", CMDLINELEN, &ok);
+	        chk_strcat(commandline, get_default_serial_console(), CMDLINELEN, &ok);
 
 	    if (strstr(commandline, " TERM=") == 0)
 	        chk_strcat(commandline, " TERM=vt102", CMDLINELEN, &ok);
diff --git a/ipl/pdc_misc.c b/ipl/pdc_misc.c
index 863cc77..e14d1c1 100644
--- a/ipl/pdc_misc.c
+++ b/ipl/pdc_misc.c
@@ -229,6 +229,23 @@
 }
 
 int
+pdc_model_sysmodel(char *name)
+{
+    int r;
+
+    r = firmware_call(mem_pdc, PDC_MODEL, PDC_MODEL_SYSMODEL, pdc_result,
+				OS_ID_HPUX, name);
+    convert_from_wide(pdc_result);
+    if (r == PDC_OK) {
+		name[pdc_result[0]] = '\0'; /* add trailing '\0' */
+        } else {
+		name[0] = 0;
+        }
+
+    return r;
+}
+
+int
 pdc_cons_duplex()
 {
     return (PAGE0->mem_cons.cl_class == CL_DUPLEX);
diff --git a/iplboot b/iplboot
index 39accf5..7c39dff 100644
--- a/iplboot
+++ b/iplboot
Binary files differ
diff --git a/lib/common.h b/lib/common.h
index b1d34d6..225da0f 100644
--- a/lib/common.h
+++ b/lib/common.h
@@ -67,7 +67,7 @@
 #define __swab16(x)	bswap_16(x)
 #endif /* __swab16 */
 
-#define PALOVERSION "1.97"
+#define PALOVERSION "1.98"
 
 /* size of I/O block used in HP firmware */
 #define FW_BLOCKSIZE	2048
diff --git a/palo.spec b/palo.spec
index 871c675..ab77d2d 100644
--- a/palo.spec
+++ b/palo.spec
@@ -1,5 +1,5 @@
 Name:		palo
-Version:	1.97
+Version:	1.98
 Release:	1%{?dist}
 Summary:	PALO - PA-RISC Boot Loader
 Packager:	Helge Deller <deller@gmx.de>