Skip to contentSkip to conversation

Pegasos 2 support patch ...

PATCH Sven Luther 4 participants 21 messages Jun 29, 2004 – Jul 1, 2004

lore
Share & tools
lore
#0 lore raw

Hello,

Please find here attached a patch which adds support for the Pegasos 2 motherboard, and partial support for the Pegasos 1. I would like to have some review of it, and if it is ok, see how it would be possible to have it included in the main kernel. The patch is against 2.6.7.

The remaining problem for the pegasos 2 is with the via82cxxx ide driver, which needs to support a different irq for both channels, thus breakign when a device is present on the second ide channel. The pegasos-via82cxxx.diff patches is a hcky soltuion for this, but is naturally not fit for mainstream inclusion. I would welcome any hint on how to solve this issue.

The pegasos1 support is not complete, but i believe this is due to some brokeness in the OF. The main problem being that the translate function is broken, and altough phys has the right value (0x00010000) before calling it, it is 0 afterwards. I suppose the initial value is taken from &_stext, so it should be feasible to detect that this is the correct value before calling the translate OF method, or fixing it if we detect a Pegasos 1 with the model OF property. Comments on this would also be welcome. There may be some interrupt level thing left on pegasos 1 also, but i would need to check that.

Thanks for your comments,

Friendly,

Sven Luther

arch/ppc/platforms/chrp_pci.c +36 -5
diff -urN kernel-source-2.6.7.orig/arch/ppc/platforms/chrp_pci.c kernel-source-2.6.7.peg2/arch/ppc/platforms/chrp_pci.c
@@ -97,8 +97,9 @@
 rtas_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
 		 int len, u32 *val)
 {
+	struct pci_controller *hose = bus->sysdata;
 	unsigned long addr = (offset & 0xff) | ((devfn & 0xff) << 8)
-		| ((bus->number & 0xff) << 16);
+		| (((bus->number - hose->first_busno) & 0xff) << 16) | (pci_domain_nr(bus) << 24);
         unsigned long ret = ~0UL;
 	int rval;
 
@@ -111,8 +112,9 @@
 rtas_write_config(struct pci_bus *bus, unsigned int devfn, int offset,
 		  int len, u32 val)
 {
+	struct pci_controller *hose = bus->sysdata;
 	unsigned long addr = (offset & 0xff) | ((devfn & 0xff) << 8)
-		| ((bus->number & 0xff) << 16);
+		| (((bus->number - hose->first_busno) & 0xff) << 16) | (pci_domain_nr(bus) << 24);
 	int rval;
 
 	rval = call_rtas("write-pci-config", 3, 1, NULL, addr, len, val);
@@ -186,6 +188,26 @@
 	iounmap(reg);
 }
 
+/* Marvell Discovery II based Pegasos 2 */
+//#define PEGASOS_USE_PCI_DOMAINS
+
+static void __init
+setup_peg2(struct pci_controller *hose, struct device_node *dev)
+{
+	struct device_node *root = find_path_device("/");
+	struct device_node *rtas;
+
+	rtas = of_find_node_by_name (root, "rtas");
+	if (rtas) {
+		hose->ops = &rtas_pci_ops;
+	} else {
+		printk ("RTAS supporting Pegasos OF not found, please upgrade your firmware\n");
+	}
+#ifndef PEGASOS_USE_PCI_DOMAINS
+	pci_assign_all_busses = 1;
+#endif
+}
+
 void __init
 chrp_find_bridges(void)
 {
@@ -195,7 +217,7 @@
 	struct pci_controller *hose;
 	unsigned int *dma;
 	char *model, *machine;
-	int is_longtrail = 0, is_mot = 0;
+	int is_longtrail = 0, is_mot = 0, is_pegasos = 0;
 	struct device_node *root = find_path_device("/");
 
 	/*
@@ -207,6 +229,8 @@
 	if (machine != NULL) {
 		is_longtrail = strncmp(machine, "IBM,LongTrail", 13) == 0;
 		is_mot = strncmp(machine, "MOT", 3) == 0;
+		if (strncmp(machine, "Pegasos2", 8) == 0) is_pegasos = 2;
+		else if (strncmp(machine, "Pegasos", 7) == 0) is_pegasos = 1;
 	}
 	for (dev = root->child; dev != NULL; dev = dev->sibling) {
 		if (dev->type == NULL || strcmp(dev->type, "pci") != 0)
@@ -257,6 +281,10 @@
 			hose->cfg_data = (unsigned char *)
 				ioremap(GG2_PCI_CONFIG_BASE, 0x80000);
 			gg2_pci_config_base = (unsigned long) hose->cfg_data;
+		} else if (is_pegasos == 1) {
+			setup_indirect_pci(hose, 0xfec00cf8, 0xfee00cfc);
+		} else if (is_pegasos == 2) {
+			setup_peg2(hose, dev);
 		} else {
 			printk("No methods for %s (model %s), using RTAS\n",
 			       dev->full_name, model);
@@ -274,6 +302,9 @@
 			printk("pci_dram_offset = %lx\n", pci_dram_offset);
 		}
 	}
-
-	ppc_md.pcibios_fixup = chrp_pcibios_fixup;
+
+	if (is_pegasos)
+		ppc_md.pcibios_fixup = NULL;
+	else
+		ppc_md.pcibios_fixup = chrp_pcibios_fixup;
 }
arch/ppc/platforms/chrp_setup.c +56 -10

103 lines not on this page · raw message

arch/ppc/platforms/chrp_time.c +2 -0
diff -urN kernel-source-2.6.7.orig/arch/ppc/platforms/chrp_time.c kernel-source-2.6.7.peg2/arch/ppc/platforms/chrp_time.c
@@ -41,6 +41,8 @@
 	int base;
 
 	rtcs = find_compatible_devices("rtc", "pnpPNP,b00");
+	if (rtcs == NULL)
+		rtcs = find_compatible_devices("rtc", "ds1385-rtc");
 	if (rtcs == NULL || rtcs->addrs == NULL)
 		return 0;
 	base = rtcs->addrs[0].address;
#1 lore raw
Quoted 9 lines · Sven Luther

The pegasos1 support is not complete, but i believe this is due to some brokeness in the OF. The main problem being that the translate function is broken, and altough phys has the right value (0x00010000) before calling it, it is 0 afterwards. I suppose the initial value is taken from &_stext, so it should be feasible to detect that this is the correct value before calling the translate OF method, or fixing it if we detect a Pegasos 1 with the model OF property. Comments on this would also be welcome. There may be some interrupt level thing left on pegasos 1 also, but i would need to check that.

Well, the pegasos 1 seems to start with mmu enabled, but with BATs mapped 1:1. There is not much we can do unless we fix the translate method, i think. The attached patch tests if the machine is a pegasos 1 (but not 2) and sets the phys to 0x00010000 if this is the case.

Another solution would be to test before doing the translate call, maybe this would be more elegant ?

Friendly,

Sven Luther

arch/ppc/syslib/prom_init.c +8 -0
diff -urN kernel-source-2.6.7.orig/arch/ppc/syslib/prom_init.c kernel-source-2.6.7.peg2/arch/ppc/syslib/prom_init.c
@@ -794,6 +794,9 @@
 	char *p, *d;
  	unsigned long phys;
 	void *result[3];
+	char model[32];
+	phandle node;
+	int rc;
 
  	/* Default */
  	phys = (unsigned long) &_stext;
@@ -880,6 +883,11 @@
 	for (i = 0; i < prom_num_displays; ++i)
 		prom_display_paths[i] = PTRUNRELOC(prom_display_paths[i]);
 
+	/* Pegasos 1 has a broken translate method in the OF, fix it */
+	node = call_prom("finddevice", 1, 1, "/");
+	rc = call_prom("getprop", 4, 1, node, "model", model, sizeof(model));
+	if (rc > 0 && !strncmp (model, "Pegasos", 7) && strncmp (model, "Pegasos2", 8)) phys = 0x00010000;
+
 	prom_print("returning 0x");
 	prom_print_hex(phys);
 	prom_print("from prom_init\n");
#2 lore raw
Quoted 3 lines

Another solution would be to test before doing the translate call, maybe this would be more elegant ?

Yup, if you know it will be broken, don't bother calling it, and please, avoid the over-long line :)

Ben.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#3 lore raw
Quoted 6 lines · Benjamin Herrenschmidt
Quoted 3 lines

Another solution would be to test before doing the translate call, maybe this would be more elegant ?

Yup, if you know it will be broken, don't bother calling it, and please, avoid the over-long line :)

Ok, this is then the final patch, i hope it is now correct.

The only part missing is the via82cxxx patch, where may i best find help on how to best solve this ? I wrote the maintainer listed in the patch, but never got a reply.

Friendly,

Sven Luther

arch/ppc/platforms/chrp_pci.c +36 -5
diff -ur kernel-source-2.6.7.orig/arch/ppc/platforms/chrp_pci.c kernel-source-2.6.7.peg2/arch/ppc/platforms/chrp_pci.c
@@ -97,8 +97,9 @@
 rtas_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
 		 int len, u32 *val)
 {
+	struct pci_controller *hose = bus->sysdata;
 	unsigned long addr = (offset & 0xff) | ((devfn & 0xff) << 8)
-		| ((bus->number & 0xff) << 16);
+		| (((bus->number - hose->first_busno) & 0xff) << 16) | (pci_domain_nr(bus) << 24);
         unsigned long ret = ~0UL;
 	int rval;
 
@@ -111,8 +112,9 @@
 rtas_write_config(struct pci_bus *bus, unsigned int devfn, int offset,
 		  int len, u32 val)
 {
+	struct pci_controller *hose = bus->sysdata;
 	unsigned long addr = (offset & 0xff) | ((devfn & 0xff) << 8)
-		| ((bus->number & 0xff) << 16);
+		| (((bus->number - hose->first_busno) & 0xff) << 16) | (pci_domain_nr(bus) << 24);
 	int rval;
 
 	rval = call_rtas("write-pci-config", 3, 1, NULL, addr, len, val);
@@ -186,6 +188,26 @@
 	iounmap(reg);
 }
 
+/* Marvell Discovery II based Pegasos 2 */
+//#define PEGASOS_USE_PCI_DOMAINS
+
+static void __init
+setup_peg2(struct pci_controller *hose, struct device_node *dev)
+{
+	struct device_node *root = find_path_device("/");
+	struct device_node *rtas;
+
+	rtas = of_find_node_by_name (root, "rtas");
+	if (rtas) {
+		hose->ops = &rtas_pci_ops;
+	} else {
+		printk ("RTAS supporting Pegasos OF not found, please upgrade your firmware\n");
+	}
+#ifndef PEGASOS_USE_PCI_DOMAINS
+	pci_assign_all_busses = 1;
+#endif
+}
+
 void __init
 chrp_find_bridges(void)
 {
@@ -195,7 +217,7 @@
 	struct pci_controller *hose;
 	unsigned int *dma;
 	char *model, *machine;
-	int is_longtrail = 0, is_mot = 0;
+	int is_longtrail = 0, is_mot = 0, is_pegasos = 0;
 	struct device_node *root = find_path_device("/");
 
 	/*
@@ -207,6 +229,8 @@
 	if (machine != NULL) {
 		is_longtrail = strncmp(machine, "IBM,LongTrail", 13) == 0;
 		is_mot = strncmp(machine, "MOT", 3) == 0;
+		if (strncmp(machine, "Pegasos2", 8) == 0) is_pegasos = 2;
+		else if (strncmp(machine, "Pegasos", 7) == 0) is_pegasos = 1;
 	}
 	for (dev = root->child; dev != NULL; dev = dev->sibling) {
 		if (dev->type == NULL || strcmp(dev->type, "pci") != 0)
@@ -257,6 +281,10 @@
 			hose->cfg_data = (unsigned char *)
 				ioremap(GG2_PCI_CONFIG_BASE, 0x80000);
 			gg2_pci_config_base = (unsigned long) hose->cfg_data;
+		} else if (is_pegasos == 1) {
+			setup_indirect_pci(hose, 0xfec00cf8, 0xfee00cfc);
+		} else if (is_pegasos == 2) {
+			setup_peg2(hose, dev);
 		} else {
 			printk("No methods for %s (model %s), using RTAS\n",
 			       dev->full_name, model);
@@ -274,6 +302,9 @@
 			printk("pci_dram_offset = %lx\n", pci_dram_offset);
 		}
 	}
-
-	ppc_md.pcibios_fixup = chrp_pcibios_fixup;
+
+	if (is_pegasos)
+		ppc_md.pcibios_fixup = NULL;
+	else
+		ppc_md.pcibios_fixup = chrp_pcibios_fixup;
 }
arch/ppc/platforms/chrp_setup.c +56 -10

103 lines not on this page · raw message

arch/ppc/platforms/chrp_time.c +2 -0
diff -ur kernel-source-2.6.7.orig/arch/ppc/platforms/chrp_time.c kernel-source-2.6.7.peg2/arch/ppc/platforms/chrp_time.c
@@ -41,6 +41,8 @@
 	int base;
 
 	rtcs = find_compatible_devices("rtc", "pnpPNP,b00");
+	if (rtcs == NULL)
+		rtcs = find_compatible_devices("rtc", "ds1385-rtc");
 	if (rtcs == NULL || rtcs->addrs == NULL)
 		return 0;
 	base = rtcs->addrs[0].address;
arch/ppc/syslib/prom_init.c +17 -5
diff -ur kernel-source-2.6.7.orig/arch/ppc/syslib/prom_init.c kernel-source-2.6.7.peg2/arch/ppc/syslib/prom_init.c
@@ -794,6 +794,9 @@
 	char *p, *d;
  	unsigned long phys;
 	void *result[3];
+	char model[32];
+	phandle node;
+	int rc;
 
  	/* Default */
  	phys = (unsigned long) &_stext;
@@ -850,11 +853,20 @@
 
 	klimit = (char *) (mem - offset);
 
-	/* If we are already running at 0xc0000000, we assume we were
-	 * loaded by an OF bootloader which did set a BAT for us.
-	 * This breaks OF translate so we force phys to be 0.
-	 */
-	if (offset == 0) {
+	node = call_prom("finddevice", 1, 1, "/");
+	rc = call_prom("getprop", 4, 1, node, "model", model, sizeof(model));
+	if (rc > 0 && !strncmp (model, "Pegasos", 7)
+		&& strncmp (model, "Pegasos2", 8)) {
+		/* Pegasos 1 has a broken translate method in the OF,
+		 * and furthermore the BATs are mapped 1:1 so the phys
+		 * address calculated above is * correct, so let's use
+		 * it directly.
+		 */
+	} else if (offset == 0) {
+		/* If we are already running at 0xc0000000, we assume we were
+	 	* loaded by an OF bootloader which did set a BAT for us.
+	 	* This breaks OF translate so we force phys to be 0.
+	 	*/
 		prom_print("(already at 0xc0000000) phys=0\n");
 		phys = 0;
 	} else if ((int) call_prom("getprop", 4, 1, prom_chosen, "mmu",
#4 lore raw
Quoted 17 lines · Sven Luther
Quoted 5 lines · Benjamin Herrenschmidt
Quoted 2 lines

Another solution would be to test before doing the translate call, maybe this would be more elegant ?

Yup, if you know it will be broken, don't bother calling it, and please, avoid the over-long line :)

Ok, this is then the final patch, i hope it is now correct.

arch/ppc/syslib/prom_init.c +0 -2
@@ -850,11 +853,20 @@
 
 	klimit = (char *) (mem - offset);
 
-	/* If we are already running at 0xc0000000, we assume we were
-	 * loaded by an OF bootloader which did set a BAT for us.

arch/ppc/syslib/prom_init.c line 862

Quoted 10 lines
arch/ppc/syslib/prom_init.c +7 -3
-	 * This breaks OF translate so we force phys to be 0.
-	 */
-	if (offset == 0) {
+	node = call_prom("finddevice", 1, 1, "/");
+	rc = call_prom("getprop", 4, 1, node, "model", model, sizeof(model));
+	if (rc > 0 && !strncmp (model, "Pegasos", 7)
+		&& strncmp (model, "Pegasos2", 8)) {
+		/* Pegasos 1 has a broken translate method in the OF,
+		 * and furthermore the BATs are mapped 1:1 so the phys
+		 * address calculated above is * correct, so let's use
                                               ^

Bogus asterisk

arch/ppc/syslib/prom_init.c line 863

Quoted 1 line
arch/ppc/syslib/prom_init.c +1 -0
+		 * it directly.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#5 lore raw
Quoted 29 lines · Geert Uytterhoeven
Quoted 17 lines · Sven Luther
Quoted 5 lines · Benjamin Herrenschmidt
Quoted 2 lines

Another solution would be to test before doing the translate call, maybe this would be more elegant ?

Yup, if you know it will be broken, don't bother calling it, and please, avoid the over-long line :)

Ok, this is then the final patch, i hope it is now correct.

arch/ppc/syslib/prom_init.c +0 -2
@@ -850,11 +853,20 @@
 
 	klimit = (char *) (mem - offset);
 
-	/* If we are already running at 0xc0000000, we assume we were
-	 * loaded by an OF bootloader which did set a BAT for us.

arch/ppc/syslib/prom_init.c line 862

Quoted 10 lines
arch/ppc/syslib/prom_init.c +7 -3
-	 * This breaks OF translate so we force phys to be 0.
-	 */
-	if (offset == 0) {
+	node = call_prom("finddevice", 1, 1, "/");
+	rc = call_prom("getprop", 4, 1, node, "model", model, sizeof(model));
+	if (rc > 0 && !strncmp (model, "Pegasos", 7)
+		&& strncmp (model, "Pegasos2", 8)) {
+		/* Pegasos 1 has a broken translate method in the OF,
+		 * and furthermore the BATs are mapped 1:1 so the phys
+		 * address calculated above is * correct, so let's use
                                               ^
Quoted 1 line

Bogus asterisk

Ok, i will remove it thanks.

Friendly,

Sven Luther

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#6 lore raw
In reply to Sven Luther
Quoted 6 lines · Sven Luther

The remaining problem for the pegasos 2 is with the via82cxxx ide driver, which needs to support a different irq for both channels, thus breakign when a device is present on the second ide channel. The pegasos-via82cxxx.diff patches is a hcky soltuion for this, but is naturally not fit for mainstream inclusion. I would welcome any hint on how to solve this issue.

I have a board which has the same problem.

My current idea is to add an extra flag to the ide_pci_device_t to indicate that the device defaults to ports 14 and 15, then modify ide_hwif_configure() to use this flag.

- Adrian Cox
Humboldt Solutions Ltd.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#7 lore raw
Quoted 8 lines · Adrian Cox
Quoted 6 lines · Sven Luther

The remaining problem for the pegasos 2 is with the via82cxxx ide driver, which needs to support a different irq for both channels, thus breakign when a device is present on the second ide channel. The pegasos-via82cxxx.diff patches is a hcky soltuion for this, but is naturally not fit for mainstream inclusion. I would welcome any hint on how to solve this issue.

Quoted 5 lines

I have a board which has the same problem.

My current idea is to add an extra flag to the ide_pci_device_t to indicate that the device defaults to ports 14 and 15, then modify ide_hwif_configure() to use this flag.

Ok, sounds nice, do you plan to write this patch anytime soon, or should i go forward and implement this idea ?

Thanks for the reply.

Friendly,

Sven Luther

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#8 lore raw
Quoted 6 lines · Sven Luther
Quoted 4 lines · Adrian Cox
Quoted 3 lines · Sven Luther

The remaining problem for the pegasos 2 is with the via82cxxx ide driver, which needs to support a different irq for both channels, thus breakign when a device is present on the second ide channel. [snip]

Quoted 6 lines
Quoted 3 lines

My current idea is to add an extra flag to the ide_pci_device_t to indicate that the device defaults to ports 14 and 15, then modify ide_hwif_configure() to use this flag.

Ok, sounds nice, do you plan to write this patch anytime soon, or should i go forward and implement this idea ?

I've got a few other things to get into the kernel before this, so please don't wait for me. If you make a patch I'll test it.

In my case, the initial setup is that the device has been assigned I/O space address in the 0xfe00 range, and no PCI IRQ. This confuses the PCI IDE code, because it assumes that the device must be an add-in card if it is not on the legacy ports.

- Adrian Cox
Humboldt Solutions Ltd.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#9 lore raw
Quoted 11 lines · Adrian Cox
Quoted 10 lines · Sven Luther
Quoted 8 lines · Adrian Cox
Quoted 3 lines · Sven Luther

The remaining problem for the pegasos 2 is with the via82cxxx ide driver, which needs to support a different irq for both channels, thus breakign when a device is present on the second ide channel. [snip]

My current idea is to add an extra flag to the ide_pci_device_t to indicate that the device defaults to ports 14 and 15, then modify ide_hwif_configure() to use this flag.

Quoted 5 lines
Quoted 2 lines

Ok, sounds nice, do you plan to write this patch anytime soon, or should i go forward and implement this idea ?

I've got a few other things to get into the kernel before this, so please don't wait for me. If you make a patch I'll test it.

Ok, altough i have not much experience with ide stuff.

Quoted 4 lines

In my case, the initial setup is that the device has been assigned I/O space address in the 0xfe00 range, and no PCI IRQ. This confuses the PCI IDE code, because it assumes that the device must be an add-in card if it is not on the legacy ports.

Ok.

Friendly,

Sven Luther

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#10 lore raw
In reply to Adrian Cox
Quoted 9 lines · Adrian Cox
Quoted 6 lines · Sven Luther

The remaining problem for the pegasos 2 is with the via82cxxx ide driver, which needs to support a different irq for both channels, thus breakign when a device is present on the second ide channel. The pegasos-via82cxxx.diff patches is a hcky soltuion for this, but is naturally not fit for mainstream inclusion. I would welcome any hint on how to solve this issue.

Quoted 5 lines

I have a board which has the same problem.

My current idea is to add an extra flag to the ide_pci_device_t to indicate that the device defaults to ports 14 and 15, then modify ide_hwif_configure() to use this flag.

Mmm, ...

static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev,
ide_pci_device_t *d, ide_hwif_t *mate, int port, int irq)

Would it not be better in my case to call ide_hwif_configure with the right irq ? Or do i misunderstand what you had in mind ?

Friendly,

Sven Luther

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#11 lore raw
Quoted 5 lines · Sven Luther

static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev,
ide_pci_device_t *d, ide_hwif_t *mate, int port, int irq)

Would it not be better in my case to call ide_hwif_configure with the right irq ? Or do i misunderstand what you had in mind ?

It shouldn't make much difference - I only suggested ide_hwif_configure because it already contains flag checking code.

- Adrian Cox
Humboldt Solutions Ltd.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#12 lore raw
Quoted 9 lines · Adrian Cox
Quoted 5 lines · Sven Luther

static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev,
ide_pci_device_t *d, ide_hwif_t *mate, int port, int irq)

Would it not be better in my case to call ide_hwif_configure with the right irq ? Or do i misunderstand what you had in mind ?

It shouldn't make much difference - I only suggested ide_hwif_configure because it already contains flag checking code.

I am not sure if it works for me, but in your case, would the right solution not be to have d->init_chipset return the irq ?

Friendly,

Sven Luther

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#13 lore raw
Quoted 2 lines · Sven Luther

I am not sure if it works for me, but in your case, would the right solution not be to have d->init_chipset return the irq ?

No, because d->init_chipset is only called once per pci device, and that one pci device provides two channels with different irqs.

The problem is that the via686 ide is hardwired to irqs 14 and 15 of the i8259 interrupt controller internally, but the kernel believes that only IDE controllers at the legacy address can have separate irqs for each channel.

- Adrian Cox
Humboldt Solutions Ltd.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#14 lore raw
Quoted 6 lines · Adrian Cox
Quoted 2 lines · Sven Luther

I am not sure if it works for me, but in your case, would the right solution not be to have d->init_chipset return the irq ?

No, because d->init_chipset is only called once per pci device, and that one pci device provides two channels with different irqs.

Ah, too bad. that said, this could be perhaps changed ? After all the calling code in the idesetup stuff is per channel, so there is no reason we could not call this one (or a similar function) for each channel.

Quoted 4 lines

The problem is that the via686 ide is hardwired to irqs 14 and 15 of the i8259 interrupt controller internally, but the kernel believes that only IDE controllers at the legacy address can have separate irqs for each channel.

Is this the case for each via ide controller ? If so why does it work on x86 ?

Friendly,

Sven Luther

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#15 lore raw
Quoted 8 lines · Sven Luther
Quoted 4 lines · Adrian Cox

The problem is that the via686 ide is hardwired to irqs 14 and 15 of the i8259 interrupt controller internally, but the kernel believes that only IDE controllers at the legacy address can have separate irqs for each channel.

Is this the case for each via ide controller ? If so why does it work on x86 ?

Because on x86 the BIOS places the IDE controller at the legacy addresses (0x1f0, 0x170), and then setup-pci.c spots that the via ide controller is also the legacy IDE controller, and thus uses the legacy irq numbers 14 and 15.

What I'm looking for is a tidy way of achieving the same result on a platform where the boot firmware did not put the via ide controller at the legacy addresses.

- Adrian Cox
Humboldt Solutions Ltd.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#16 lore raw
Quoted 7 lines · Adrian Cox
Quoted 6 lines · Sven Luther
Quoted 4 lines · Adrian Cox

The problem is that the via686 ide is hardwired to irqs 14 and 15 of the i8259 interrupt controller internally, but the kernel believes that only IDE controllers at the legacy address can have separate irqs for each channel.

Quoted 7 lines
Quoted 2 lines

Is this the case for each via ide controller ? If so why does it work on x86 ?

Because on x86 the BIOS places the IDE controller at the legacy addresses (0x1f0, 0x170), and then setup-pci.c spots that the via ide controller is also the legacy IDE controller, and thus uses the legacy irq numbers 14 and 15.

Ah, ok, so this is just another x86-bug, and there should really be no major problem in rectifying it, and all the code should already be in setup-pci.c. We just need to find some way to detect that we are also in this case. Could this not be probed somehow ? In which case are the irq numbers the same ? Only when the via driver is on a stansalone pci card ?

Quoted 3 lines

What I'm looking for is a tidy way of achieving the same result on a platform where the boot firmware did not put the via ide controller at the legacy addresses.

Ok, the main point would be to fins the tidy way for doing this.

Friendly,

Sven Luther

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#17 lore raw
Quoted 22 lines · Sven Luther
Quoted 7 lines · Adrian Cox
Quoted 6 lines · Sven Luther
Quoted 4 lines · Adrian Cox

The problem is that the via686 ide is hardwired to irqs 14 and 15 of the i8259 interrupt controller internally, but the kernel believes that only IDE controllers at the legacy address can have separate irqs for each channel.

Quoted 7 lines
Quoted 2 lines

Is this the case for each via ide controller ? If so why does it work on x86 ?

Because on x86 the BIOS places the IDE controller at the legacy addresses (0x1f0, 0x170), and then setup-pci.c spots that the via ide controller is also the legacy IDE controller, and thus uses the legacy irq numbers 14 and 15.

Ah, ok, so this is just another x86-bug, and there should really be no major problem in rectifying it, and all the code should already be in setup-pci.c. We just need to find some way to detect that we are also in this case. Could this not be probed somehow ? In which case are the irq numbers the same ? Only when the via driver is on a stansalone pci card ?

Quoted 5 lines
Quoted 3 lines

What I'm looking for is a tidy way of achieving the same result on a platform where the boot firmware did not put the via ide controller at the legacy addresses.

Ok, the main point would be to fins the tidy way for doing this.

Cfr. the code in longtrail_pcibios_fixup() and briq_pcibios_fixup() for the SL82C105 IDE interface, which is left in legacy mode by Open Firmware?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#18 lore raw
Quoted 8 lines · Geert Uytterhoeven
Quoted 7 lines · Sven Luther

On Wed, Jun 30, 2004 at 08:05:01PM +0100, Adrian Cox wrote:

Ah, ok, so this is just another x86-bug, and there should really be no major problem in rectifying it, and all the code should already be in setup-pci.c. We just need to find some way to detect that we are also in this case. Could this not be probed somehow ? In which case are the irq numbers the same ? Only when the via driver is on a stansalone pci card ?

The via 686 can't go on a standalone pci card, as it's a complete southbridge.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

What I'm looking for is a tidy way of achieving the same result on a platform where the boot firmware did not put the via ide controller at the legacy addresses.

Ok, the main point would be to fins the tidy way for doing this.

Cfr. the code in longtrail_pcibios_fixup() and briq_pcibios_fixup() for the SL82C105 IDE interface, which is left in legacy mode by Open Firmware?

Which tree are those boards in?

There's a similar fixup in pplus.c in 2.6.7, but I don't like the way IDE works on PowerPC currently. The ppc_ide_md structure and the fixups are being used to fool the core ide code into behaving in a specific way. The core ide code makes no guarantees that these tricks will continue to work, and in my case the necessary tricks changed between 2.4 and 2.6. The only platform specific knowledge required for the Via 686 is the mapping between the internal i8259 interrupt number and the linux interrupt number.

- Adrian Cox
Humboldt Solutions Ltd.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#19 lore raw
Quoted 7 lines · Adrian Cox
Quoted 6 lines · Geert Uytterhoeven
Quoted 5 lines · Sven Luther
Quoted 3 lines · Adrian Cox

What I'm looking for is a tidy way of achieving the same result on a platform where the boot firmware did not put the via ide controller at the legacy addresses.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Ok, the main point would be to fins the tidy way for doing this.

Cfr. the code in longtrail_pcibios_fixup() and briq_pcibios_fixup() for the SL82C105 IDE interface, which is left in legacy mode by Open Firmware?

Which tree are those boards in?

LongTrail support has been in the main tree since several years. But longtrail_pcibios_fixup() may still be missing even in the PPC tree (it doesn't seem to be in plain 2.6.7 yet). Patches floated on the list.

Quoted 8 lines

There's a similar fixup in pplus.c in 2.6.7, but I don't like the way IDE works on PowerPC currently. The ppc_ide_md structure and the fixups are being used to fool the core ide code into behaving in a specific way. The core ide code makes no guarantees that these tricks will continue to work, and in my case the necessary tricks changed between 2.4 and 2.6. The only platform specific knowledge required for the Via 686 is the mapping between the internal i8259 interrupt number and the linux interrupt number.

And the internal i8259 interrupt number is always the same as the Linux interrupt number to support legacy code, right?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#20 lore raw
In reply to Adrian Cox
Quoted 4 lines · Adrian Cox
Quoted 2 lines · Geert Uytterhoeven
Quoted 1 line · Sven Luther

On Wed, Jun 30, 2004 at 08:05:01PM +0100, Adrian Cox wrote:

Quoted 8 lines
Quoted 5 lines
Quoted 5 lines

Ah, ok, so this is just another x86-bug, and there should really be no major problem in rectifying it, and all the code should already be in setup-pci.c. We just need to find some way to detect that we are also in this case. Could this not be probed somehow ? In which case are the irq numbers the same ? Only when the via driver is on a stansalone pci card ?

The via 686 can't go on a standalone pci card, as it's a complete southbridge.

So, do i understand this correctly, and all instances of the via82cxxx driver have the 14/15 interrupt arrangement ? Or are there other standalone pci cards basd on the via ide chipset ?

Quoted 11 lines
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

What I'm looking for is a tidy way of achieving the same result on a platform where the boot firmware did not put the via ide controller at the legacy addresses.

Ok, the main point would be to fins the tidy way for doing this.

Cfr. the code in longtrail_pcibios_fixup() and briq_pcibios_fixup() for the SL82C105 IDE interface, which is left in legacy mode by Open Firmware?

Which tree are those boards in?

Quoted 8 lines

There's a similar fixup in pplus.c in 2.6.7, but I don't like the way IDE works on PowerPC currently. The ppc_ide_md structure and the fixups are being used to fool the core ide code into behaving in a specific way. The core ide code makes no guarantees that these tricks will continue to work, and in my case the necessary tricks changed between 2.4 and 2.6. The only platform specific knowledge required for the Via 686 is the mapping between the internal i8259 interrupt number and the linux interrupt number.

Mmm.

Friendly,

Sven Luther

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/