[parisc-linux-cvs] DIFF CONFIG_ cleanup

Grant Grundler grundler@puffin.external.hp.com
Wed, 17 Oct 2001 13:35:36 -0600


This diff is to cleanup CONFIG_SUPERIO and CONFIG_GSC_LASI.
Some of this is stuff willy started but didn't have
time to finish.  A few other misc stuff in there too.

Boots on A500 and c3k (32 and 64-bit).

I'll update the -pa## in the Makefile when I commit.

grant

Index: arch/parisc/kernel/iosapic.c
===================================================================
RCS file: /home/cvs/parisc/linux/arch/parisc/kernel/iosapic.c,v
retrieving revision 1.33
diff -u -p -r1.33 iosapic.c
--- iosapic.c	2001/10/05 17:02:32	1.33
+++ iosapic.c	2001/10/17 18:23:07
@@ -653,13 +653,11 @@ iosapic_fixup_irq(void *isi_obj, struct 
 		if (PCI_FUNC(pcidev->devfn) != SUPERIO_USB_FN) {
 
 			/*
-			 * Only the SuperIO USB controller has an irt
-			 * entry. So, for other functions we just return
-			 * here, and let the USB controller hookup
-			 * the rest of the interrupt routing when it
-			 * comes through. Note that interrupts for all
-			 * three functions actually come through the
-			 * PIC's on function 1!
+			 * SuperIO USB controller has an irt entry.
+			 * Only let the USB controller hookup the rest
+			 * of the interrupt routing when it comes through.
+			 * Note that interrupts for all three functions
+			 * actually come through the PIC's on function 1!
 			 */
 
 			pcidev->irq = superio_irq;
Index: arch/parisc/kernel/parisc_ksyms.c
===================================================================
RCS file: /home/cvs/parisc/linux/arch/parisc/kernel/parisc_ksyms.c,v
retrieving revision 1.27
diff -u -p -r1.27 parisc_ksyms.c
--- parisc_ksyms.c	2001/10/17 01:58:32	1.27
+++ parisc_ksyms.c	2001/10/17 18:23:07
@@ -83,7 +83,9 @@ EXPORT_SYMBOL(_gsc_writel);
 EXPORT_SYMBOL(_gsc_readb);
 EXPORT_SYMBOL(_gsc_readw);
 EXPORT_SYMBOL(_gsc_readl);
+#ifdef CONFIG_GSC_LASI
 EXPORT_SYMBOL(busdevice_alloc_irq);
+#endif
 EXPORT_SYMBOL(register_parisc_driver);
 EXPORT_SYMBOL(unregister_parisc_driver);
 EXPORT_SYMBOL(gsc_alloc_irq);
Index: arch/parisc/kernel/processor.c
===================================================================
RCS file: /home/cvs/parisc/linux/arch/parisc/kernel/processor.c,v
retrieving revision 1.3
diff -u -p -r1.3 processor.c
--- processor.c	2001/10/06 08:00:03	1.3
+++ processor.c	2001/10/17 18:23:07
@@ -312,7 +312,7 @@ int get_cpuinfo(char *buffer)
 			     loops_per_jiffy / (500000 / HZ),
 			     (loops_per_jiffy / (5000 / HZ)) % 100);
 
-		p += sprintf(p, "software id\t: %ld\n",
+		p += sprintf(p, "software id\t: %ld\n\n",
 				boot_cpu_data.pdc.model.sw_id);
 	}
 	return p - buffer;
Index: arch/parisc/kernel/superio.c
===================================================================
RCS file: /home/cvs/parisc/linux/arch/parisc/kernel/superio.c,v
retrieving revision 1.8
diff -u -p -r1.8 superio.c
--- superio.c	2001/09/06 09:44:07	1.8
+++ superio.c	2001/10/17 18:23:07
@@ -76,6 +76,9 @@ static struct superio_device sio_dev = {
 	iosapic_irq: -1
 };
 
+
+#undef DEBUG_INIT
+
 void
 superio_inform_irq(int irq)
 {
@@ -149,9 +152,9 @@ superio_interrupt(int irq, void *devp, s
 static void __devinit
 superio_init(struct superio_device *sio)
 {
-	u8  i;
-	u16 word;
 	struct pci_dev *pdev = sio->lio_pdev;
+	u16 word;
+	u8  i;
 
 	if (!pdev || sio->iosapic_irq == -1) {
 		printk(KERN_ERR "All SuperIO functions not found!\n");
@@ -159,7 +162,7 @@ superio_init(struct superio_device *sio)
 		return;
 	}
 
-	printk (KERN_INFO "SuperIO: Found NS87560 legacy I/O device at %s. iosapic irq = %i \n",
+	printk (KERN_INFO "SuperIO: Found NS87560 Legacy I/O device at %s (IRQ %i) \n",
 		pdev->slot_name,sio->iosapic_irq);
 
 	/* Find our I/O devices */
@@ -313,30 +316,36 @@ static struct irq_region_ops superio_irq
 	unmask_irq:	superio_unmask_irq
 };
 
+#ifdef DEBUG_INIT
 static unsigned short expected_device[3] = {
 	PCI_DEVICE_ID_NS_87415,
 	PCI_DEVICE_ID_NS_87560_LIO,
 	PCI_DEVICE_ID_NS_87560_USB
 };
+#endif
 
 extern int
 superio_fixup_irq(struct pci_dev *pcidev)
 {
-	int fn;
 	int local_irq;
-
-	/* Verify that the function number matches the expected device id. */
 
+#ifdef DEBUG_INIT
+	int fn;
 	fn = PCI_FUNC(pcidev->devfn);
+
+	/* Verify the function number matches the expected device id. */
 	if (expected_device[fn] != pcidev->device) {
 		BUG();
 		return -1;
 	}
+	printk("superio_fixup_irq(%s) ven 0x%x dev 0x%x from %p\n",
+		pcidev->slot_name,
+		pcidev->vendor, pcidev->device,
+		__builtin_return_address(0));
+#endif
 
 	if (!sio_dev.irq_region) {
-
 		/* Allocate an irq region for SuperIO devices */
-
 		sio_dev.irq_region = alloc_irq_region(SUPERIO_NIRQS,
 						&superio_irq_ops,
 						IRQ_REG_DIS|IRQ_REG_MASK,
@@ -353,15 +362,21 @@ superio_fixup_irq(struct pci_dev *pcidev
 	 * each legacy device as they are initialized.
 	 */
 
-	if (fn == SUPERIO_LIO_FN) {
+	switch(pcidev->device) {
+	case PCI_DEVICE_ID_NS_87415:		/* Function 0 */
+		local_irq = IDE_IRQ;
+		break;
+	case PCI_DEVICE_ID_NS_87560_LIO:	/* Function 1 */
 		sio_dev.lio_pdev = pcidev; /* save for later initialization */
 		return -1;
-	}
-
-	if (fn == SUPERIO_IDE_FN)
-		local_irq = IDE_IRQ;
-	else
+	case PCI_DEVICE_ID_NS_87560_USB:	/* Function 2 */
 		local_irq = USB_IRQ;
+		break;
+	default:
+		local_irq = -1;
+		BUG();
+		break;
+	}
 
 	return(sio_dev.irq_region->data.irqbase + local_irq);
 }
@@ -390,6 +405,7 @@ superio_serial_init(void)
 	serial->type = PORT_16550A;
 	serial->line = 0;
 	serial->port = sio_dev.sp1_base;
+	serial->port_high = 0;
 	serial->irq = sio_dev.irq_region->data.irqbase + SP1_IRQ;
 	serial->io_type = SERIAL_IO_PORT;
 	serial->flags = 0;
@@ -398,7 +414,6 @@ superio_serial_init(void)
 	serial->baud_base = 115200;
 
 	retval = register_serial(serial);
-
 	if (retval < 0) {
 		printk(KERN_WARNING "SuperIO: Register Serial #0 failed.\n");
 		kfree (serial);
@@ -410,6 +425,7 @@ superio_serial_init(void)
 	serial->type = PORT_16550A;
 	serial->line = 1;
 	serial->port = sio_dev.sp2_base;
+	serial->port_high = 0;
 	serial->irq = sio_dev.irq_region->data.irqbase + SP2_IRQ;
 	serial->io_type = SERIAL_IO_PORT;
 	serial->flags = 0;
@@ -458,3 +474,54 @@ superio_get_ide_irq(void)
 }
 
 EXPORT_SYMBOL(superio_get_ide_irq);
+
+static int __devinit superio_probe(struct pci_dev *dev, const struct pci_device_id *id)
+{
+#ifdef DEBUG_INIT
+	printk("superio_probe(%s) ven 0x%x dev 0x%x sv 0x%x sd 0x%x class 0x%x\n",
+		dev->slot_name,
+		dev->vendor, dev->device,
+		dev->subsystem_vendor, dev->subsystem_device,
+		dev->class);
+/*
+** superio_probe(00:0e.0) ven 0x100b dev 0x2 sv 0x0 sd 0x0 class 0x1018a
+** superio_probe(00:0e.1) ven 0x100b dev 0xe sv 0x0 sd 0x0 class 0x68000
+** superio_probe(00:0e.2) ven 0x100b dev 0x12 sv 0x0 sd 0x0 class 0xc0310
+*/
+#endif
+
+	/* superio_fixup_irq(dev); */
+
+	if (dev->device == PCI_DEVICE_ID_NS_87560_LIO) {
+#ifdef CONFIG_PARPORT_PC
+		superio_parport_init();
+#endif
+		/* Don't call superio_serial_init() - see rs_init() */
+		/* REVISIT : superio_fdc_init() ? */
+	}
+	return 0;
+}
+
+static struct pci_device_id superio_tbl[] __devinitdata = {
+	{ PCI_VENDOR_ID_NS, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
+	{ 0, }
+};
+
+static struct pci_driver superio_driver = {
+	name:		"SuperIO",
+	id_table:	superio_tbl,
+	probe:		superio_probe,
+};
+
+static int __init superio_modinit(void)
+{
+	return pci_module_init(&superio_driver);
+}
+
+static void __exit superio_exit(void)
+{
+	pci_unregister_driver(&superio_driver);
+}
+
+module_init(superio_modinit);
+module_exit(superio_exit);
Index: drivers/char/serial.c
===================================================================
RCS file: /home/cvs/parisc/linux/drivers/char/serial.c,v
retrieving revision 1.26
diff -u -p -r1.26 serial.c
--- serial.c	2001/08/24 04:56:05	1.26
+++ serial.c	2001/10/17 18:23:08
@@ -226,6 +226,10 @@ static char *serial_revdate = "2001-07-0
 #include <asm/gsc.h>
 #endif
 
+#ifdef CONFIG_SUPERIO
+#include <asm/superio.h>	/* for superio_serial_init() proto */
+#endif
+
 #ifdef CONFIG_MAC_SERIAL
 #define SERIAL_DEV_OFFSET	2
 #else
@@ -5496,6 +5500,9 @@ static int __init rs_init(void)
 	}
 #ifdef CONFIG_SERIAL_GSC
 	probe_serial_gsc();
+#endif
+#ifdef CONFIG_SUPERIO
+	superio_serial_init();
 #endif
 #ifdef ENABLE_SERIAL_PCI
 	probe_serial_pci();
Index: drivers/gsc/Makefile
===================================================================
RCS file: /home/cvs/parisc/linux/drivers/gsc/Makefile,v
retrieving revision 1.11
diff -u -p -r1.11 Makefile
--- Makefile	2001/10/10 20:10:12	1.11
+++ Makefile	2001/10/17 18:23:08
@@ -16,10 +16,11 @@ obj-m :=
 obj-n :=
 obj-  :=
 
+obj-$(CONFIG_SUPERIO) += busdevice.o
 obj-$(CONFIG_GSC_DINO) += busdevice.o dino.o
 obj-$(CONFIG_GSC_LASI) += busdevice.o lasi.o asp.o
 obj-$(CONFIG_GSC_WAX) += busdevice.o wax.o
-obj-$(CONFIG_SERIAL) += serial.o
+obj-$(CONFIG_SERIAL_GSC) += serial.o
 obj-$(CONFIG_EISA) += eisa.o
 
 include $(TOPDIR)/Rules.make
Index: drivers/gsc/serial.c
===================================================================
RCS file: /home/cvs/parisc/linux/drivers/gsc/serial.c,v
retrieving revision 1.21
diff -u -p -r1.21 serial.c
--- serial.c	2001/09/14 14:55:37	1.21
+++ serial.c	2001/10/17 18:23:08
@@ -29,9 +29,6 @@
 #include <asm/io.h>
 #include <asm/hardware.h>
 #include <asm/gsc.h>
-#ifdef CONFIG_SUPERIO
-#include <asm/superio.h>
-#endif
 
 #include "busdevice.h"
 
@@ -127,9 +124,6 @@ static struct parisc_driver serial_drive
 
 void __init probe_serial_gsc(void)
 {
-#ifdef CONFIG_SUPERIO
-	superio_serial_init();
-#endif
 	register_parisc_driver(&serial1_driver);
 	register_parisc_driver(&serial_driver);
 }
Index: drivers/parport/parport_gsc.c
===================================================================
RCS file: /home/cvs/parisc/linux/drivers/parport/parport_gsc.c,v
retrieving revision 1.16
diff -u -p -r1.16 parport_gsc.c
--- parport_gsc.c	2001/08/28 12:16:17	1.16
+++ parport_gsc.c	2001/10/17 18:23:08
@@ -477,20 +477,20 @@ static int __devinit parport_init_chip(s
 	port = dev->hpa + PARPORT_GSC_OFFSET;
 	
 	/* some older machines with ASP-chip don't support
-	 * the enhanced parport modes
+	 * the enhanced parport modes.
 	 */
-	if (boot_cpu_data.cpu_type > pcxt && !pdc_add_valid( (void *)(port+4))) {
-	    /* Initialize bidirectional-mode (0x10) & data-tranfer-mode #1 (0x20) */
-	    printk("%s: initialize bidirectional-mode.\n", __FUNCTION__);
-	    parport_writeb ( (0x10 + 0x20), port + 4);
+	if (boot_cpu_data.cpu_type > pcxt && valid_io_addr(port+4)) {
+		/* Initialize bidirectional-mode (0x10) & data-tranfer-mode #1 (0x20) */
+		printk("%s: initialize bidirectional-mode.\n", __FUNCTION__);
+		parport_writeb ( (0x10 + 0x20), port + 4);
+
 	} else {
-	    printk("%s: enhanced parport-modes not supported.\n", __FUNCTION__);
+		printk("%s: enhanced parport-modes not supported.\n", __FUNCTION__);
 	}
 	
-	if (parport_gsc_probe_port(port, 0, 
-		    irq, /* PARPORT_IRQ_NONE */
-		    PARPORT_DMA_NONE, NULL))
-	    parport_count++;
+	if (parport_gsc_probe_port(port, 0, irq,
+			/* PARPORT_IRQ_NONE */ PARPORT_DMA_NONE, NULL))
+		parport_count++;
 
 	return 0;
 }
@@ -510,12 +510,7 @@ static struct parisc_driver parport_driv
 
 int __devinit parport_gsc_init(void)
 {
-#if defined(CONFIG_SUPERIO) && defined(CONFIG_PARPORT_PC)
-	superio_parport_init();
-#endif
-	register_parisc_driver(&parport_driver);
-
-	return 0;
+	return register_parisc_driver(&parport_driver);
 }
 
 static void __devexit parport_gsc_exit(void)
Index: include/asm-parisc/superio.h
===================================================================
RCS file: /home/cvs/parisc/linux/include/asm-parisc/superio.h,v
retrieving revision 1.3
diff -u -p -r1.3 superio.h
--- superio.h	2001/07/15 20:02:07	1.3
+++ superio.h	2001/10/17 18:23:09
@@ -69,9 +69,8 @@ struct superio_device {
 	|| ((x)->device == PCI_DEVICE_ID_NS_87560_USB) ) )
 
 extern void superio_inform_irq(int irq);
-extern void superio_serial_init(void);
-extern void superio_parport_init(void);
-extern int superio_fixup_irq(struct pci_dev *pcidev);
+extern void superio_serial_init(void);		/* called by rs_init() */
+extern int superio_fixup_irq(struct pci_dev *pcidev); /* called by iosapic */
 extern int superio_get_ide_irq(void);
 
 #endif /* _PARISC_SUPERIO_H */