[parisc-linux-cvs] DIFF 2.4.20-rc1-pa6 fix PCI-PCI Bridge + misc

Grant Grundler grundler@dsl2.external.hp.com
Sun, 17 Nov 2002 13:50:36 -0700


> Log message:
> 2.4.20-rc1-pa6 fix PCI-PCI bridge support plus other misc
> 
> o fix PCI-PCI bridge support in lba and parisc/pci.c
> o remove dma_mask mangling in pci_dma_supported() code path
> (thanks to Adam J. Richter for spotting this in 2.5.47)
> o restructure external interrupt handling in entry.S so I-bit is NOT enabled.
> o comment trap/I-bit bug in handle_interruption() - jsm said he would fix thi
>   s
> o fix detection of mediatable in tulip driver (zero length table).
> (ISTR this was for card-mode Dino)

BTW, this is only tested on SMP rp2470 (A500-65).
I'll be testing in the next couple of days on c3k as well.

grant

Index: Makefile
===================================================================
RCS file: /var/cvs/linux/Makefile,v
retrieving revision 1.365
diff -u -p -r1.365 Makefile
--- Makefile	16 Nov 2002 06:39:42 -0000	1.365
+++ Makefile	17 Nov 2002 20:36:45 -0000
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 4
 SUBLEVEL = 20
-EXTRAVERSION = -rc1-pa5
+EXTRAVERSION = -rc1-pa6
 
 KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 
Index: arch/parisc/kernel/ccio-dma.c
===================================================================
RCS file: /var/cvs/linux/arch/parisc/kernel/ccio-dma.c,v
retrieving revision 1.55
diff -u -p -r1.55 ccio-dma.c
--- arch/parisc/kernel/ccio-dma.c	3 Aug 2002 08:18:20 -0000	1.55
+++ arch/parisc/kernel/ccio-dma.c	17 Nov 2002 20:36:45 -0000
@@ -609,8 +609,6 @@ ccio_dma_supported(struct pci_dev *dev, 
 		return 0;
 	}
 
-	dev->dma_mask = mask;   /* save it */
-
 	/* only support 32-bit devices (ie PCI/GSC) */
 	return (int)(mask == 0xffffffffUL);
 }
Index: arch/parisc/kernel/ccio-rm-dma.c
===================================================================
RCS file: /var/cvs/linux/arch/parisc/kernel/ccio-rm-dma.c,v
retrieving revision 1.5
diff -u -p -r1.5 ccio-rm-dma.c
--- arch/parisc/kernel/ccio-rm-dma.c	9 Nov 2001 23:35:15 -0000	1.5
+++ arch/parisc/kernel/ccio-rm-dma.c	17 Nov 2002 20:36:45 -0000
@@ -74,8 +74,6 @@ static int ccio_dma_supported( struct pc
 		return(0);
 	}
 
-	dev->dma_mask = mask;   /* save it */
-
 	/* only support 32-bit devices (ie PCI/GSC) */
 	return((int) (mask >= 0xffffffffUL));
 }
Index: arch/parisc/kernel/entry.S
===================================================================
RCS file: /var/cvs/linux/arch/parisc/kernel/entry.S,v
retrieving revision 1.96
diff -u -p -r1.96 entry.S
--- arch/parisc/kernel/entry.S	16 Nov 2002 07:00:31 -0000	1.96
+++ arch/parisc/kernel/entry.S	17 Nov 2002 20:36:46 -0000
@@ -759,32 +759,30 @@ intr_restore:
 
 	.import do_softirq,code
 intr_do_softirq:
-	bl      do_softirq,%r2
 #ifdef __LP64__
 	ldo	-16(%r30),%r29		/* Reference param save area */
-#else
-	nop
 #endif
-	b       intr_check_resched
-	nop
+	ldil	L%intr_check_resched, %r2
+	b	do_softirq
+	ldo	R%intr_check_resched(%r2), %r2
 
 	.import schedule,code
 intr_do_resched:
 	/* Only do reschedule if we are returning to user space */
 	LDREG   PT_IASQ0(%r16), %r20
-	CMPIB= 0,%r20,intr_restore /* backward */
+	CMPIB= 0,%r20,intr_check_sig /* backward */
 	nop
 	LDREG   PT_IASQ1(%r16), %r20
-	CMPIB= 0,%r20,intr_restore /* backward */
+	CMPIB= 0,%r20,intr_check_sig /* backward */
 	nop
 
 #ifdef __LP64__
 	ldo	-16(%r30),%r29		/* Reference param save area */
 #endif
 
-	ldil	L%intr_return, %r2
+	ldil	L%intr_check_sig, %r2
 	b	schedule
-	ldo	R%intr_return(%r2), %r2	/* return to intr_return, not here */
+	ldo	R%intr_check_sig(%r2), %r2
 
 
 	.import do_signal,code
@@ -799,15 +797,14 @@ intr_do_signal:
 
 	copy	%r0, %r24			/* unsigned long in_syscall */
 	copy	%r16, %r25			/* struct pt_regs *regs */
-	ssm     PSW_SM_I, %r0
+	copy	%r0, %r26			/* sigset_t *oldset = NULL */
 #ifdef __LP64__
 	ldo	-16(%r30),%r29			/* Reference param save area */
 #endif
-	bl	do_signal,%r2
-	copy	%r0, %r26			/* sigset_t *oldset = NULL */
+	ldil	L%intr_restore, %r2
+	b	do_signal
+	ldo	R%intr_restore(%r2), %r2
 
-	b	intr_restore
-	nop
 
 	/*
 	 * External interrupts.
@@ -852,7 +849,7 @@ intr_extint:
 	ldo	-16(%r30),%r29	/* Reference param save area */
 #endif
 	b	do_cpu_irq_mask
-	ldo	R%intr_return(%r2), %r2	/* return to intr_return, not here */
+	ldo	R%intr_return(%r2), %r2
 
 
 
@@ -930,11 +927,11 @@ skip_save_ior:
 	ldo		-16(%r30),%r29	/* Reference param save area */
 #endif
 
-	ldil		L%intr_return, %r2
+	ldil		L%intr_restore, %r2
 	copy		%r25, %r16	/* save pt_regs */
 
 	b		handle_interruption
-	ldo		R%intr_return(%r2), %r2	/* return to intr_return */
+	ldo		R%intr_restore(%r2), %r2
 
 
 	/*
@@ -2355,9 +2352,9 @@ pt_regs_ok:
 	STREG	%r2,TASK_PT_IAOQ0(%r1)
 	ldo	4(%r2),%r2
 	STREG	%r2,TASK_PT_IAOQ1(%r1)
-	copy	%r25,%r16
+
 	b	intr_restore
-	nop
+	copy	%r25,%r16
 
 	.import do_softirq,code
 syscall_do_softirq:
Index: arch/parisc/kernel/lba_pci.c
===================================================================
RCS file: /var/cvs/linux/arch/parisc/kernel/lba_pci.c,v
retrieving revision 1.53
diff -u -p -r1.53 lba_pci.c
--- arch/parisc/kernel/lba_pci.c	15 Apr 2002 23:40:15 -0000	1.53
+++ arch/parisc/kernel/lba_pci.c	17 Nov 2002 20:36:46 -0000
@@ -735,47 +735,11 @@ lba_fixup_bus(struct pci_bus *bus)
 		bus->resource[0] = &(ldev->hba.io_space);
 		bus->resource[1] = &(ldev->hba.lmmio_space);
 	} else {
-		/* KLUGE ALERT!
-		** PCI-PCI Bridge resource munging.
-		** This hack should go away in the near future.
-		** It's based on the Alpha port.
-		*/
-		int i;
-		u16 cmd;
+		pci_read_bridge_bases(bus);
 
-		for (i = 0; i < 4; i++) {
-			bus->resource[i] =
-				&bus->self->resource[PCI_BRIDGE_RESOURCES+i];
-			bus->resource[i]->name = bus->name;
-		}
-#if 0
-		bus->resource[0]->flags |= pci_bridge_check_io(bus->self);
-#else
-		bus->resource[0]->flags |= IORESOURCE_IO;
-#endif
-		bus->resource[1]->flags |= IORESOURCE_MEM;
-		bus->resource[2]->flags = 0;	/* Don't support prefetchable */
-		bus->resource[3]->flags = 0;	/* not used */
-
-		/* 
-		** If the PPB is enabled (ie already configured) then
-		** just read those values.
-		*/
-		(void) lba_cfg_read16(bus->self, PCI_COMMAND, &cmd);
-		if (cmd & (PCI_COMMAND_MEMORY | PCI_COMMAND_IO)) {
-			pci_read_bridge_bases(bus);
-		} else {
-			/* Not configured.
-			** For now, propogate HBA limits to the bus;
-			**	PCI will adjust them later.
-			*/
-			bus->resource[0]->end = ldev->hba.io_space.end;
-			bus->resource[1]->end = ldev->hba.lmmio_space.end;
-		}
-
-		/* Turn off downstream PF memory address range by default */
-		bus->resource[2]->start = 1024*1024;
-		bus->resource[2]->end = bus->resource[2]->start - 1;
+		/* Turn off downstream PreFetchable Memory range by default */
+		bus->resource[2]->start = 0;
+		bus->resource[2]->end = 0;
 	}
 
 
Index: arch/parisc/kernel/pci.c
===================================================================
RCS file: /var/cvs/linux/arch/parisc/kernel/pci.c,v
retrieving revision 1.37
diff -u -p -r1.37 pci.c
--- arch/parisc/kernel/pci.c	15 Nov 2002 04:57:00 -0000	1.37
+++ arch/parisc/kernel/pci.c	17 Nov 2002 20:36:46 -0000
@@ -485,6 +485,19 @@ pcibios_setup_host_bridge(struct pci_bus
 #endif
 }
 
+static void __devinit
+pcibios_enable_ppb(struct pci_bus *bus)
+{
+	struct list_head *list;
+
+	/* find a leaf of the PCI bus tree. */
+        list_for_each(list, &bus->children)
+		pcibios_enable_ppb(pci_bus_b(list));
+
+	if (bus->self && (bus->self->class >> 8) == PCI_CLASS_BRIDGE_PCI)
+		pdev_enable_device(bus->self);
+}
+
 
 /*
 ** Mostly copied from drivers/pci/setup-bus.c:pci_assign_unassigned_resources()
@@ -493,15 +506,13 @@ void __devinit
 pcibios_assign_unassigned_resources(struct pci_bus *bus)
 {
 	/* from drivers/pci/setup-bus.c */
-	extern void pbus_assign_resources(struct pci_bus *bus, struct pbus_set_ranges_data *ranges);
+	extern void pbus_size_bridges(struct pci_bus *bus);
+	extern void pbus_assign_resources(struct pci_bus *bus);
 
-	struct pbus_set_ranges_data ranges;
+	pbus_size_bridges(bus);
+	pbus_assign_resources(bus);
 
-	ranges.io_end = ranges.io_start
-				= bus->resource[0]->start + PCIBIOS_MIN_IO;
-	ranges.mem_end = ranges.mem_start
-				= bus->resource[1]->start + PCIBIOS_MIN_MEM;
-	pbus_assign_resources(bus, &ranges);
+	pcibios_enable_ppb(bus);
 }
 
 /*
Index: arch/parisc/kernel/processor.c
===================================================================
RCS file: /var/cvs/linux/arch/parisc/kernel/processor.c,v
retrieving revision 1.14
diff -u -p -r1.14 processor.c
--- arch/parisc/kernel/processor.c	13 Sep 2002 06:46:28 -0000	1.14
+++ arch/parisc/kernel/processor.c	17 Nov 2002 20:36:46 -0000
@@ -1,4 +1,4 @@
-/*    $Id: processor.c,v 1.13 2002/07/04 19:33:01 grundler Exp $
+/*    $Id: processor.c,v 1.14 2002/09/13 06:46:28 grundler Exp $
  *
  *    Initial setup-routines for HP 9000 based hardware.
  *
@@ -77,8 +77,6 @@ static int __init processor_probe(struct
 	unsigned long txn_addr;
 	unsigned long cpuid;
 	struct cpuinfo_parisc *p;
-	extern struct irq_region_ops cpu_irq_ops; /* arch/parisc...irq.c */
-	extern struct irqaction cpu_irq_actions[]; /* arch/parisc...irq.c */
 
 #ifndef CONFIG_SMP
 	if (boot_cpu_data.cpu_count > 0) {
Index: arch/parisc/kernel/sba_iommu.c
===================================================================
RCS file: /var/cvs/linux/arch/parisc/kernel/sba_iommu.c,v
retrieving revision 1.69
diff -u -p -r1.69 sba_iommu.c
--- arch/parisc/kernel/sba_iommu.c	28 May 2002 06:12:16 -0000	1.69
+++ arch/parisc/kernel/sba_iommu.c	17 Nov 2002 20:36:46 -0000
@@ -812,10 +812,8 @@ sba_dma_supported( struct pci_dev *dev, 
 		return(0);
 	}
 
-	dev->dma_mask = mask;	/* save it */
-
 	/* only support 32-bit PCI devices - no DAC support (yet) */
-	return((int) (mask == 0xffffffff));
+	return((int) (mask == 0xffffffffUL));
 }
 
 
Index: arch/parisc/kernel/traps.c
===================================================================
RCS file: /var/cvs/linux/arch/parisc/kernel/traps.c,v
retrieving revision 1.69
diff -u -p -r1.69 traps.c
--- arch/parisc/kernel/traps.c	16 Nov 2002 06:16:52 -0000	1.69
+++ arch/parisc/kernel/traps.c	17 Nov 2002 20:36:46 -0000
@@ -321,7 +321,6 @@ static void default_trap(int code, struc
 void (*cpu_lpmc) (int code, struct pt_regs *regs) = default_trap;
 
 
-
 void transfer_pim_to_trap_frame(struct pt_regs *regs)
 {
     register int i;
@@ -449,25 +448,25 @@ void parisc_terminate(char *msg, struct 
 	    ;
 }
 
+
 void handle_interruption(int code, struct pt_regs *regs)
 {
 	unsigned long fault_address = 0;
 	unsigned long fault_space = 0;
 	struct siginfo si;
 
-	if (code == 1)
-	    pdc_console_restart();  /* switch back to pdc if HPMC */
-	else
-	    local_irq_enable();
-
-#if 0
-	printk(KERN_CRIT "Interruption # %d\n", code);
-#endif
+	/* HACK! jsm is going to fix this.
+	 * entry.S will manage I-bit - only enable I-bit if it was
+	 * enabled before we took the "trap".
+	 */
+	if (code != 1)
+		local_irq_enable();
 
 	switch(code) {
 
 	case  1:
 		/* High-priority machine check (HPMC) */
+		pdc_console_restart();  /* switch back to pdc if HPMC */
 
 		/* set up a new led state on systems shipped with a LED State panel */
 		pdc_chassis_send_status(PDC_CHASSIS_DIRECT_HPMC);
Index: drivers/gsc/dino.c
===================================================================
RCS file: /var/cvs/linux/drivers/gsc/dino.c,v
retrieving revision 1.61
diff -u -p -r1.61 dino.c
--- drivers/gsc/dino.c	13 Apr 2002 22:12:27 -0000	1.61
+++ drivers/gsc/dino.c	17 Nov 2002 20:36:46 -0000
@@ -436,7 +436,7 @@ ilr_again:
 	if (mask) {
 		if (--ilr_loop > 0)
 			goto ilr_again;
-		printk("Dino %lx: stuck interrupt %d\n", dino_dev->hba.base_addr, mask);
+		printk("Dino %lx: IRQ base %d, stuck IRQ lines? 0x%x\n", dino_dev->hba.base_addr, dino_dev->dino_region->data.irqbase, mask);
 	}
 }
 
Index: drivers/net/tulip/eeprom.c
===================================================================
RCS file: /var/cvs/linux/drivers/net/tulip/eeprom.c,v
retrieving revision 1.15
diff -u -p -r1.15 eeprom.c
--- drivers/net/tulip/eeprom.c	11 Sep 2002 07:01:04 -0000	1.15
+++ drivers/net/tulip/eeprom.c	17 Nov 2002 20:36:46 -0000
@@ -190,7 +190,7 @@ void __devinit tulip_parse_eeprom(struct
 	}
 subsequent_board:
 
-	if (ee_data[27] == 0) {		/* No valid media table. */
+	if (ee_data[27] == 0 || ee_data[ee_data[27]] == 0) {  /* No valid media table. */
 		tulip_build_fake_mediatable(tp);
 	} else if (tp->chip_id == DC21041) {
 		unsigned char *p = (void *)ee_data + ee_data[27 + controller_index*3];