Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9d7ab1f4 authored by David S. Miller's avatar David S. Miller
Browse files

[SPARC]: Fix initialization of sun4d SBUS interrupts.



1) Explicitly traverse to the root looking for the "sbi".
2) Grab the "board#" property from the sbi's parent and
   verify that this parent is an "io-unit" node.
3) Skip IRQ initialization when device lacks "reg" property.

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 67e23a1e
Loading
Loading
Loading
Loading
+31 −3
Original line number Original line Diff line number Diff line
@@ -596,14 +596,41 @@ static struct of_device * __init scan_one_device(struct device_node *dp,
		static int pil_to_sbus[] = {
		static int pil_to_sbus[] = {
			0, 0, 1, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 0,
			0, 0, 1, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 0,
		};
		};
		struct device_node *busp = dp->parent;
		struct device_node *io_unit, *sbi = dp->parent;
		struct linux_prom_registers *regs;
		struct linux_prom_registers *regs;
		int board = of_getintprop_default(busp, "board#", 0);
		int board, slot;
		int slot;

		while (sbi) {
			if (!strcmp(sbi->name, "sbi"))
				break;

			sbi = sbi->parent;
		}
		if (!sbi)
			goto build_resources;


		regs = of_get_property(dp, "reg", NULL);
		regs = of_get_property(dp, "reg", NULL);
		if (!regs)
			goto build_resources;

		slot = regs->which_io;
		slot = regs->which_io;


		/* If SBI's parent is not io-unit or the io-unit lacks
		 * a "board#" property, something is very wrong.
		 */
		if (!sbi->parent || strcmp(sbi->parent->name, "io-unit")) {
			printk("%s: Error, parent is not io-unit.\n",
			       sbi->full_name);
			goto build_resources;
		}
		io_unit = sbi->parent;
		board = of_getintprop_default(io_unit, "board#", -1);
		if (board == -1) {
			printk("%s: Error, lacks board# property.\n",
			       io_unit->full_name);
			goto build_resources;
		}

		for (i = 0; i < op->num_irqs; i++) {
		for (i = 0; i < op->num_irqs; i++) {
			int this_irq = op->irqs[i];
			int this_irq = op->irqs[i];
			int sbusl = pil_to_sbus[this_irq];
			int sbusl = pil_to_sbus[this_irq];
@@ -617,6 +644,7 @@ static struct of_device * __init scan_one_device(struct device_node *dp,
		}
		}
	}
	}


build_resources:
	build_device_resources(op, parent);
	build_device_resources(op, parent);


	op->dev.parent = parent;
	op->dev.parent = parent;