[OpenBIOS] [PATCH 4/7] PPC: Fix interrupt numbers

Alexander Graf agraf at suse.de
Mon Feb 22 17:14:45 CET 2010


We changed several interrupt numbers in Qemu to better reflect real
world hardware. Also, since we're now using proper interrupt maps, we
need to make sure we specify interrupts in the way the respective map
requires it.

Signed-off-by: Alexander Graf <agraf at suse.de>
---
 drivers/cuda.c |    7 ++++++-
 drivers/ide.c  |   29 ++++++++++++++++++++++++++---
 2 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/drivers/cuda.c b/drivers/cuda.c
index 509f3af..28ddc83 100644
--- a/drivers/cuda.c
+++ b/drivers/cuda.c
@@ -197,7 +197,12 @@ ob_cuda_initialize (int *idx)
 
 	set_property(ph, "reg", (char *)&props, sizeof(props));
 
-	set_int_property(ph, "interrupts", 0x12);
+	/* on newworld machines the cuda is on interrupt 0x19 */
+
+	props[0] = 0x19;
+	props[1] = 0;
+	NEWWORLD(set_property(ph, "interrupts", (char *)props, sizeof(props)));
+	NEWWORLD(set_int_property(ph, "#interrupt-cells", 2));
 
 	/* we emulate an oldworld hardware, so we must use
 	 * non-standard oldworld property (needed by linux 2.6.18)
diff --git a/drivers/ide.c b/drivers/ide.c
index 3636b3c..228ff1e 100644
--- a/drivers/ide.c
+++ b/drivers/ide.c
@@ -1421,9 +1421,11 @@ int ob_ide_init(const char *path, uint32_t io_port0, uint32_t ctl_port0,
 
 		dnode = find_dev(nodebuff);
 
+#ifndef CONFIG_PPC
 		props[0]=14; props[1]=0;
 		set_property(dnode, "interrupts",
 			     (char *)&props, 2*sizeof(cell));
+#endif
 
 		props[0] = __cpu_to_be32(chan->io_regs[0]);
 		props[1] = __cpu_to_be32(1); props[2] = __cpu_to_be32(8);
@@ -1578,10 +1580,31 @@ int macio_ide_init(const char *path, uint32_t addr, int nb_channels)
 		OLDWORLD(set_property(dnode, "AAPL,pio-timing",
 				      (char *)&props, 8*sizeof(cell)));
 
-		props[0] = 0x0000000d;
-		props[1] = 0x00000000;
+		/* The first interrupt entry is the ide interrupt, the second
+		   the dbdma interrupt */
+		switch (current_channel) {
+		case 1:
+			props[0] = 0x0000000d;
+			props[2] = 0x00000002;
+			break;
+		case 2:
+			props[0] = 0x0000000e;
+			props[2] = 0x00000003;
+			break;
+		case 3:
+			props[0] = 0x0000000f;
+			props[2] = 0x00000004;
+			break;
+		default:
+			props[0] = 0x00000000;
+			props[2] = 0x00000000;
+			break;
+		}
+		props[1] = 0x00000000; /* XXX level triggered on real hw */
+		props[3] = 0x00000000;
 		set_property(dnode, "interrupts",
-			     (char *)&props, 2*sizeof(cell));
+			     (char *)&props, 4*sizeof(cell));
+		set_int_property(dnode, "#interrupt-cells", 2);
 		OLDWORLD(set_property(dnode, "AAPL,interrupts",
 				      (char *)&props, 2*sizeof(cell)));
 
-- 
1.6.0.2




More information about the OpenBIOS mailing list