[parisc-linux-cvs] hpa should be unsigned long

Matthew Wilcox willy@ldl.fc.hp.com
Tue, 02 Oct 2001 15:03:10 -0600


Index: arch/parisc/kernel/drivers.c
===================================================================
RCS file: /home/cvs/parisc/linux/arch/parisc/kernel/drivers.c,v
retrieving revision 1.25
diff -u -p -r1.25 drivers.c
--- arch/parisc/kernel/drivers.c	2001/09/26 18:15:18	1.25
+++ arch/parisc/kernel/drivers.c	2001/10/02 16:48:53
@@ -194,15 +194,15 @@ struct parisc_device *alloc_pa_dev(unsig
 	}
 
 	if (num_devices >= MAX_DEVICES) {
-	    printk(KERN_ERR "%s: Too many devices.\n", __FUNCTION__ );
-	    write_unlock(&pa_lock);
-	    return NULL;
+		printk(KERN_ERR "%s: Too many devices.\n", __FUNCTION__ );
+		write_unlock(&pa_lock);
+		return NULL;
 	}
 	
 	dev = &pa_devices[num_devices];
 	memset(dev, 0, sizeof(*dev));
 	
-	status = pdc_iodc_read(&bytecnt, (void *)hpa, 0, &iodc_data, 32);
+	status = pdc_iodc_read(&bytecnt, hpa, 0, &iodc_data, 32);
 	if (status != PDC_RET_OK) {
 		/* There is no device here, so we'll skip it */
 		write_unlock(&pa_lock);
Index: arch/parisc/kernel/firmware.c
===================================================================
RCS file: /home/cvs/parisc/linux/arch/parisc/kernel/firmware.c,v
retrieving revision 1.29
diff -u -p -r1.29 firmware.c
--- arch/parisc/kernel/firmware.c	2001/08/14 16:54:52	1.29
+++ arch/parisc/kernel/firmware.c	2001/10/02 16:48:53
@@ -124,7 +124,7 @@ static void convert_to_wide(unsigned lon
  * This PDC call attempts to read from the specified address and verify
  * the address is valid.
  */
-int pdc_add_valid(void *address)
+int pdc_add_valid(unsigned long address)
 {
         int retval;
 
@@ -193,7 +193,7 @@ int pdc_coproc_cfg(struct pdc_coproc_cfg
  * This PDC call reads from the IODC of the module specified by the hpa
  * argument.
  */
-int pdc_iodc_read(unsigned long *actcnt, void *hpa, unsigned int index,
+int pdc_iodc_read(unsigned long *actcnt, unsigned long hpa, unsigned int index,
 		  void *iodc_data, unsigned int iodc_data_size)
 {
 	int retval;
@@ -231,7 +231,7 @@ int pdc_system_map_find_mods(struct pdc_
 	memcpy(mod_path, pdc_result2, sizeof(*mod_path));
 	spin_unlock_irq(&pdc_lock);
 
-	pdc_mod_info->mod_addr = (void *)f_extend((unsigned long)pdc_mod_info->mod_addr);
+	pdc_mod_info->mod_addr = f_extend(pdc_mod_info->mod_addr);
 	return retval;
 }
 
@@ -256,7 +256,7 @@ int pdc_system_map_find_addrs(struct pdc
 	memcpy(pdc_addr_info, pdc_result, sizeof(*pdc_addr_info));
 	spin_unlock_irq(&pdc_lock);
 
-	pdc_addr_info->mod_addr = (void *)f_extend((unsigned long)pdc_addr_info->mod_addr);
+	pdc_addr_info->mod_addr = f_extend(pdc_addr_info->mod_addr);
 	return retval;
 }
 
@@ -441,29 +441,26 @@ int pdc_mem_map_hpa(struct pdc_memory_ma
 /**
  * pdc_lan_station_id - Get the LAN address.
  * @lan_addr: The return buffer.
- * @net_hpa: The network device HPA.
+ * @hpa: The network device HPA.
  *
  * Get the LAN station address when it is not directly available from the LAN hardware.
  */
-int pdc_lan_station_id(char *lan_addr, void *net_hpa)
+int pdc_lan_station_id(char *lan_addr, unsigned long hpa)
 {
-        int retval;
-	unsigned int ret[2];
+	int retval;
 
-        spin_lock_irq(&pdc_lock);
-        retval = mem_pdc_call(PDC_LAN_STATION_ID, PDC_LAN_STATION_ID_READ,
-                              __pa(pdc_result), net_hpa);
-        if(retval < 0) {
-                /* FIXME: else read MAC from NVRAM */
-                memset(lan_addr, 0, PDC_LAN_STATION_ID_SIZE);
-        } else {
-		ret[0] = (unsigned int)pdc_result[0];
-		ret[1] = (unsigned int)pdc_result[1];
-		memcpy(lan_addr, ret, PDC_LAN_STATION_ID_SIZE);
-        }
-        spin_unlock_irq(&pdc_lock);
+	spin_lock_irq(&pdc_lock);
+	retval = mem_pdc_call(PDC_LAN_STATION_ID, PDC_LAN_STATION_ID_READ,
+			__pa(pdc_result), hpa);
+	if (retval < 0) {
+		/* FIXME: else read MAC from NVRAM */
+		memset(lan_addr, 0, PDC_LAN_STATION_ID_SIZE);
+	} else {
+		memcpy(lan_addr, pdc_result, PDC_LAN_STATION_ID_SIZE);
+	}
+	spin_unlock_irq(&pdc_lock);
 
-        return retval;
+	return retval;
 }
 
 /**
@@ -475,7 +472,7 @@ int pdc_lan_station_id(char *lan_addr, v
  * interrupt table.
  * Similar to PDC_PAT stuff - but added for Forte/Allegro boxes
  */ 
-int pdc_pci_irt_size(unsigned long *num_entries, void *hpa)
+int pdc_pci_irt_size(unsigned long *num_entries, unsigned long hpa)
 {
 	int retval;
 
@@ -498,7 +495,7 @@ int pdc_pci_irt_size(unsigned long *num_
  * Get the PCI interrupt routing table for the device at the given HPA.
  * Similar to PDC_PAT stuff - but added for Forte/Allegro boxes
  */
-int pdc_pci_irt(unsigned long num_entries, void *hpa, void *tbl)
+int pdc_pci_irt(unsigned long num_entries, unsigned long hpa, void *tbl)
 {
 	int retval;
 
@@ -598,7 +595,7 @@ int pdc_do_reset()
 }
 
 /**
- * iodc_iodc_putc - Console character print using IODC.
+ * pdc_iodc_putc - Console character print using IODC.
  * @c: the character to output.
  *
  * Note that only these special chars are architected for console IODC io:
Index: arch/parisc/kernel/iosapic.c
===================================================================
RCS file: /home/cvs/parisc/linux/arch/parisc/kernel/iosapic.c,v
retrieving revision 1.31
diff -u -p -r1.31 iosapic.c
--- arch/parisc/kernel/iosapic.c	2001/09/29 00:26:39	1.31
+++ arch/parisc/kernel/iosapic.c	2001/10/02 16:48:53
@@ -330,7 +330,7 @@ static int __init /* return number of en
 iosapic_load_irt(unsigned long cell_num, struct irt_entry **irt)
 {
 	long status;              /* PDC return value status */
-	struct irt_entry *table = NULL;  /* start of interrupt routing tbl */
+	struct irt_entry *table;  /* start of interrupt routing tbl */
 	unsigned long num_entries = 0UL;
 
 	ASSERT(NULL != irt);
@@ -360,52 +360,45 @@ iosapic_load_irt(unsigned long cell_num,
 		}
 
 		/* get PCI INT routing table */
-		status = pdc_pat_get_irt( (void *) table, cell_num);
+		status = pdc_pat_get_irt(table, cell_num);
 		DBG("pdc_pat_get_irt: %ld\n", status);
 		ASSERT(status == PDC_RET_OK);
+	} else {
+		/*
+		** C3000/J5000 (and similar) platforms with Sprockets PDC
+		** will return exactly one IRT for all iosapics.
+		** So if we have one, don't need to get it again.
+		*/
+		if (NULL != irt_cell)
+			return 0;
 
-		goto got_irt;
-	}
+		/* Should be using the Elroy's HPA, but it's ignored anyway */
+		status = pdc_pci_irt_size(&num_entries, 0);
+		DBG("pdc_pci_irt_size: %ld\n", status);
 
-	/*
-	** C3000/J5000 (and similar) platforms with "legacy" PDC
-	** will return exactly one IRT for all iosapics.
-	** So if we have one, don't need to get it again.
-	*/
-	if (NULL != irt_cell) {
-		return 0;
-	}
-
-	status = pdc_pci_irt_size(&num_entries,
-			/* elroy HPA (really a NOP) */ 0);
-	DBG("pdc_pci_irt_size: %ld\n", status);
+		if (PDC_RET_OK != status) {
+			/* Not a "legacy" system with I/O SAPIC either */
+			return 0;
+		}
 
-	if (PDC_RET_OK != status) {
-		/* Not a "legacy" system with I/O SAPIC either */
-		return 0;
-	}
+		ASSERT(0UL != num_entries);
 
-	ASSERT(0UL != num_entries);
+		table = IOSAPIC_KALLOC(struct irt_entry, num_entries);
+		if (table == NULL) {
+			printk(KERN_WARNING MODULE_NAME ": read_irt : can not alloc mem for IRT\n");
+			return 0;
+		}
 
-	table = IOSAPIC_KALLOC(struct irt_entry, num_entries);
-	if (table == NULL) {
-		printk(KERN_WARNING MODULE_NAME ": read_irt : can not alloc mem for IRT\n");
-		return 0;
+		/* HPA ignored by this call too. */
+		status = pdc_pci_irt(num_entries, 0, table);
+		ASSERT(PDC_RET_OK == status);
 	}
 
-	status = pdc_pci_irt(num_entries,
-			(void *) NULL, /* Elroy HPA - not used */
-			(void *) table);
-
-	ASSERT(PDC_RET_OK == status);
-
-got_irt:
-
 	/* return interrupt table address */
 	*irt = table;
 
 #ifdef DEBUG_IOSAPIC_IRT
-	{
+{
 	struct irt_entry *p = table;
 	int i;
 
@@ -415,8 +408,7 @@ got_irt:
 		num_entries,
 		(int) sizeof(struct irt_entry));
 
-	for (i = 0 ; i < num_entries ; i++, p++)
-	{
+	for (i = 0 ; i < num_entries ; i++, p++) {
 		printk(KERN_DEBUG MODULE_NAME " %02x %02x %02x %02x %02x %02x %02x %02x %08x%08x\n",
 		p->entry_type, p->entry_length, p->interrupt_type,
 		p->polarity_trigger, p->src_bus_irq_devno, p->src_bus_id,
@@ -424,8 +416,8 @@ got_irt:
 		((u32 *) p)[2],
 		((u32 *) p)[3]
 		);
-	}
 	}
+}
 #endif /* DEBUG_IOSAPIC_IRT */
 
 	return num_entries;
@@ -522,7 +514,7 @@ irt_find_irqline(struct iosapic_info *is
 		return i;
 	}
 
-	printk(KERN_WARNING MODULE_NAME ": 0x%p : no IRT entry for slot %d, pin %d\n",
+	printk(KERN_WARNING MODULE_NAME ": 0x%lx : no IRT entry for slot %d, pin %d\n",
 			isi->isi_hpa, slot, intr_pin);
 	return NULL;
 }
@@ -547,22 +539,18 @@ iosapic_xlate_pin(struct iosapic_info *i
 {
 	u8 intr_pin, intr_slot;
 
-	(void) pci_read_config_byte(pcidev, PCI_INTERRUPT_PIN, &intr_pin);
+	pci_read_config_byte(pcidev, PCI_INTERRUPT_PIN, &intr_pin);
 
 	DBG_IRT("iosapic_xlate_pin() SLOT %d pin %d\n",
 		PCI_SLOT(pcidev->devfn), intr_pin);
 
-	if (0 == intr_pin)
-	{
-		/*
-		** The device does NOT support/use IRQ lines.
-		*/
+	if (0 == intr_pin) {
+		/* The device does NOT support/use IRQ lines.  */
 		return NULL;
 	}
 
 	/* Check if pcidev behind a PPB */
-	if (NULL != pcidev->bus->self)
-	{
+	if (NULL != pcidev->bus->self) {
 		/* Convert pcidev INTR_PIN into something we
 		** can lookup in the IRT.
 		*/
@@ -577,7 +565,7 @@ iosapic_xlate_pin(struct iosapic_info *i
 		** or by some ambitous soul who wants to watch TV.
 		*/
 		if (pci_bridge_funcs->xlate_intr_line) {
-			intr_pin = (*pci_bridge_funcs->xlate_intr_line)(pcidev);
+			intr_pin = pci_bridge_funcs->xlate_intr_line(pcidev);
 		}
 #else	/* PCI_BRIDGE_FUNCS */
 		struct pci_bus *p = pcidev->bus;
@@ -675,7 +663,7 @@ iosapic_fixup_irq(void *isi_obj, struct 
 			 */
 
 			pcidev->irq = superio_irq;
-			return(superio_irq);
+			return superio_irq;
 		}
 	}
 #endif /* CONFIG_SUPERIO */
@@ -724,13 +712,11 @@ iosapic_fixup_irq(void *isi_obj, struct 
 						vi->vi_name, vi);
 	ASSERT(tmp == 0);
 
-	vi->vi_eoi_addr = ((void *) isi->isi_hpa) + IOSAPIC_REG_EOI;
+	vi->vi_eoi_addr = (u32 *) (isi->isi_hpa + IOSAPIC_REG_EOI);
 	vi->vi_eoi_data = cpu_to_le32(vi->vi_irqline);
 
 	ASSERT(NULL != isi->isi_region);
-	/*
-	** pcidev->irq still needs to be virtualized.
-	*/
+	/* pcidev->irq still needs to be virtualized.  */
 
 	return_irq = isi->isi_region->data.irqbase + isi_line;
 
@@ -746,7 +732,7 @@ iosapic_fixup_irq(void *isi_obj, struct 
 		PCI_SLOT(pcidev->devfn),
 	PCI_FUNC(pcidev->devfn), pcidev->vendor, pcidev->device, isi_line, return_irq);
 
-	return(return_irq);
+	return return_irq;
 }
 
 
@@ -772,7 +758,7 @@ iosapic_wr_irt_entry(struct vector_info 
 	struct iosapic_info *isp = vi->vi_ios;
 
 	ASSERT(NULL != isp);
-	ASSERT(NULL != isp->isi_hpa);
+	ASSERT(0 != isp->isi_hpa);
 	DBG_IRT("iosapic_wr_irt_entry(): irq %d hpa %p WINDOW %p  0x%x 0x%x\n",
 		vi->vi_irqline,
 		isp->isi_hpa, isp->isi_hpa+IOSAPIC_REG_WINDOW,
@@ -830,8 +816,7 @@ iosapic_set_irt_data( struct vector_info
 		** vi_txn_addr comes from cpu_data[x].txn_addr.
 		*/
 		*dp1 = (u32) (vi->vi_txn_addr);
-	} else
-	{
+	} else {
 		/* 
 		** eg if base_addr == 0xfffa0000),
 		**    we want to get 0xa0ff0000.
@@ -909,10 +894,10 @@ iosapic_enable_irq(void *dev, int irq)
 
 #ifdef DEBUG_IOSAPIC_IRT
 {
-u32 *t = (u32 *) ((ulong) vi->vi_eoi_addr & ~0xffUL);
-printk("iosapic_enable_irq(): regs %p", vi->vi_eoi_addr);
-while (t < vi->vi_eoi_addr) printk(" %x", READ_U32(t++));
-printk("\n");
+	u32 *t = (u32 *) ((ulong) vi->vi_eoi_addr & ~0xffUL);
+	printk("iosapic_enable_irq(): regs %p", vi->vi_eoi_addr);
+	while (t < vi->vi_eoi_addr) printk(" %x", READ_U32(t++));
+	printk("\n");
 }
 
 printk("iosapic_enable_irq(): sel ");
@@ -983,7 +968,7 @@ iosapic_rd_version(struct iosapic_info *
 
 /*
 ** iosapic_register() is called by "drivers" with an integrated I/O SAPIC.
-** Caller must be certain they have an I/O SAPIC and know it's MMIO address.
+** Caller must be certain they have an I/O SAPIC and know its MMIO address.
 **
 **	o allocate iosapic_info and add it to the list
 **	o read iosapic version and squirrel that away
@@ -1029,7 +1014,7 @@ iosapic_register(unsigned long hpa)
 
 	memset(isi, 0, sizeof(struct iosapic_info));
 
-	isi->isi_hpa         = (unsigned char *) hpa;
+	isi->isi_hpa         = hpa;
 	isi->isi_version     = iosapic_rd_version(isi);
 	isi->isi_num_vectors = IOSAPIC_IRDT_MAX_ENTRY(isi->isi_version) + 1;
 
@@ -1100,8 +1085,8 @@ iosapic_prt_isi(struct iosapic_info *isi
 {
 	ASSERT(NULL != isi);
 	printk(KERN_DEBUG MODULE_NAME ": io_sapic_info at %p\n", isi);
-	printk(KERN_DEBUG "\t\tisi_hpa: %p\n", isi->isi_hpa);
-	printk(KERN_DEBUG "\t\tisi_satus:     %x\n", isi->isi_status);
+	printk(KERN_DEBUG "\t\tisi_hpa:       %lx\n", isi->isi_hpa);
+	printk(KERN_DEBUG "\t\tisi_status:     %x\n", isi->isi_status);
 	printk(KERN_DEBUG "\t\tisi_version:   %x\n", isi->isi_version);
 	printk(KERN_DEBUG "\t\tisi_vector:    %p\n", isi->isi_vector);
 }
Index: arch/parisc/kernel/iosapic_private.h
===================================================================
RCS file: /home/cvs/parisc/linux/arch/parisc/kernel/iosapic_private.h,v
retrieving revision 1.2
diff -u -p -r1.2 iosapic_private.h
--- arch/parisc/kernel/iosapic_private.h	2000/12/08 07:40:38	1.2
+++ arch/parisc/kernel/iosapic_private.h	2001/10/02 16:48:53
@@ -122,7 +122,7 @@ struct vector_info {
 
 struct iosapic_info {
 	struct iosapic_info  *isi_next;      /* list of I/O SAPIC          */
-	volatile void        *isi_hpa;       /* physical base address      */
+	unsigned long	     isi_hpa;	     /* physical base address */
 	struct irq_region    *isi_region;    /* each I/O SAPIC is one region */
 	struct vector_info   *isi_vector;    /* IRdT (IRQ line) array  */
 	int                  isi_num_vectors; /* size of IRdT array */
Index: drivers/gsc/lasi.c
===================================================================
RCS file: /home/cvs/parisc/linux/drivers/gsc/lasi.c,v
retrieving revision 1.25
diff -u -p -r1.25 lasi.c
--- drivers/gsc/lasi.c	2001/08/14 16:54:54	1.25
+++ drivers/gsc/lasi.c	2001/10/02 16:48:53
@@ -64,13 +64,13 @@ lasi_find_irq(struct busdevice *lasi_dev
 static void __init
 lasi_init_irq(struct busdevice *this_lasi)
 {
-	char *lasi_base = (char *) this_lasi->hpa;
+	unsigned long lasi_base = this_lasi->hpa;
 
 	/* Stop LASI barking for a bit */
 	gsc_writel(0x00000000, lasi_base+OFFSET_IMR);
 
 	/* clear pending interrupts */
-	(volatile u32) gsc_readl(lasi_base+OFFSET_IRR);
+	gsc_readl(lasi_base+OFFSET_IRR);
 
 	/* We're not really convinced we want to reset the onboard
          * devices. Firmware does it for us...
@@ -89,6 +89,9 @@ lasi_init_irq(struct busdevice *this_las
 	** comatose and muzzled.  Devices will now unmask LASI
 	** interrupts as they are registered as irq's in the LASI range.
 	*/
+	/* XXX: I thought it was `awks that got `it on the `ead with an
+	 * `ammer.  -- willy
+	 */
 }
 
 
Index: include/asm-parisc/pdc.h
===================================================================
RCS file: /home/cvs/parisc/linux/include/asm-parisc/pdc.h,v
retrieving revision 1.31
diff -u -p -r1.31 pdc.h
--- include/asm-parisc/pdc.h	2001/06/20 14:16:11	1.31
+++ include/asm-parisc/pdc.h	2001/10/02 16:48:54
@@ -521,13 +501,13 @@ struct pdc_memory_table {       /* PDC_M
 #endif
 
 struct pdc_system_map_mod_info { /* PDC_SYSTEM_MAP/FIND_MODULE */
-	void * mod_addr;
+	unsigned long mod_addr;
 	unsigned long mod_pgs;
 	unsigned long add_addrs;
 };
 
 struct pdc_system_map_addr_info { /* PDC_SYSTEM_MAP/FIND_ADDRESS */
-	void * mod_addr;
+	unsigned long mod_addr;
 	unsigned long mod_pgs;
 };
 
@@ -542,8 +522,8 @@ struct pdc_module_path {
 	unsigned int layers[6]; /* device-specific info (ctlr #, unit # ...) */
 };
 
-#ifndef __LP64__
-/* Probably needs 64-bit porting -PB */
+#ifndef CONFIG_PA20
+/* Only used on some pre-PA2.0 boxes */
 struct pdc_memory_map {		/* PDC_MEMORY_MAP */
 	unsigned long hpa;	/* mod's register set address */
 	unsigned long more_pgs;	/* number of additional I/O pgs */
@@ -797,31 +777,29 @@ void setup_pdc(void);		/* in inventory.c
 
 /* wrapper-functions from pdc.c */
 
-int pdc_add_valid(void *address);
+int pdc_add_valid(unsigned long address);
 int pdc_chassis_info(struct pdc_chassis_info *chassis_info, void *led_info, unsigned long len);
 int pdc_coproc_cfg(struct pdc_coproc_cfg *pdc_coproc_info);
-int pdc_iodc_read(unsigned long *actcnt, void *hpa, unsigned int index,
+int pdc_iodc_read(unsigned long *actcnt, unsigned long hpa, unsigned int index,
 		  void *iodc_data, unsigned int iodc_data_size);
 int pdc_system_map_find_mods(struct pdc_system_map_mod_info *pdc_mod_info,
 			     struct pdc_module_path *mod_path, long mod_index);
 int pdc_system_map_find_addrs(struct pdc_system_map_addr_info *pdc_addr_info, 
 			      long mod_index, long addr_index);
 int pdc_model_info(struct pdc_model *model);
-int pdc_model_sysmodel(char  *name);
+int pdc_model_sysmodel(char *name);
 int pdc_model_cpuid(unsigned long *cpu_id);
 int pdc_model_versions(unsigned long *versions, int id);
 int pdc_model_capabilities(unsigned long *capabilities);
 int pdc_cache_info(struct pdc_cache_info *cache);
 #ifndef CONFIG_PA20
 int pdc_btlb_info(struct pdc_btlb_info *btlb);
-#endif
-#ifndef __LP64__
 int pdc_mem_map_hpa(struct pdc_memory_map *r_addr, struct pdc_module_path *mod_path);
 #endif
-int pdc_lan_station_id(char *lan_addr, void *net_hpa);
+int pdc_lan_station_id(char *lan_addr, unsigned long net_hpa);
 
-int pdc_pci_irt_size(unsigned long *num_entries, void *hpa);
-int pdc_pci_irt(unsigned long num_entries, void *hpa, void *tbl);
+int pdc_pci_irt_size(unsigned long *num_entries, unsigned long hpa);
+int pdc_pci_irt(unsigned long num_entries, unsigned long hpa, void *tbl);
 
 int pdc_tod_read(struct pdc_tod *tod);
 int pdc_tod_set(unsigned long sec, unsigned long usec);
@@ -889,4 +867,3 @@ extern void pdc_init(void);
 #endif /* __ASSEMBLY__ */
 
 #endif /* _PARISC_PDC_H */
-