Skip to contentSkip to conversation

ip32 specific stuff

PATCH [email protected] 2 participants 3 messages Jun 30, 2003 MIPS

lore
Share & tools
lore
#0 lore raw

This is the patch that includes most of things that I have in IP32-specific parts of my tree.
1. IRQ handling rewrite by me and Vivien.
2. Propper memory detection pathc by Keith.
3. Some other minor fixlets.

Index: arch/mips/sgi-ip32/Makefile
===================================================================
RCS file: /home/cvs/linux/arch/mips/sgi-ip32/Makefile,v retrieving revision 1.7

mips/sgi-ip32/Makefile +1 -1
diff -u -r1.7 Makefile
@@ -4,6 +4,6 @@
 #
 
 obj-y	+= ip32-berr.o ip32-rtc.o ip32-setup.o ip32-irq.o ip32-irq-glue.o \
-	   ip32-timer.o crime.o ip32-reset.o
+	   ip32-timer.o crime.o ip32-reset.o ip32-memory.o
 
 EXTRA_AFLAGS := $(CFLAGS)

Index: arch/mips/sgi-ip32/crime.c
===================================================================
RCS file: /home/cvs/linux/arch/mips/sgi-ip32/crime.c,v retrieving revision 1.2

mips/sgi-ip32/crime.c +57 -10

102 lines not on this page · raw message

Index: arch/mips/sgi-ip32/ip32-berr.c
===================================================================
RCS file: /home/cvs/linux/arch/mips/sgi-ip32/ip32-berr.c,v retrieving revision 1.4

mips/sgi-ip32/ip32-berr.c +1 -0
diff -u -r1.4 ip32-berr.c
@@ -9,6 +9,7 @@
  */
 #include <linux/init.h>
 #include <linux/kernel.h>
+#include <linux/sched.h>
 #include <asm/traps.h>
 #include <asm/uaccess.h>
 #include <asm/addrspace.h>

Index: arch/mips/sgi-ip32/ip32-irq.c
===================================================================
RCS file: /home/cvs/linux/arch/mips/sgi-ip32/ip32-irq.c,v retrieving revision 1.5

mips/sgi-ip32/ip32-irq.c +70 -83

320 lines not on this page · raw message

Index: arch/mips/sgi-ip32/ip32-setup.c
===================================================================
RCS file: /home/cvs/linux/arch/mips/sgi-ip32/ip32-setup.c,v retrieving revision 1.4

mips/sgi-ip32/ip32-setup.c +31 -18

89 lines not on this page · raw message

Index: include/asm-mips64/ip32/crime.h
===================================================================
RCS file: /home/cvs/linux/include/asm-mips64/ip32/crime.h,v retrieving revision 1.3

asm-mips64/ip32/crime.h +7 -9
diff -u -r1.3 crime.h
@@ -11,7 +11,9 @@
 #ifndef __ASM_CRIME_H__
 #define __ASM_CRIME_H__
 
+#include <asm/types.h>
 #include <asm/addrspace.h>
+#include <asm/io64.h>
 
 /*
  * Address map
@@ -23,12 +25,8 @@
 #endif
 
 #ifndef __ASSEMBLY__
-static inline u64 crime_read_64 (unsigned long __offset) {
-        return *((volatile u64 *) (CRIME_BASE + __offset));
-}
-static inline void crime_write_64 (unsigned long __offset, u64 __val) {
-        *((volatile u64 *) (CRIME_BASE + __offset)) = __val;
-}
+#define crime_read_64(__offset)		__in64(CRIME_BASE+(__offset))
+#define crime_write_64(__offset,__val)	__out64(__val,CRIME_BASE+(__offset))
 #endif
 
 #undef BIT
@@ -179,11 +177,9 @@
  * macros for CRIME memory bank control registers.
  */
 #define CRIME_MEM_BANK_CONTROL(__bank)		(0x00000208 + ((__bank) << 3))
-#define CRIME_MEM_BANK_CONTROL_MSK		0x11f /* 9 bits 7:5 reserved */
+#define CRIME_MEM_BANK_CONTROL_MASK		0x11f /* 9 bits 7:5 reserved */
 #define CRIME_MEM_BANK_CONTROL_ADDR		0x01f
 #define CRIME_MEM_BANK_CONTROL_SDRAM_SIZE	0x100
-#define CRIME_MEM_BANK_CONTROL_BANK_TO_ADDR(__bank) \
-	(((__bank) & CRIME_MEM_BANK_CONTROL_ADDR) << 25)
 
 #define CRIME_MEM_REFRESH_COUNTER	(0x00000248)
 #define CRIME_MEM_REFRESH_COUNTER_MASK	0x7ff	/* 11-bit register */
@@ -206,8 +202,10 @@
 #define CRIME_MEM_ERROR_SOFT_ERR	0x00100000
 #define CRIME_MEM_ERROR_HARD_ERR	0x00200000
 #define CRIME_MEM_ERROR_MULTIPLE	0x00400000
+#define CRIME_MEM_ERROR_ECC		0x01800000
 #define CRIME_MEM_ERROR_MEM_ECC_RD	0x00800000
 #define CRIME_MEM_ERROR_MEM_ECC_RMW	0x01000000
+#define CRIME_MEM_ERROR_INV		0x0e000000
 #define CRIME_MEM_ERROR_INV_MEM_ADDR_RD	0x02000000
 #define CRIME_MEM_ERROR_INV_MEM_ADDR_WR	0x04000000
 #define CRIME_MEM_ERROR_INV_MEM_ADDR_RMW	0x08000000

Index: include/asm-mips64/ip32/mace.h
===================================================================
RCS file: /home/cvs/linux/include/asm-mips64/ip32/mace.h,v retrieving revision 1.6

asm-mips64/ip32/mace.h +75 -5

129 lines not on this page · raw message

asm-mips64/io64.h new file +99 -0

99 lines not on this page · raw message

asm-mips/io64.h new file +99 -0

99 lines not on this page · raw message

mips/sgi-ip32/ip32-memory.c new file +37 -0
@@ -0,0 +1,37 @@
+/*
+ * 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) 2003 Keith M Wesolowski
+ */
+#include <asm/ip32/crime.h>
+#include <asm/bootinfo.h>
+#include <asm/page.h>
+#include <asm/pgtable.h>
+#include <asm/pgalloc.h>
+#include <linux/types.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+
+void __init prom_meminit (void)
+{
+	u64 base, size;
+	int bank;
+
+	for (bank=0; bank < CRIME_MAXBANKS; bank++) {
+		u64 bankctl = crime_read_64(CRIME_MEM_BANK_CONTROL(bank));
+		base = (bankctl & CRIME_MEM_BANK_CONTROL_ADDR) << 25;
+		if (bank != 0 && base == 0)
+			continue;
+		size = (bankctl & CRIME_MEM_BANK_CONTROL_SDRAM_SIZE) ? 128 : 32;
+		printk("CRIME MC: bank %d base 0x%016lx size %luMB\n",
+			bank, base, size);
+		size <<= 20;
+		if (base + size > (256 << 20))
+			continue;
+		add_memory_region (base, size, BOOT_MEM_RAM);
+	}
+}
+
+void __init prom_free_prom_memory (void) { }
#1 lore raw
Quoted 4 lines · On Sun, Jun 29, 2003 at 05:36:36PM -0700, [email protected] wrote:

This is the patch that includes most of things that I have in IP32-specific parts of my tree.

2. Propper memory detection pathc by Keith.

Please don't apply this. It's a mostly nice piece of code with one horrible hack, and we're better off for now staying with CONFIG_ARC_MEMORY until we decide how to best support >256MB of memory.

The CRIME error handling part is golden however.

mips/sgi-ip32/ip32-setup.c line 66

Quoted 9 lines

3. Some other minor fixlets.

void ip32_irq1(struct pt_regs *regs)
Index: arch/mips/sgi-ip32/ip32-setup.c

mips/sgi-ip32/ip32-setup.c +4 -0
+#ifdef CONFIG_FB_SGIO2
+#include "../../../drivers/video/sgio2fb.h"
+void *sgio2fb_mem;
+#endif

You can't reference this because that driver doesn't exist yet. And including that here is kind of ugly anyway.

mips/sgi-ip32/ip32-setup.c line 96

Quoted 5 lines
mips/sgi-ip32/ip32-setup.c +4 -1
-#ifdef CONFIG_SERIAL_CONSOLE
+#ifdef CONFIG_SERIAL_MACE_SGIO2
+#warning O2MACECONSOLE compiled in
+	o2serial_console_init();
+#endif

Debugging snippet leaked in.

mips/sgi-ip32/ip32-setup.c line 118

Quoted 7 lines
mips/sgi-ip32/ip32-setup.c +0 -6
-}
-
-int __init page_is_ram (unsigned long pagenr)
-{
-	/* XXX: to do? */
-	return 1;
 }

Yes, this appears to be unused.

Quoted 3 lines

Index: include/asm-mips64/ip32/crime.h
===================================================================
RCS file: /home/cvs/linux/include/asm-mips64/ip32/crime.h,v

...

asm-mips64/ip32/crime.h line 29

Quoted 8 lines
asm-mips64/ip32/crime.h +2 -6
-static inline u64 crime_read_64 (unsigned long __offset) {
-        return *((volatile u64 *) (CRIME_BASE + __offset));
-}
-static inline void crime_write_64 (unsigned long __offset, u64 __val) {
-        *((volatile u64 *) (CRIME_BASE + __offset)) = __val;
-}
+#define crime_read_64(__offset)		__in64(CRIME_BASE+(__offset))
+#define crime_write_64(__offset,__val)	__out64(__val,CRIME_BASE+(__offset))

You can't do this yet because I just sent Ralf the patch to add those functions, and they're going to be named __raw_readq and __raw_writeq as well. I'll take care of this as soon as that patch is approved.

asm-mips/io64.h

Quoted 2 lines
asm-mips/io64.h new file +0 -0

There will be no io64.h.

Signature · 4 lines
Keith M Wesolowski <[email protected]> http://foobazco.org/~wesolows
------(( Project Foobazco Coordinator and Network Administrator ))------
	"May Buddha bless all stubborn people!"
				-- Uliassutai Karakorum Blake
#2 lore raw

Thanks for comments. I am stopping being lazy right now :)

Quoted 73 lines · Keith M Wesolowski
Quoted 4 lines · On Sun, Jun 29, 2003 at 05:36:36PM -0700, [email protected] wrote:

This is the patch that includes most of things that I have in IP32-specific parts of my tree.

2. Propper memory detection pathc by Keith.

Please don't apply this. It's a mostly nice piece of code with one horrible hack, and we're better off for now staying with CONFIG_ARC_MEMORY until we decide how to best support >256MB of memory.

The CRIME error handling part is golden however.

mips/sgi-ip32/ip32-setup.c line 66

Quoted 9 lines

3. Some other minor fixlets.

void ip32_irq1(struct pt_regs *regs)
Index: arch/mips/sgi-ip32/ip32-setup.c

mips/sgi-ip32/ip32-setup.c +4 -0
+#ifdef CONFIG_FB_SGIO2
+#include "../../../drivers/video/sgio2fb.h"
+void *sgio2fb_mem;
+#endif

You can't reference this because that driver doesn't exist yet. And including that here is kind of ugly anyway.

mips/sgi-ip32/ip32-setup.c line 96

Quoted 5 lines
mips/sgi-ip32/ip32-setup.c +4 -1
-#ifdef CONFIG_SERIAL_CONSOLE
+#ifdef CONFIG_SERIAL_MACE_SGIO2
+#warning O2MACECONSOLE compiled in
+	o2serial_console_init();
+#endif

Debugging snippet leaked in.

mips/sgi-ip32/ip32-setup.c line 118

Quoted 7 lines
mips/sgi-ip32/ip32-setup.c +0 -6
-}
-
-int __init page_is_ram (unsigned long pagenr)
-{
-	/* XXX: to do? */
-	return 1;
 }

Yes, this appears to be unused.

Quoted 3 lines

Index: include/asm-mips64/ip32/crime.h
===================================================================
RCS file: /home/cvs/linux/include/asm-mips64/ip32/crime.h,v

...

asm-mips64/ip32/crime.h line 29

Quoted 8 lines
asm-mips64/ip32/crime.h +2 -6
-static inline u64 crime_read_64 (unsigned long __offset) {
-        return *((volatile u64 *) (CRIME_BASE + __offset));
-}
-static inline void crime_write_64 (unsigned long __offset, u64 __val) {
-        *((volatile u64 *) (CRIME_BASE + __offset)) = __val;
-}
+#define crime_read_64(__offset)		__in64(CRIME_BASE+(__offset))
+#define crime_write_64(__offset,__val)	__out64(__val,CRIME_BASE+(__offset))

You can't do this yet because I just sent Ralf the patch to add those functions, and they're going to be named __raw_readq and __raw_writeq as well. I'll take care of this as soon as that patch is approved.

asm-mips/io64.h

Quoted 2 lines
asm-mips/io64.h new file +0 -0

There will be no io64.h.

Signature · 4 lines
Keith M Wesolowski <[email protected]> http://foobazco.org/~wesolows
------(( Project Foobazco Coordinator and Network Administrator ))------
	"May Buddha bless all stubborn people!"
				-- Uliassutai Karakorum Blake