Skip to contentSkip to conversation

: SGI Octane (IP30) Patches, Part two, Octane core

PATCH/RFC Kumba 2 participants 4 messages Jul 31, 2008 – Aug 4, 2008

Subsystems (7)
USB Sound PCI MIPS +3 more subsystems
lore
Share & tools
lore

Kumba

author
#0 lore raw

The second part is the actual IP30 Patch that makes these beasts boot. Assuming you've already lit incense candles and sacrificed a PC to the MIPS Gods above.

There's one change that probably needs good scrutiny, as it changes a value in dma-default.c, and this'll affect other systems:

arch/mips/mm/dma-default.c 2008-07-25 03:14:40.000000000 -0400 renamed from arch/mips/mm/dma-default.c 2008-07-13 17:51:29.000000000 -0400 +1 -1
diff -Naurp linux-2.6.26.orig/arch/mips/mm/dma-default.c linux-2.6.26/arch/mips/mm/dma-default.c
@@ -209,7 +209,7 @@ dma_addr_t dma_map_page(struct device *d
                dma_cache_wback_inv(addr, size);
        }
 
-       return plat_map_dma_mem_page(dev, page) + offset;
+       return plat_map_dma_mem_page(dev, page, size) + offset;
 }
 
 

It's used because IP30's implementation of plat_map_dma_mem_page passes the 'size' var to a few functions, ultimately leading to IP30's version of pdev_to_baddr, where it checks to make sure we're not above a certain memory limit (2GB) that could cause problems with DMA & PCI (I think - it's been awhile).

That's just one example, though. There's probably more, but I've mostly done forward ports, and haven't really messed with re-writing much. Hence why I'd like to ask others to look, poke, prod, compile, and boot, and see if they have other suggestions for improving and fixing this up.

Thanks!,

--Kumba

Signature · 5 lines
Unofficial Gentoo/MIPS Hermit & Kernel Monkey

"The past tempts us, the present confuses us, the future frightens us.  And our lives slip away, moment by moment, lost in that vast, terrible in-between."

--Emperor Turhan, Centauri Republic
arch/mips/Kconfig +31 -3
diff -Naurp linux-2.6.26.orig/arch/mips/Kconfig linux-2.6.26/arch/mips/Kconfig
@@ -449,6 +449,31 @@ config SGI_IP28
         This is the SGI Indigo2 with R10000 processor.  To compile a Linux
         kernel that runs on these, say Y here.
 
+config SGI_IP30
+	bool "SGI IP30 (Octane/Octane2) (EXPERIMENTAL)"
+	depends on EXPERIMENTAL
+	select ARC
+	select ARC64
+	select BOOT_ELF64
+        select CEVT_R4K
+        select CSRC_R4K
+	select DMA_IP30
+	select DMA_COHERENT
+	select GENERIC_ISA_DMA
+	select HW_HAS_PCI
+        select IRQ_CPU
+	select NR_CPUS_DEFAULT_2
+	select PCI_DOMAINS
+	select SYS_HAS_CPU_R10000
+	select SYS_SUPPORTS_64BIT_KERNEL
+	select SYS_SUPPORTS_BIG_ENDIAN
+	select SYS_SUPPORTS_SMP
+        select ARC_MEMORY
+        select ARC_PROMLIB
+	help
+	  This are the SGI Octane and Octane2 graphics workstations.  To
+	  compile a Linux kernel that runs on these, say Y here.
+
 config SGI_IP32
 	bool "SGI IP32 (O2)"
 	select ARC
@@ -812,6 +837,9 @@ config DMA_COHERENT
 config DMA_IP27
 	bool
 
+config DMA_IP30
+	bool
+
 config DMA_NONCOHERENT
 	bool
 	select DMA_NEED_PCI_MAP_STATE
@@ -1006,7 +1034,7 @@ config BOOT_ELF32
 config MIPS_L1_CACHE_SHIFT
 	int
 	default "4" if MACH_DECSTATION
-	default "7" if SGI_IP22 || SGI_IP27 || SGI_IP28 || SNI_RM
+	default "7" if SGI_IP22 || SGI_IP27 || SGI_IP28 || SGI_IP30 || SNI_RM
 	default "4" if PMC_MSP4200_EVAL
 	default "5"
 
@@ -1019,12 +1047,12 @@ config ARC_CONSOLE
 
 config ARC_MEMORY
 	bool
-	depends on MACH_JAZZ || SNI_RM || SGI_IP32
+	depends on MACH_JAZZ || SNI_RM || SGI_IP30 || SGI_IP32
 	default y
 
 config ARC_PROMLIB
 	bool
-	depends on MACH_JAZZ || SNI_RM || SGI_IP22 || SGI_IP28 || SGI_IP32
+	depends on MACH_JAZZ || SNI_RM || SGI_IP22 || SGI_IP28 || SGI_IP30 || SGI_IP32
 	default y
 
 config ARC64
arch/mips/Makefile +9 -0
diff -Naurp linux-2.6.26.orig/arch/mips/Makefile linux-2.6.26/arch/mips/Makefile
@@ -492,6 +492,15 @@ cflags-$(CONFIG_SGI_IP28)	+= -mr10k-cach
 load-$(CONFIG_SGI_IP28)		+= 0xa800000020004000
 
 #
+# SGI-IP30 (Octane/Octane2)
+#
+ifdef CONFIG_SGI_IP30
+core-$(CONFIG_SGI_IP30)		+= arch/mips/sgi-ip30/
+cflags-$(CONFIG_SGI_IP30)	+= -Iinclude/asm-mips/mach-ip30
+load-$(CONFIG_SGI_IP30)		+= 0xa800000020004000
+endif
+
+#
 # SGI-IP32 (O2)
 #
 # Set the load address to >= 80069000 if you want to leave space for symmon,
arch/mips/fw/arc/init.c +7 -0
diff -Naurp linux-2.6.26.orig/arch/mips/fw/arc/init.c linux-2.6.26/arch/mips/fw/arc/init.c
@@ -56,4 +56,11 @@ void __init prom_init(void)
 		register_smp_ops(&ip27_smp_ops);
 	}
 #endif
+#ifdef CONFIG_SGI_IP30
+	{
+		extern struct plat_smp_ops ip30_smp_ops;
+
+		register_smp_ops(&ip30_smp_ops);
+	}
+#endif
 }
arch/mips/kernel/cevt-r4k.c +0 -1
diff -Naurp linux-2.6.26.orig/arch/mips/kernel/cevt-r4k.c linux-2.6.26/arch/mips/kernel/cevt-r4k.c
@@ -251,7 +251,6 @@ int __cpuinit mips_clockevent_init(void)
 	irq = MIPS_CPU_IRQ_BASE + cp0_compare_irq;
 	if (get_c0_compare_int)
 		irq = get_c0_compare_int();
-
 	cd = &per_cpu(mips_clockevent_device, cpu);
 
 	cd->name		= "MIPS";
arch/mips/kernel/setup.c +4 -1
diff -Naurp linux-2.6.26.orig/arch/mips/kernel/setup.c linux-2.6.26/arch/mips/kernel/setup.c
@@ -481,6 +481,10 @@ static void __init arch_mem_init(char **
 	printk("Determined physical RAM map:\n");
 	print_memory_map();
 
+#ifdef CONFIG_CMDLINE
+	if (strlen(CONFIG_CMDLINE))
+		strlcpy(arcs_cmdline, CONFIG_CMDLINE, sizeof(command_line));
+#endif
 	strlcpy(command_line, arcs_cmdline, sizeof(command_line));
 	strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
 
@@ -575,7 +579,6 @@ void __init setup_arch(char **cmdline_p)
 #endif
 
 	arch_mem_init(cmdline_p);
-
 	resource_init();
 	plat_smp_setup();
 }
arch/mips/mm/dma-default.c +1 -1
diff -Naurp linux-2.6.26.orig/arch/mips/mm/dma-default.c linux-2.6.26/arch/mips/mm/dma-default.c
@@ -209,7 +209,7 @@ dma_addr_t dma_map_page(struct device *d
 		dma_cache_wback_inv(addr, size);
 	}
 
-	return plat_map_dma_mem_page(dev, page) + offset;
+	return plat_map_dma_mem_page(dev, page, size) + offset;
 }
 
 EXPORT_SYMBOL(dma_map_page);
arch/mips/pci/Makefile +1 -0
diff -Naurp linux-2.6.26.orig/arch/mips/pci/Makefile linux-2.6.26/arch/mips/pci/Makefile
@@ -34,6 +34,7 @@ obj-$(CONFIG_PMC_MSP7120_FPGA)	+= fixup-
 obj-$(CONFIG_PMC_YOSEMITE)	+= fixup-yosemite.o ops-titan.o ops-titan-ht.o \
 				   pci-yosemite.o
 obj-$(CONFIG_SGI_IP27)		+= ops-bridge.o pci-ip27.o
+obj-$(CONFIG_SGI_IP30)		+= ops-bridge.o pci-ip30.o
 obj-$(CONFIG_SGI_IP32)		+= fixup-ip32.o ops-mace.o pci-ip32.o
 obj-$(CONFIG_SIBYTE_SB1250)	+= fixup-sb1250.o pci-sb1250.o
 obj-$(CONFIG_SIBYTE_BCM112X)	+= fixup-sb1250.o pci-sb1250.o
arch/mips/pci/ops-bridge.c +6 -0
diff -Naurp linux-2.6.26.orig/arch/mips/pci/ops-bridge.c linux-2.6.26/arch/mips/pci/ops-bridge.c
@@ -9,9 +9,15 @@
 #include <linux/pci.h>
 #include <asm/paccess.h>
 #include <asm/pci/bridge.h>
+
+#ifdef CONFIG_SGI_IP30
+#include <asm/mach-ip30/addrs.h>
+#include <asm/mach-ip30/pcibr.h>
+#else
 #include <asm/sn/arch.h>
 #include <asm/sn/intr.h>
 #include <asm/sn/sn0/hub.h>
+#endif
 
 /*
  * Most of the IOC3 PCI config register aren't present
arch/mips/pci/pci-ip30.c +321 -0

321 lines not on this page · raw message

arch/mips/pci/pci.c +13 -0
diff -Naurp linux-2.6.26.orig/arch/mips/pci/pci.c linux-2.6.26/arch/mips/pci/pci.c
@@ -77,6 +77,10 @@ pcibios_align_resource(void *data, struc
 
 void __devinit register_pci_controller(struct pci_controller *hose)
 {
+	if (hose->pre_scan)
+		if(hose->pre_scan(hose) < 0)
+			goto out;
+
 	if (request_resource(&iomem_resource, hose->mem_resource) < 0)
 		goto out;
 	if (request_resource(&ioport_resource, hose->io_resource) < 0) {
@@ -145,6 +149,10 @@ static int __init pcibios_init(void)
 		hose->need_domain_info = need_domain_info;
 		if (bus) {
 			next_busno = bus->subordinate + 1;
+ 
+ 			if (hose->post_scan)
+ 				hose->post_scan(hose, bus);
+
 			/* Don't allow 8-bit bus number overflow inside the hose -
 			   reserve some space for bridges. */
 			if (next_busno > 224) {
@@ -168,6 +176,7 @@ static int pcibios_enable_resources(stru
 	u16 cmd, old_cmd;
 	int idx;
 	struct resource *r;
+	struct pci_controller *hose = (struct pci_controller *)dev->sysdata;
 
 	pci_read_config_word(dev, PCI_COMMAND, &cmd);
 	old_cmd = cmd;
@@ -176,6 +185,10 @@ static int pcibios_enable_resources(stru
 		if (!(mask & (1<<idx)))
 			continue;
 
+		if(hose->pre_enable)
+			if(hose->pre_enable(hose, dev, idx) < 0)
+				return -EINVAL;
+
 		r = &dev->resource[idx];
 		if (!(r->flags & (IORESOURCE_IO | IORESOURCE_MEM)))
 			continue;
arch/mips/sgi-ip30/Makefile +8 -0
diff -Naurp linux-2.6.26.orig/arch/mips/sgi-ip30/Makefile linux-2.6.26/arch/mips/sgi-ip30/Makefile
@@ -0,0 +1,8 @@
+#
+# Makefile for the IP30 specific kernel interface routines under Linux.
+#
+
+obj-y	:= ip30-setup.o ip30-irq.o ip30-timer.o ip30-err.o ip30-xtalk.o ip30-power.o
+obj-$(CONFIG_SMP)	+= ip30-smp.o ip30-smp-glue.o
+
+EXTRA_AFLAGS := $(CFLAGS)
arch/mips/sgi-ip30/ip30-err.c +42 -0

42 lines not on this page · raw message

arch/mips/sgi-ip30/ip30-irq.c +337 -0

337 lines not on this page · raw message

arch/mips/sgi-ip30/ip30-power.c +132 -0

132 lines not on this page · raw message

arch/mips/sgi-ip30/ip30-setup.c +73 -0

73 lines not on this page · raw message

arch/mips/sgi-ip30/ip30-smp-glue.S +21 -0
diff -Naurp linux-2.6.26.orig/arch/mips/sgi-ip30/ip30-smp-glue.S linux-2.6.26/arch/mips/sgi-ip30/ip30-smp-glue.S
@@ -0,0 +1,21 @@
+/*
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2005-2007 Stanislaw Skowronek
+ */
+
+#include <asm/asm.h>
+#include <asm/mipsregs.h>
+#include <asm/regdef.h>
+#include <asm/stackframe.h>
+
+	.text
+	.set	noat
+	.set	reorder
+	.align	5
+LEAF(ip30_smp_bootstrap)
+	move	gp, a0
+	j	smp_bootstrap
+	END(ip30_smp_bootstrap)
arch/mips/sgi-ip30/ip30-smp.c +165 -0

165 lines not on this page · raw message

arch/mips/sgi-ip30/ip30-timer.c +51 -0

51 lines not on this page · raw message

arch/mips/sgi-ip30/ip30-xtalk.c +182 -0

182 lines not on this page · raw message

drivers/char/Kconfig +19 -0
diff -Naurp linux-2.6.26.orig/drivers/char/Kconfig linux-2.6.26/drivers/char/Kconfig
@@ -819,6 +819,17 @@ config SGI_IP27_RTC
 	  via the file /proc/rtc and its behaviour is set by various ioctls on
 	  /dev/rtc.
 
+config SGI_IP30_RTC
+	bool "SGI Octane RTC support"
+	depends on SGI_IP30 && SGI_IOC3
+	help
+	  If you say Y here and create a character special file /dev/rtc with
+	  major number 10 and minor number 135 using mknod ("man mknod"), you
+	  will get access to the real time clock built into your computer.
+	  Every SGI has such a clock built in. It reports status information
+	  via the file /proc/rtc and its behaviour is set by various ioctls on
+	  /dev/rtc.
+
 config GEN_RTC
 	tristate "Generic /dev/rtc emulation"
 	depends on RTC!=y && !IA64 && !ARM && !M32R && !MIPS && !SPARC && !FRV && !S390 && !SUPERH && !AVR32
@@ -866,6 +877,14 @@ config COBALT_LCD
 	  This option enables support for the LCD display and buttons found
 	  on Cobalt systems through a misc device.
 
+config SGI_IP30_LEDS
+	bool "SGI Octane LED support"
+	depends on SGI_IP30 && SGI_IOC3
+	help
+	  If you say Y here and create a character special file /dev/leds with
+	  major number 10 and minor number 42 using mknod ("man mknod"), you
+	  will be able to control the lightbar on your Octane.
+
 config DTLK
 	tristate "Double Talk PC internal speech card support"
 	depends on ISA
drivers/char/Makefile +2 -0
diff -Naurp linux-2.6.26.orig/drivers/char/Makefile linux-2.6.26/drivers/char/Makefile
@@ -76,6 +76,8 @@ obj-$(CONFIG_GEN_RTC)		+= genrtc.o
 obj-$(CONFIG_EFI_RTC)		+= efirtc.o
 obj-$(CONFIG_SGI_DS1286)	+= ds1286.o
 obj-$(CONFIG_SGI_IP27_RTC)	+= ip27-rtc.o
+obj-$(CONFIG_SGI_IP30_LEDS) += ip30-leds.o
+obj-$(CONFIG_SGI_IP30_RTC) += ip30-rtc.o
 obj-$(CONFIG_DS1302)		+= ds1302.o
 obj-$(CONFIG_XILINX_HWICAP)	+= xilinx_hwicap/
 ifeq ($(CONFIG_GENERIC_NVRAM),y)
drivers/char/ip30-leds.c +280 -0

280 lines not on this page · raw message

drivers/char/ip30-rtc.c +417 -0

417 lines not on this page · raw message

drivers/usb/host/pci-quirks.c +3 -0
diff -Naurp linux-2.6.26.orig/drivers/usb/host/pci-quirks.c linux-2.6.26/drivers/usb/host/pci-quirks.c
@@ -147,6 +147,9 @@ static void __devinit quirk_usb_handoff_
 	unsigned long base = 0;
 	int i;
 
+	if (!pci_enable_device(pdev))
+		return;
+
 	if (!pio_enabled(pdev))
 		return;
 
drivers/video/Kconfig +12 -0
diff -Naurp linux-2.6.26.orig/drivers/video/Kconfig linux-2.6.26/drivers/video/Kconfig
@@ -955,6 +955,18 @@ config FB_ATMEL_STN
 
 	  If unsure, say N.
 
+config FB_IMPACTSR
+	tristate "SGI Octane ImpactSR graphics support"
+	depends on FB && SGI_IP30
+	help
+	  SGI Octane ImpactSR (SI/SSI/MXI/SE/SSE/MXE) graphics card support.
+
+config FB_ODYSSEY
+	tristate "SGI Octane Odyssey graphics support"
+	depends on FB && SGI_IP30
+	help
+	  SGI Octane Odyssey (VPro V6/V8/V10/V12) graphics card support.
+
 config FB_NVIDIA
 	tristate "nVidia Framebuffer Support"
 	depends on FB && PCI
drivers/video/Makefile +2 -0
diff -Naurp linux-2.6.26.orig/drivers/video/Makefile linux-2.6.26/drivers/video/Makefile
@@ -117,6 +117,8 @@ obj-$(CONFIG_FB_SM501)            += sm5
 obj-$(CONFIG_FB_XILINX)           += xilinxfb.o
 obj-$(CONFIG_FB_OMAP)             += omap/
 obj-$(CONFIG_XEN_FBDEV_FRONTEND)  += xen-fbfront.o
+obj-$(CONFIG_FB_IMPACTSR)         += impactsr.o
+obj-$(CONFIG_FB_ODYSSEY)          += odyssey.o
 
 # Platform or fallback drivers go here
 obj-$(CONFIG_FB_UVESA)            += uvesafb.o
drivers/video/impactsr.c +994 -0

710 lines not on this page · raw message

drivers/video/logo/Kconfig +1 -1
diff -Naurp linux-2.6.26.orig/drivers/video/logo/Kconfig linux-2.6.26/drivers/video/logo/Kconfig

Lines of this file are not shown. View the raw message.

drivers/video/odyssey.c +1055 -0

1,055 lines not on this page · raw message

include/asm-mips/addrspace.h +8 -0
diff -Naurp linux-2.6.26.orig/include/asm-mips/addrspace.h linux-2.6.26/include/asm-mips/addrspace.h

Lines of this file are not shown. View the raw message.

include/asm-mips/dma.h +5 -0
diff -Naurp linux-2.6.26.orig/include/asm-mips/dma.h linux-2.6.26/include/asm-mips/dma.h

Lines of this file are not shown. View the raw message.

include/asm-mips/mach-ip30/addrs.h +36 -0
diff -Naurp linux-2.6.26.orig/include/asm-mips/mach-ip30/addrs.h linux-2.6.26/include/asm-mips/mach-ip30/addrs.h

Lines of this file are not shown. View the raw message.

include/asm-mips/mach-ip30/cpu-feature-overrides.h +39 -0
diff -Naurp linux-2.6.26.orig/include/asm-mips/mach-ip30/cpu-feature-overrides.h linux-2.6.26/include/asm-mips/mach-ip30/cpu-feature-overrides.h

Lines of this file are not shown. View the raw message.

include/asm-mips/mach-ip30/dma-coherence.h +90 -0

90 lines not on this page · raw message

include/asm-mips/mach-ip30/ds1687.h +56 -0

56 lines not on this page · raw message

include/asm-mips/mach-ip30/heart.h +231 -0

231 lines not on this page · raw message

include/asm-mips/mach-ip30/leds.h +29 -0
diff -Naurp linux-2.6.26.orig/include/asm-mips/mach-ip30/leds.h linux-2.6.26/include/asm-mips/mach-ip30/leds.h

Lines of this file are not shown. View the raw message.

include/asm-mips/mach-ip30/mangle-port.h +25 -0
diff -Naurp linux-2.6.26.orig/include/asm-mips/mach-ip30/mangle-port.h linux-2.6.26/include/asm-mips/mach-ip30/mangle-port.h

Lines of this file are not shown. View the raw message.

include/asm-mips/mach-ip30/pcibr.h +51 -0

51 lines not on this page · raw message

include/asm-mips/mach-ip30/racermp.h +34 -0
diff -Naurp linux-2.6.26.orig/include/asm-mips/mach-ip30/racermp.h linux-2.6.26/include/asm-mips/mach-ip30/racermp.h

Lines of this file are not shown. View the raw message.

include/asm-mips/mach-ip30/war.h +25 -0
diff -Naurp linux-2.6.26.orig/include/asm-mips/mach-ip30/war.h linux-2.6.26/include/asm-mips/mach-ip30/war.h

Lines of this file are not shown. View the raw message.

include/asm-mips/mach-ip30/xtalk.h +70 -0

70 lines not on this page · raw message

include/asm-mips/pci/bridge.h +11 -0
diff -Naurp linux-2.6.26.orig/include/asm-mips/pci/bridge.h linux-2.6.26/include/asm-mips/pci/bridge.h

Lines of this file are not shown. View the raw message.

include/asm-mips/pci.h +7 -0
diff -Naurp linux-2.6.26.orig/include/asm-mips/pci.h linux-2.6.26/include/asm-mips/pci.h

Lines of this file are not shown. View the raw message.

include/linux/fb.h +2 -0
diff -Naurp linux-2.6.26.orig/include/linux/fb.h linux-2.6.26/include/linux/fb.h

Lines of this file are not shown. View the raw message.

include/linux/miscdevice.h +1 -0
diff -Naurp linux-2.6.26.orig/include/linux/miscdevice.h linux-2.6.26/include/linux/miscdevice.h

Lines of this file are not shown. View the raw message.

include/linux/pci_ids.h +1 -0
diff -Naurp linux-2.6.26.orig/include/linux/pci_ids.h linux-2.6.26/include/linux/pci_ids.h

Lines of this file are not shown. View the raw message.

include/sound/rad1.h +119 -0

119 lines not on this page · raw message

include/video/impactsr.h +138 -0

138 lines not on this page · raw message

include/video/odyssey.h +52 -0

52 lines not on this page · raw message

sound/pci/Kconfig +6 -0
diff -Naurp linux-2.6.26.orig/sound/pci/Kconfig linux-2.6.26/sound/pci/Kconfig

Lines of this file are not shown. View the raw message.

sound/pci/Makefile +2 -0
diff -Naurp linux-2.6.26.orig/sound/pci/Makefile linux-2.6.26/sound/pci/Makefile

Lines of this file are not shown. View the raw message.

sound/pci/rad1.c +1247 -0

1,247 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.

#1 lore raw
Quoted 15 lines · Kumba

The second part is the actual IP30 Patch that makes these beasts boot. Assuming you've already lit incense candles and sacrificed a PC to the MIPS Gods above.

There's one change that probably needs good scrutiny, as it changes a value in dma-default.c, and this'll affect other systems:

diff -Naurp linux-2.6.26.orig/arch/mips/mm/dma-default.c linux-2.6.26/arch/mips/mm/dma-default.c
--- linux-2.6.26.orig/arch/mips/mm/dma-default.c 2008-07-13
17:51:29.000000000 -0400
+++ linux-2.6.26/arch/mips/mm/dma-default.c 2008-07-25
03:14:40.000000000 -0400

arch/mips/mm/dma-default.c 2008-07-25 03:14:40.000000000 -0400 dma_addr_t dma_map_page(struct device *d · line 214

Quoted 7 lines
arch/mips/mm/dma-default.c 2008-07-25 03:14:40.000000000 -0400 renamed from arch/mips/mm/dma-default.c 2008-07-13 17:51:29.000000000 -0400 +1 -1
@@ -209,7 +209,7 @@ dma_addr_t dma_map_page(struct device *d
                dma_cache_wback_inv(addr, size);
        }
 
-       return plat_map_dma_mem_page(dev, page) + offset;
+       return plat_map_dma_mem_page(dev, page, size) + offset;
 }
 

I dont think that is needed.
IMHO This function schould map a whole page, offset and size are only used for a part of that page. So i am using PAGE_SIZE in plat_map_dma_mem_page.

your version
+static dma_addr_t plat_map_dma_mem_page(struct device *dev, struct page *page,
+ size_t size)
+{
+ dma_addr_t pa = dev_to_baddr(dev, page_to_phys(page), 0, size);
+
+ return pa;
+}
+

my version
+static dma_addr_t plat_map_dma_mem_page(struct device *dev, struct page *page,
+ size_t size)
+{
+ dma_addr_t pa = dev_to_baddr(dev, page_to_phys(page), 0, PAGE_SIZE);
+
+ return pa;
+}

Maybe it is only working, because the function dma_map_page is never used in my kernel.

Quoted 5 lines
(quoted diff) +0 -1
 Thanks!,
 
 
--Kumba
#2 lore raw
In reply to Kumba
Quoted 10 lines · Kumba

The second part is the actual IP30 Patch that makes these beasts boot. Assuming you've already lit incense candles and sacrificed a PC to the MIPS Gods above.

That's just one example, though. There's probably more, but I've mostly done forward ports, and haven't really messed with re-writing much. Hence why I'd like to ask others to look, poke, prod, compile, and boot, and see if they have other suggestions for improving and fixing this up.

I think there is a problem on SMP kernels.
In include/asm-mips/mach-ip30/heart.h

Quoted 20 lines
include/asm-mips/mach-ip30/heart.h +20 -0
+/* HEART internal register space */
+#define HEART_PIU_BASE         0x900000000ff00000
+
+/* full addresses */
+#define HEART_MODE             ((volatile ulong *)0x900000000ff00000)
+#define HEART_SDRAM_MODE       ((volatile ulong *)0x900000000ff00008)
+#define HEART_MEM_REF          ((volatile ulong *)0x900000000ff00010)
+#define HEART_MEM_REQ_ARB      ((volatile ulong *)0x900000000ff00018)
+#define        HEART_MEMCFG0           ((volatile ulong *)0x900000000ff00020)
+#define        HEART_MEMCFG1           ((volatile ulong *)0x900000000ff00028)
+#define        HEART_MEMCFG2           ((volatile ulong *)0x900000000ff00030)
+#define        HEART_MEMCFG3           ((volatile ulong *)0x900000000ff00038)
+#define HEART_FC_MODE          ((volatile ulong *)0x900000000ff00040)
+#define HEART_FC_TIMER_LIMIT   ((volatile ulong *)0x900000000ff00048)
+#define HEART_FC0_ADDR         ((volatile ulong *)0x900000000ff00050)
+#define HEART_FC1_ADDR         ((volatile ulong *)0x900000000ff00058)
+#define HEART_FC0_CR_CNT       ((volatile ulong *)0x900000000ff00060)
+#define HEART_FC1_CR_CNT       ((volatile ulong *)0x900000000ff00068)
+#define HEART_FC0_TIMER                ((volatile ulong *)0x900000000ff00070)
+#define HEART_FC1_TIMER                ((volatile ulong *)0x900000000ff00078)

include/asm-mips/mach-ip30/heart.h line 43

Quoted 10 lines
include/asm-mips/mach-ip30/heart.h +9 -0
+#define HEART_STATUS           ((volatile ulong *)0x900000000ff00080)
+#define HEART_BERR_ADDR                ((volatile ulong *)0x900000000ff00088)
+#define HEART_BERR_MISC                ((volatile ulong *)0x900000000ff00090)
+#define HEART_MEMERR_ADDR      ((volatile ulong *)0x900000000ff00098)
+#define HEART_MEMERR_DATA      ((volatile ulong *)0x900000000ff000a0)
+#define HEART_PIUR_ACC_ERR     ((volatile ulong *)0x900000000ff000a8)
+#define        HEART_MLAN_CLK_DIV      ((volatile ulong *)0x900000000ff000b0)
+#define        HEART_MLAN_CTL          ((volatile ulong *)0x900000000ff000b8)
 
+#define HEART_IMR(x)           ((volatile ulong *)0x900000000ff10000 + (8 * (x)))

This gives a wrong address for the second IRQ Mask Register. I schould be.

#define HEART_IMR(x) ((volatile ulong *)(0x900000000ff10000 + (8 * (x))))
. .
this two braces more , because without it 8*8*(x) was added to the base addr. checked in the assembler and on a DUAL IP30.
without it it got stopped early with no output.
with it it stopped much later. sometimes i got a starting and then stopped init. now it goes until initcall genl_init wich is generic netlink init. a smp kernel fully works with only one cpu in both versions.
a patch for a 2.6.20 kernel was more like my versions too.

Quoted 16 lines
include/asm-mips/mach-ip30/heart.h +10 -0
+#define HEART_SET_ISR          ((volatile ulong *)0x900000000ff10020)
+#define HEART_CLR_ISR          ((volatile ulong *)0x900000000ff10028)
+#define HEART_ISR              ((volatile ulong *)0x900000000ff10030)
+#define HEART_IMSR             ((volatile ulong *)0x900000000ff10038)
+#define HEART_CAUSE            ((volatile ulong *)0x900000000ff10040)
+#define HEART_COUNT            ((volatile ulong *)0x900000000ff20000)  /* 52-bit counter */
+#define HEART_COMPARE          ((volatile ulong *)0x900000000ff30000)  /* 24-bit compare */
+#define HEART_TRIGGER          ((volatile ulong *)0x900000000ff40000)
+#define HEART_PRID             ((volatile ulong *)0x900000000ff50000)
+#define HEART_SYNC             ((volatile ulong *)0x900000000ff60000)

Thanks!,

--Kumba

#3 lore raw
In reply to Kumba
Quoted 18 lines · Kumba

The second part is the actual IP30 Patch that makes these beasts boot. Assuming you've already lit incense candles and sacrificed a PC to the MIPS Gods above.

Thanks!,

--Kumba

diff -Naurp linux-2.6.26.orig/arch/mips/kernel/cevt-r4k.c linux-2.6.26/arch/mips/kernel/cevt-r4k.c

arch/mips/kernel/cevt-r4k.c int __cpuinit mips_clockevent_init(void) · line 256

Quoted 7 lines
arch/mips/kernel/cevt-r4k.c +0 -1
@@ -251,7 +251,6 @@ int __cpuinit mips_clockevent_init(void)
 	irq = MIPS_CPU_IRQ_BASE + cp0_compare_irq;
 	if (get_c0_compare_int)
 		irq = get_c0_compare_int();
-
 	cd = &per_cpu(mips_clockevent_device, cpu);
 
 	cd->name		= "MIPS";

I dont think this is needed

Quoted 15 lines

diff -Naurp linux-2.6.26.orig/arch/mips/kernel/setup.c linux-2.6.26/arch/mips/kernel/setup.c

arch/mips/kernel/setup.c +4 -0
@@ -481,6 +481,10 @@ static void __init arch_mem_init(char **
 	printk("Determined physical RAM map:\n");
 	print_memory_map();
 
+#ifdef CONFIG_CMDLINE
+	if (strlen(CONFIG_CMDLINE))
+		strlcpy(arcs_cmdline, CONFIG_CMDLINE, sizeof(command_line));
+#endif
 	strlcpy(command_line, arcs_cmdline, sizeof(command_line));
 	strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
 

arch/mips/kernel/setup.c void __init setup_arch(char **cmdline_p) · line 584

Quoted 7 lines
arch/mips/kernel/setup.c +0 -1
@@ -575,7 +579,6 @@ void __init setup_arch(char **cmdline_p)
 #endif
 
 	arch_mem_init(cmdline_p);
-
 	resource_init();
 	plat_smp_setup();
 }

arcs_cmdline is initialisiert with CONFIG_CMDLINE earlier in this file, so i think this is not needed.

arch/mips/mm/dma-default.c dma_addr_t dma_map_page(struct device *d · line 215

Quoted 12 lines

diff -Naurp linux-2.6.26.orig/arch/mips/mm/dma-default.c linux-2.6.26/arch/mips/mm/dma-default.c

arch/mips/mm/dma-default.c +1 -1
@@ -209,7 +209,7 @@ dma_addr_t dma_map_page(struct device *d
 		dma_cache_wback_inv(addr, size);
 	}
 
-	return plat_map_dma_mem_page(dev, page) + offset;
+	return plat_map_dma_mem_page(dev, page, size) + offset;
 }
 
 EXPORT_SYMBOL(dma_map_page);

see other mail

drivers/usb/host/pci-quirks.c static void __devinit quirk_usb_handoff_ · line 155

Quoted 13 lines

diff -Naurp linux-2.6.26.orig/drivers/usb/host/pci-quirks.c linux-2.6.26/drivers/usb/host/pci-quirks.c

drivers/usb/host/pci-quirks.c +3 -0
@@ -147,6 +147,9 @@ static void __devinit quirk_usb_handoff_
 	unsigned long base = 0;
 	int i;
 
+	if (!pci_enable_device(pdev))
+		return;
+
 	if (!pio_enabled(pdev))
 		return;
 

I am not using this, but i dont have any usb stuff at my Octane

Quoted 8 lines

diff -Naurp linux-2.6.26.orig/include/asm-mips/addrspace.h linux-2.6.26/include/asm-mips/addrspace.h

include/asm-mips/addrspace.h +1 -0
@@ -54,6 +54,14 @@
 #define XPHYSADDR(a)            ((_ACAST64_(a)) &			\
 				 _CONST64_(0x000000ffffffffff))
 
+#ifndef __ASSEMBLY__

include/asm-mips/addrspace.h line 67

Quoted 10 lines
include/asm-mips/addrspace.h +7 -0
+#ifdef CONFIG_64BIT
+unsigned long kernel_physaddr(unsigned long);
+#else
+#define kernel_physaddr CPHYSADDR
+#endif
+#endif
+
 #ifdef CONFIG_64BIT
 
 /*

is this used anyware, i dont have it in my kernel.

Quoted 84 lines

diff -Naurp linux-2.6.26.orig/include/asm-mips/mach-ip30/dma-coherence.h linux-2.6.26/include/asm-mips/mach-ip30/dma-coherence.h

include/asm-mips/mach-ip30/dma-coherence.h +80 -0
@@ -0,0 +1,90 @@
+/*
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2006  Ralf Baechle <[email protected]>
+ *               2007  Joshua Kinard <[email protected]>
+ *
+ * derived from include/asm-mips/mach-ip27/dma-coherence.h
+ * and based on code found in the old dma-ip30.c, which is
+ * Copyright (C) 2004-2007 Stanislaw Skowronek <[email protected]>
+ */
+#ifndef __ASM_MACH_IP30_DMA_COHERENCE_H
+#define __ASM_MACH_IP30_DMA_COHERENCE_H
+
+#include <asm/mach-ip30/addrs.h>
+#include <asm/pci/bridge.h>
+
+#include <linux/dma-mapping.h>
+
+static inline dma_addr_t pdev_to_baddr(struct pci_dev *dev, dma_addr_t addr,
+					int virt, int size)
+{
+	if(dev->dma_mask == DMA_64BIT_MASK) {
+		if(virt)
+			return (BRIDGE_CONTROLLER(dev->bus)->baddr + addr) |
+				PCI64_ATTR_VIRTUAL;
+
+		if(size >= 0x200)
+			return (BRIDGE_CONTROLLER(dev->bus)->baddr + addr) |
+				PCI64_ATTR_PREF;
+
+		if(addr >= 0x20000000 || addr < 0xA0000000)
+			return (PCI32_DIRECT_BASE + addr - 0x20000000);
+
+		return (BRIDGE_CONTROLLER(dev->bus)->baddr + addr);
+	}
+
+	if(addr < 0x20000000 || addr >= 0xA0000000) {
+		printk(KERN_ERR
+			"BRIDGE: Mapping can't be realized in direct DMA.\n");
+		return -1;
+	}
+
+	return (PCI32_DIRECT_BASE + addr - 0x20000000);
+}
+
+static inline dma_addr_t dev_to_baddr(struct device *dev, dma_addr_t addr,
+					int virt, int size)
+{
+	if(dev)
+		return pdev_to_baddr(to_pci_dev(dev), addr, virt, size);
+	return addr;
+}
+
+struct device;
+
+static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr,
+					size_t size)
+{
+	dma_addr_t pa = dev_to_baddr(dev, virt_to_phys(addr), 1, size);
+
+	return pa;
+}
+
+static dma_addr_t plat_map_dma_mem_page(struct device *dev, struct page *page,
+					size_t size)
+{
+	dma_addr_t pa = dev_to_baddr(dev, page_to_phys(page), 0, size);
+
+	return pa;
+}
+
+static unsigned long plat_dma_addr_to_phys(dma_addr_t dma_addr)
+{
+	return dma_addr & (0xffUL << 56);
+}
+
+static inline void plat_unmap_dma_mem(dma_addr_t dma_addr)
+{

include/asm-mips/mach-ip30/dma-coherence.h line 90

Quoted 10 lines
include/asm-mips/mach-ip30/dma-coherence.h +10 -0
+	/* Empty */
+}
+
+static inline int plat_device_is_coherent(struct device *dev)
+{
+	return 1;		/* IP30 non-cohernet mode is unsupported
+				 * (does it even have one?) */
+}
+
+#endif /* __ASM_MACH_IP30_DMA_COHERENCE_H */

see other mail for the size in plat_map_dma_mem_page wich IMHO schould be PAGE_SIZE

bye tanzy