[parisc-linux-cvs] print_hwpath fixes and Diva support

Matthew Wilcox willy@ldl.fc.hp.com
Tue, 5 Feb 2002 12:56:04 -0700 (MST)


Index: arch/parisc/kernel/drivers.c
===================================================================
RCS file: /var/cvs/linux/arch/parisc/kernel/drivers.c,v
retrieving revision 1.39
diff -u -p -r1.39 drivers.c
--- arch/parisc/kernel/drivers.c	2002/02/04 19:29:43	1.39
+++ arch/parisc/kernel/drivers.c	2002/02/05 19:48:23
@@ -214,9 +214,8 @@ get_node_path(struct parisc_device *dev,
 	int i = 5;
 	path->mod = dev->hw_path;
 	memset(&path->bc, -1, 6);
-	while (dev != &root) {
+	for (dev = dev->parent; dev != &root; dev = dev->parent) {
 		path->bc[i--] = dev->hw_path;
-		dev = dev->parent;
 	}
 }
 
@@ -226,9 +225,9 @@ static char *print_hwpath(struct hardwar
 	for (i = 0; i < 6; i++) {
 		if (path->bc[i] == -1)
 			continue;
-		output += sprintf(output, "%d/", path->bc[i]);
+		output += sprintf(output, "%u/", (unsigned char) path->bc[i]);
 	}
-	output += sprintf(output, "%d", path->mod);
+	output += sprintf(output, "%u", (unsigned char) path->mod);
 	return output;
 }
 
Index: drivers/char/serial.c
===================================================================
RCS file: /var/cvs/linux/drivers/char/serial.c,v
retrieving revision 1.30
diff -u -p -r1.30 serial.c
--- drivers/char/serial.c	2002/01/03 22:36:57	1.30
+++ drivers/char/serial.c	2002/02/05 19:53:03
@@ -4222,6 +4222,33 @@ pci_timedia_fn(struct pci_dev *dev, stru
 	return 0;
 }
 
+/*
+ * HP's Remote Management Console.  The Diva chip came in several
+ * different versions.  N-class, L2000 and A500 have two Diva chips, each
+ * with 3 UARTs (the third UART on the second chip is unused).  Superdome
+ * and Keystone have one Diva chip with 3 UARTs.  Some later machines have
+ * one Diva chip, but it has been expanded to 5 UARTs.
+ */
+static int __devinit
+pci_hp_diva(struct pci_dev *dev, struct pci_board *board, int enable)
+{
+	if (!enable)
+		return 0;
+
+	switch (dev->subsystem_device) {
+	case 0x1049: /* Prelude Diva 1 */
+	case 0x1223: /* Superdome */
+	case 0x1226: /* Keystone */
+		board->num_ports = 3;
+		break;
+	case 0x104A: /* Prelude Diva 2 */
+		board->num_ports = 2;
+		break;
+	}
+
+	return 0;
+}
+
 static int __devinit
 pci_xircom_fn(struct pci_dev *dev, struct pci_board *board, int enable)
 {
@@ -4285,6 +4312,7 @@ enum pci_board_num_t {
 	pbn_timedia,
 	pbn_intel_i960,
 	pbn_sgi_ioc3,
+	pbn_hp_diva,
 #ifdef CONFIG_DDB5074
 	pbn_nec_nile4,
 #endif
@@ -4373,6 +4401,7 @@ static struct pci_board pci_boards[] __d
 		8<<2, 2, pci_inteli960ni_fn, 0x10000},
 	{ SPCI_FL_BASE0 | SPCI_FL_IRQRESOURCE,		   /* pbn_sgi_ioc3 */
 		1, 458333, 0, 0, 0, 0x20178 },
+	{ SPCI_FL_BASE0, 5, 115200, 8, 0, pci_hp_diva, 0},   /* pbn_hp_diva */
 #ifdef CONFIG_DDB5074
 	/*
 	 * NEC Vrc-5074 (Nile 4) builtin UART.
@@ -4872,10 +4901,10 @@ static struct pci_device_id serial_pci_t
 		0xFF00, 0, 0, 0,
 		pbn_sgi_ioc3 },
 
-	/* HP N class, Superdome */
+	/* HP Diva card */
 	{	PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_SAS,
 		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
-		pbn_b1_1_115200 },
+		pbn_hp_diva },
 
 #ifdef CONFIG_DDB5074
 	/*