[parisc-linux-cvs] Make EISA work on CCIO machines (2.4.17-pa8)

Matthew Wilcox willy@debian.org
Mon, 14 Jan 2002 07:41:18 +0000


On Sun, Jan 13, 2002 at 06:44:27PM +0000, Matthew Wilcox wrote:
> On reflection, and offline discussion with Grant, I now favour calling them:
> 
> "GSC Bus [8/]"
> and
> "GSC Bus [10/]"
> 
> and omitting the `Primary'/`Secondary' designations since it's not useful
> to distinguish whether this bus is programmed by the primary or secondary
> set of registers.

Here's an untested patch to do that.

 * Remove iodc element from struct ioc.  It never gets used.
 * Set ioc->name to either U2 or Uturn rather than "U2/Uturn".  Undoing an
   unplanned (and largely unnoticed) sideeffect of the parisc_device code.
 * Rename GSC Bus %d {Primary,Secondary} to GSC Bus [%d/]

Index: arch/parisc/kernel/ccio-dma.c
===================================================================
RCS file: /var/cvs/linux/arch/parisc/kernel/ccio-dma.c,v
retrieving revision 1.50
diff -u -p -r1.50 ccio-dma.c
--- arch/parisc/kernel/ccio-dma.c	2002/01/13 16:01:17	1.50
+++ arch/parisc/kernel/ccio-dma.c	2002/01/14 06:42:27
@@ -159,7 +159,6 @@ struct ioc {
 	u32 pdir_size; 			/* in bytes, determined by IOV Space size */
 	u32 chainid_shift; 		/* specify bit location of chain_id */
 	struct ioc *next;		/* Linked list of discovered iocs */
-	struct parisc_device_id *iodc;	/* data about dev from firmware */
 	const char *name;		/* device name from firmware */
 	unsigned int hw_path;           /* the hardware path this ioc is associatd with */
 	struct pci_dev *fake_pci_dev;   /* the fake pci_dev for non-pci devs */
@@ -1390,7 +1389,8 @@ ccio_ioc_init(struct ioc *ioc)
 	}
 }
 
-static int ccio_init_resource(struct resource *res, unsigned long ioaddr)
+static void
+ccio_init_resource(struct resource *res, char *name, unsigned long ioaddr)
 {
 	int result;
 
@@ -1398,32 +1398,26 @@ static int ccio_init_resource(struct res
 	res->start = (unsigned long)(signed) __raw_readl(ioaddr) << 16;
 	res->end = (unsigned long)(signed) (__raw_readl(ioaddr + 4) << 16) - 1;
 	if (res->end < res->start)
-		return 0;
+		return;
+	res->name = name;
 	result = request_resource(&iomem_resource, res);
 	if (result < 0) {
 		printk(KERN_ERR 
 		       "%s: failed to claim CCIO bus address space!\n", 
 		       __FILE__);
-		return 0;
 	}
-	return 1;
 }
 
 static void __init ccio_init_resources(struct ioc *ioc)
 {
 	struct resource *res = ioc->mmio_region;
-	if (ccio_init_resource(res, (unsigned long)&ioc->ioc_hpa->io_io_low)) {
-		char *name = kmalloc(17, GFP_KERNEL);
-		sprintf(name, "GSC Bus %d Primary", ioc_count);
-		res->name = name;
-	}
+	char *name = kmalloc(14, GFP_KERNEL);
 
-	res++;
-	if (ccio_init_resource(res, (unsigned long)&ioc->ioc_hpa->io_io_low_hv)) {
-		char *name = kmalloc(19, GFP_KERNEL);
-		sprintf(name, "GSC Bus %d Secondary", ioc_count);
-		res->name = name;
-	}
+	sprintf(name, "GSC Bus [%d/]", ioc->hw_path);
+
+	ccio_init_resource(res, name, (unsigned long)&ioc->ioc_hpa->io_io_low);
+	ccio_init_resource(res + 1, name,
+			(unsigned long)&ioc->ioc_hpa->io_io_low_hv);
 }
 
 #ifdef NASTY_HACK_FOR_K_CLASS
@@ -1468,17 +1462,16 @@ static int ccio_probe(struct parisc_devi
 		return 1;
 	}
 	memset(ioc, 0, sizeof(struct ioc));
+
+	ioc->name = dev->id.hversion == U2_IOA_RUNWAY ? "U2" : "UTurn";
 
-	printk(KERN_INFO MODULE_NAME " found %s at 0x%lx\n", 
-	       dev->id.hversion == U2_IOA_RUNWAY ? "U2" : "UTurn", dev->hpa);
+	printk(KERN_INFO "Found %s at 0x%lx\n", ioc->name, dev->hpa);
 
 	for (i = 0; i < ioc_count; i++) {
 		ioc_p = &(*ioc_p)->next;
 	}
 	*ioc_p = ioc;
 
-	ioc->iodc = &dev->id;
-	ioc->name = dev->name;
 	ioc->hw_path = dev->hw_path;
 	ioc->ioc_hpa = (struct ioa_registers *)dev->hpa;
 	ccio_ioc_init(ioc);

-- 
Revolutions do not require corporate support.