summaryrefslogtreecommitdiffstats
path: root/include/asm-mips
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-mips')
-rw-r--r--include/asm-mips/bitops.h155
-rw-r--r--include/asm-mips/bootinfo.h2
-rw-r--r--include/asm-mips/current.h33
-rw-r--r--include/asm-mips/delay.h12
-rw-r--r--include/asm-mips/io.h30
-rw-r--r--include/asm-mips/jazz.h2
-rw-r--r--include/asm-mips/keyboard.h198
-rw-r--r--include/asm-mips/mipsprom.h74
-rw-r--r--include/asm-mips/offset.h9
-rw-r--r--include/asm-mips/poll.h2
-rw-r--r--include/asm-mips/processor.h9
-rw-r--r--include/asm-mips/sgidefs.h24
-rw-r--r--include/asm-mips/sni.h5
-rw-r--r--include/asm-mips/spinlock.h2
-rw-r--r--include/asm-mips/system.h19
15 files changed, 353 insertions, 223 deletions
diff --git a/include/asm-mips/bitops.h b/include/asm-mips/bitops.h
index d28a881a4..59a6ccbba 100644
--- a/include/asm-mips/bitops.h
+++ b/include/asm-mips/bitops.h
@@ -19,15 +19,15 @@
* Only disable interrupt for kernel mode stuff to keep usermode stuff
* that dares to use kernel include files alive.
*/
-#define __flags unsigned long flags
-#define __cli() cli()
-#define __save_flags(x) save_flags(x)
-#define __restore_flags(x) restore_flags(x)
+#define __bi_flags unsigned long flags
+#define __bi_cli() __cli()
+#define __bi_save_flags(x) __save_flags(x)
+#define __bi_restore_flags(x) __restore_flags(x)
#else
-#define __flags
-#define __cli()
-#define __save_flags(x)
-#define __restore_flags(x)
+#define __bi_flags
+#define __bi_cli()
+#define __bi_save_flags(x)
+#define __bi_restore_flags(x)
#endif /* __KERNEL__ */
/*
@@ -35,9 +35,13 @@
* elements. With respect to a future 64 bit implementation it is
* wrong to use long *. Use u32 * or int *.
*/
-extern __inline__ int set_bit(int nr, void *addr);
-extern __inline__ int clear_bit(int nr, void *addr);
-extern __inline__ int change_bit(int nr, void *addr);
+extern __inline__ void set_bit(int nr, void *addr);
+extern __inline__ void clear_bit(int nr, void *addr);
+extern __inline__ void change_bit(int nr, void *addr);
+extern __inline__ int test_and_set_bit(int nr, void *addr);
+extern __inline__ int test_and_clear_bit(int nr, void *addr);
+extern __inline__ int test_and_change_bit(int nr, void *addr);
+
extern __inline__ int test_bit(int nr, const void *addr);
#ifndef __MIPSEB__
extern __inline__ int find_first_zero_bit (void *addr, unsigned size);
@@ -57,7 +61,42 @@ extern __inline__ unsigned long ffz(unsigned long word);
/*
* The following functions will only work for the R4000!
*/
-extern __inline__ int set_bit(int nr, void *addr)
+
+extern __inline__ void set_bit(int nr, void *addr)
+{
+ int mask, mw;
+
+ addr += ((nr >> 3) & ~3);
+ mask = 1 << (nr & 0x1f);
+ do {
+ mw = load_linked(addr);
+ } while (!store_conditional(addr, mw|mask));
+}
+
+extern __inline__ void clear_bit(int nr, void *addr)
+{
+ int mask, mw;
+
+ addr += ((nr >> 3) & ~3);
+ mask = 1 << (nr & 0x1f);
+ do {
+ mw = load_linked(addr);
+ }
+ while (!store_conditional(addr, mw & ~mask));
+}
+
+extern __inline__ void change_bit(int nr, void *addr)
+{
+ int mask, mw;
+
+ addr += ((nr >> 3) & ~3);
+ mask = 1 << (nr & 0x1f);
+ do {
+ mw = load_linked(addr);
+ } while (!store_conditional(addr, mw ^ mask));
+}
+
+extern __inline__ int test_and_set_bit(int nr, void *addr)
{
int mask, retval, mw;
@@ -71,7 +110,7 @@ extern __inline__ int set_bit(int nr, void *addr)
return retval;
}
-extern __inline__ int clear_bit(int nr, void *addr)
+extern __inline__ int test_and_clear_bit(int nr, void *addr)
{
int mask, retval, mw;
@@ -86,7 +125,7 @@ extern __inline__ int clear_bit(int nr, void *addr)
return retval;
}
-extern __inline__ int change_bit(int nr, void *addr)
+extern __inline__ int test_and_change_bit(int nr, void *addr)
{
int mask, retval, mw;
@@ -102,61 +141,103 @@ extern __inline__ int change_bit(int nr, void *addr)
#else /* MIPS I */
-extern __inline__ int set_bit(int nr, void * addr)
+extern __inline__ void set_bit(int nr, void * addr)
+{
+ int mask;
+ int *a = addr;
+ __bi_flags;
+
+ a += nr >> 5;
+ mask = 1 << (nr & 0x1f);
+ __bi_save_flags(flags);
+ __bi_cli();
+ *a |= mask;
+ __bi_restore_flags(flags);
+}
+
+extern __inline__ void clear_bit(int nr, void * addr)
+{
+ int mask;
+ int *a = addr;
+ __bi_flags;
+
+ a += nr >> 5;
+ mask = 1 << (nr & 0x1f);
+ __bi_save_flags(flags);
+ __bi_cli();
+ *a &= ~mask;
+ __bi_restore_flags(flags);
+}
+
+extern __inline__ void change_bit(int nr, void * addr)
+{
+ int mask;
+ int *a = addr;
+ __bi_flags;
+
+ a += nr >> 5;
+ mask = 1 << (nr & 0x1f);
+ __bi_save_flags(flags);
+ __bi_cli();
+ *a ^= mask;
+ __bi_restore_flags(flags);
+}
+
+extern __inline__ int test_and_set_bit(int nr, void * addr)
{
int mask, retval;
int *a = addr;
- __flags;
+ __bi_flags;
a += nr >> 5;
mask = 1 << (nr & 0x1f);
- __save_flags(flags);
- __cli();
+ __bi_save_flags(flags);
+ __bi_cli();
retval = (mask & *a) != 0;
*a |= mask;
- __restore_flags(flags);
+ __bi_restore_flags(flags);
return retval;
}
-extern __inline__ int clear_bit(int nr, void * addr)
+extern __inline__ int test_and_clear_bit(int nr, void * addr)
{
int mask, retval;
int *a = addr;
- __flags;
+ __bi_flags;
a += nr >> 5;
mask = 1 << (nr & 0x1f);
- __save_flags(flags);
- __cli();
+ __bi_save_flags(flags);
+ __bi_cli();
retval = (mask & *a) != 0;
*a &= ~mask;
- __restore_flags(flags);
+ __bi_restore_flags(flags);
return retval;
}
-extern __inline__ int change_bit(int nr, void * addr)
+extern __inline__ int test_and_change_bit(int nr, void * addr)
{
int mask, retval;
int *a = addr;
- __flags;
+ __bi_flags;
a += nr >> 5;
mask = 1 << (nr & 0x1f);
- __save_flags(flags);
- __cli();
+ __bi_save_flags(flags);
+ __bi_cli();
retval = (mask & *a) != 0;
*a ^= mask;
- __restore_flags(flags);
+ __bi_restore_flags(flags);
return retval;
}
-#undef __flags
-#undef __cli()
-#undef __save_flags(x)
-#undef __restore_flags(x)
+#undef __bi_flags
+#undef __bi_cli()
+#undef __bi_save_flags(x)
+#undef __bi_restore_flags(x)
#endif /* MIPS I */
@@ -443,8 +524,8 @@ found_middle:
#else /* !(__MIPSEB__) */
/* Native ext2 byte ordering, just collapse using defines. */
-#define ext2_set_bit(nr, addr) set_bit((nr), (addr))
-#define ext2_clear_bit(nr, addr) clear_bit((nr), (addr))
+#define ext2_set_bit(nr, addr) test_and_set_bit((nr), (addr))
+#define ext2_clear_bit(nr, addr) test_and_clear_bit((nr), (addr))
#define ext2_test_bit(nr, addr) test_bit((nr), (addr))
#define ext2_find_first_zero_bit(addr, size) find_first_zero_bit((addr), (size))
#define ext2_find_next_zero_bit(addr, size, offset) \
@@ -454,8 +535,8 @@ found_middle:
* Bitmap functions for the minix filesystem.
* FIXME: These assume that Minix uses the native byte/bitorder.
*/
-#define minix_set_bit(nr,addr) set_bit(nr,addr)
-#define minix_clear_bit(nr,addr) clear_bit(nr,addr)
+#define minix_set_bit(nr,addr) test_and_set_bit(nr,addr)
+#define minix_clear_bit(nr,addr) test_and_clear_bit(nr,addr)
#define minix_test_bit(nr,addr) test_bit(nr,addr)
#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
#endif /* __KERNEL__ */
diff --git a/include/asm-mips/bootinfo.h b/include/asm-mips/bootinfo.h
index 2816e599f..e723cae21 100644
--- a/include/asm-mips/bootinfo.h
+++ b/include/asm-mips/bootinfo.h
@@ -5,7 +5,7 @@
* Stoned Elipot and Paul M. Antoine.
*
* This file is subject to the terms and conditions of the GNU General Public
- * License. See the file README.legal in the main directory of this archive
+ * License. See the file COPYING in the main directory of this archive
* for more details.
*/
#ifndef __ASM_MIPS_BOOTINFO_H
diff --git a/include/asm-mips/current.h b/include/asm-mips/current.h
index 7955aad50..743f91902 100644
--- a/include/asm-mips/current.h
+++ b/include/asm-mips/current.h
@@ -1,13 +1,34 @@
#ifndef __ASM_MIPS_CURRENT_H
#define __ASM_MIPS_CURRENT_H
+#ifdef __LANGUAGE_C__
+
+static inline struct task_struct *__get_current(void)
+{
+ struct task_struct *__current;
+
+ __asm__("ori\t%0,$29,%1\n\t"
+ "xori\t%0,%1"
+ :"=r" (__current)
+ :"ir" (8191UL));
+
+ return __current;
+}
+
+#define current __get_current()
+
+#endif /* __LANGUAGE_C__ */
+#ifdef __LANGUAGE_ASSEMBLY__
+
/*
- * Some architectures may want to do something "clever" here since
- * this is the most frequently accessed piece of data in the entire
- * kernel. For an example, see the Sparc implementation where an
- * entire register is hard locked to contain the value of current.
+ * Get current task pointer
*/
-extern struct task_struct *current_set[NR_CPUS];
-#define current (current_set[smp_processor_id()]) /* Current on this processor */
+#define GET_CURRENT(reg) \
+ lui reg, %hi(kernelsp); \
+ lw reg, %lo(kernelsp)(reg); \
+ ori reg, 8191; \
+ xori reg, 8191
+
+#endif
#endif /* __ASM_MIPS_CURRENT_H */
diff --git a/include/asm-mips/delay.h b/include/asm-mips/delay.h
index d7d6e269d..ec2ad70f3 100644
--- a/include/asm-mips/delay.h
+++ b/include/asm-mips/delay.h
@@ -22,16 +22,24 @@ extern __inline__ void __delay(int loops)
* first constant multiplications gets optimized away if the delay is
* a constant)
*/
-extern __inline__ void udelay(unsigned long usecs)
+extern __inline__ void __udelay(unsigned long usecs, unsigned long lps)
{
usecs *= 0x000010c6; /* 2**32 / 1000000 */
__asm__("multu\t%0,%1\n\t"
"mfhi\t%0"
:"=r" (usecs)
- :"0" (usecs),"r" (loops_per_sec));
+ :"0" (usecs),"r" (lps));
__delay(usecs);
}
+#ifdef __SMP__
+#define __udelay_val cpu_data[smp_processor_id()].udelay_val
+#else
+#define __udelay_val loops_per_sec
+#endif
+
+#define udelay(usecs) __udelay((usecs),__udelay_val)
+
/*
* The different variants for 32/64 bit are pure paranoia. The typical
* range of numbers that appears for MIPS machines avoids overflows.
diff --git a/include/asm-mips/io.h b/include/asm-mips/io.h
index 28ec2f73f..be0d068a4 100644
--- a/include/asm-mips/io.h
+++ b/include/asm-mips/io.h
@@ -1,6 +1,11 @@
#ifndef __ASM_MIPS_IO_H
#define __ASM_MIPS_IO_H
+/*
+ * Slowdown I/O port space accesses for antique hardware.
+ */
+#undef CONF_SLOWDOWN_IO
+
#include <asm/mipsconfig.h>
#include <asm/addrspace.h>
@@ -35,6 +40,7 @@
* I feel a bit unsafe about using 0x80 (should be safe, though)
*
* Linus
+ *
*/
#define __SLOW_DOWN_IO \
@@ -42,11 +48,15 @@
"sb\t$0,0x80(%0)" \
: : "r" (PORT_BASE));
+#ifdef CONF_SLOWDOWN_IO
#ifdef REALLY_SLOW_IO
#define SLOW_DOWN_IO { __SLOW_DOWN_IO; __SLOW_DOWN_IO; __SLOW_DOWN_IO; __SLOW_DOWN_IO; }
#else
#define SLOW_DOWN_IO __SLOW_DOWN_IO
#endif
+#else
+#define SLOW_DOWN_IO
+#endif
/*
* Change virtual addresses to physical addresses and vv.
@@ -54,12 +64,12 @@
*/
extern inline unsigned long virt_to_phys(volatile void * address)
{
- return (unsigned long) address - KSEG0;
+ return PHYSADDR(address);
}
extern inline void * phys_to_virt(unsigned long address)
{
- return (void *) address + KSEG0;
+ return (void *)KSEG0ADDR(address);
}
extern void * ioremap(unsigned long phys_addr, unsigned long size);
@@ -67,10 +77,16 @@ extern void iounmap(void *addr);
/*
* IO bus memory addresses are also 1:1 with the physical address
- * FIXME: This assumption is wrong for the Deskstation Tyne
*/
-#define virt_to_bus virt_to_phys
-#define bus_to_virt phys_to_virt
+extern inline unsigned long virt_to_bus(volatile void * address)
+{
+ return PHYSADDR(address);
+}
+
+extern inline void * bus_to_virt(unsigned long address)
+{
+ return (void *)KSEG0ADDR(address);
+}
/*
* isa_slot_offset is the address where E(ISA) busaddress 0 is is mapped
@@ -111,6 +127,10 @@ extern inline void iounmap(void *addr)
{
}
+/*
+ * XXX We need system specific versions of these to handle EISA address bits
+ * 24-31 on SNI.
+ */
#define readb(addr) (*(volatile unsigned char *) (isa_slot_offset + (unsigned long)(addr)))
#define readw(addr) (*(volatile unsigned short *) (isa_slot_offset + (unsigned long)(addr)))
#define readl(addr) (*(volatile unsigned int *) (isa_slot_offset + (unsigned long)(addr)))
diff --git a/include/asm-mips/jazz.h b/include/asm-mips/jazz.h
index 2f6e4b225..41ab89634 100644
--- a/include/asm-mips/jazz.h
+++ b/include/asm-mips/jazz.h
@@ -311,4 +311,6 @@ extern inline unsigned int r4030_write_reg32(unsigned addr, unsigned val)
#define JAZZ_RTC_BASE 0xe0004000
#define JAZZ_PORT_BASE 0xe2000000
+#define JAZZ_EISA_BASE 0xe3000000
+
#endif /* __ASM_MIPS_JAZZ_H */
diff --git a/include/asm-mips/keyboard.h b/include/asm-mips/keyboard.h
index 04dada787..2c4396f04 100644
--- a/include/asm-mips/keyboard.h
+++ b/include/asm-mips/keyboard.h
@@ -4,12 +4,34 @@
* 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.
+ *
+ * This file is a mess. Put on your peril sensitive glasses.
*/
#ifndef __ASM_MIPS_KEYBOARD_H
#define __ASM_MIPS_KEYBOARD_H
+#ifdef __KERNEL__
+
#include <linux/config.h>
#include <linux/delay.h>
+#include <linux/ioport.h>
+
+extern int pckbd_setkeycode(unsigned int scancode, unsigned int keycode);
+extern int pckbd_getkeycode(unsigned int scancode);
+extern int pckbd_pretranslate(unsigned char scancode, char raw_mode);
+extern int pckbd_translate(unsigned char scancode, unsigned char *keycode,
+ char raw_mode);
+extern char pckbd_unexpected_up(unsigned char keycode);
+extern void pckbd_leds(unsigned char leds);
+extern void pckbd_init_hw(void);
+
+#define kbd_setkeycode pckbd_setkeycode
+#define kbd_getkeycode pckbd_getkeycode
+#define kbd_pretranslate pckbd_pretranslate
+#define kbd_translate pckbd_translate
+#define kbd_unexpected_up pckbd_unexpected_up
+#define kbd_leds pckbd_leds
+#define kbd_init_hw pckbd_init_hw
/*
* The default IO slowdown is doing 'inb()'s from 0x61, which should be
@@ -21,6 +43,13 @@
#define SLOW_IO_BY_JUMPING
#include <asm/io.h>
+/*
+ * keyboard controller registers
+ */
+#define KBD_STATUS_REG (unsigned int) 0x64
+#define KBD_CNTL_REG (unsigned int) 0x64
+#define KBD_DATA_REG (unsigned int) 0x60
+
#ifdef CONFIG_SGI
#include <asm/segment.h>
#include <asm/sgihpc.h>
@@ -44,8 +73,8 @@
#ifndef CONFIG_SGI
#define KBD_REPORT_ERR
#endif
-
-__initfunc(int initialize_kbd(void));
+#define KBD_REPORT_UNKN
+/* #define KBD_IS_FOCUS_9000 */
int (*kbd_inb_p)(unsigned short port);
int (*kbd_inb)(unsigned short port);
@@ -60,14 +89,16 @@ void (*kbd_outb)(unsigned char data, unsigned short port);
/* XXX Define both and ... */
#ifdef CONFIG_MIPS_JAZZ
#define INIT_KBD /* full initialization for the keyboard controller. */
-static volatile keyboard_hardware *kh = (void *) JAZZ_KEYBOARD_ADDRESS;
+#define __khtype keyboard_hardware
#endif
#ifdef CONFIG_SGI
#define INIT_KBD /* full initialization for the keyboard controller. */
-volatile struct hpc_keyb *kh = (struct hpc_keyb *) (KSEG1 + 0x1fbd9800 + 64);
+#define __khtype struct hpc_keyb
#endif
+static volatile __khtype *kh;
+
static int
jazz_kbd_inb_p(unsigned short port)
{
@@ -147,158 +178,14 @@ port_kbd_outb(unsigned char data, unsigned short port)
return outb(data, port);
}
-#ifdef INIT_KBD
-static int
-kbd_wait_for_input(void)
-{
- int n;
- int status, data;
-
- n = TIMEOUT_CONST;
- do {
- status = kbd_inb(KBD_STATUS_REG);
- /*
- * Wait for input data to become available. This bit will
- * then be cleared by the following read of the DATA
- * register.
- */
-
- if (!(status & KBD_OBF))
- continue;
-
- data = kbd_inb(KBD_DATA_REG);
-
- /*
- * Check to see if a timeout error has occurred. This means
- * that transmission was started but did not complete in the
- * normal time cycle. PERR is set when a parity error occurred
- * in the last transmission.
- */
- if (status & (KBD_GTO | KBD_PERR)) {
- continue;
- }
- return (data & 0xff);
- } while (--n);
- return (-1); /* timed-out if fell through to here... */
-}
-
-static void kbd_write(int address, int data)
-{
- int status;
-
- do {
- status = kbd_inb(KBD_STATUS_REG); /* spin until input buffer empty*/
- } while (status & KBD_IBF);
- kbd_outb(data, address); /* write out the data*/
-}
-
-__initfunc(int initialize_kbd(void))
-{
- unsigned long flags;
-
- save_flags(flags); cli();
-
- /* Flush any pending input. */
- while (kbd_wait_for_input() != -1)
- continue;
+static inline void kb_wait(void);
+static int send_data(unsigned char data);
- /*
- * Test the keyboard interface.
- * This seems to be the only way to get it going.
- * If the test is successful a x55 is placed in the input buffer.
- */
- kbd_write(KBD_CNTL_REG, KBD_SELF_TEST);
- if (kbd_wait_for_input() != 0x55) {
- printk(KERN_WARNING "initialize_kbd: "
- "keyboard failed self test.\n");
- restore_flags(flags);
- return(-1);
- }
-
- /*
- * Perform a keyboard interface test. This causes the controller
- * to test the keyboard clock and data lines. The results of the
- * test are placed in the input buffer.
- */
- kbd_write(KBD_CNTL_REG, KBD_SELF_TEST2);
- if (kbd_wait_for_input() != 0x00) {
- printk(KERN_WARNING "initialize_kbd: "
- "keyboard failed self test 2.\n");
- restore_flags(flags);
- return(-1);
- }
-
- /* Enable the keyboard by allowing the keyboard clock to run. */
- kbd_write(KBD_CNTL_REG, KBD_CNTL_ENABLE);
-
- /*
- * Reset keyboard. If the read times out
- * then the assumption is that no keyboard is
- * plugged into the machine.
- * This defaults the keyboard to scan-code set 2.
- */
- kbd_write(KBD_DATA_REG, KBD_RESET);
- if (kbd_wait_for_input() != KBD_ACK) {
- printk(KERN_WARNING "initialize_kbd: "
- "reset kbd failed, no ACK.\n");
- restore_flags(flags);
- return(-1);
- }
-
- /*
- * Give the keyboard some time to breathe ...
- * ... or it fucks up the floppy controller, too. Wiered.
- */
- udelay(20);
-
- if (kbd_wait_for_input() != KBD_POR) {
- printk(KERN_WARNING "initialize_kbd: "
- "reset kbd failed, not POR.\n");
- restore_flags(flags);
- return(-1);
- }
-
- /*
- * now do a DEFAULTS_DISABLE always
- */
- kbd_write(KBD_DATA_REG, KBD_DISABLE);
- if (kbd_wait_for_input() != KBD_ACK) {
- printk(KERN_WARNING "initialize_kbd: "
- "disable kbd failed, no ACK.\n");
- restore_flags(flags);
- return(-1);
- }
-
- /*
- * Enable keyboard interrupt, operate in "sys" mode,
- * enable keyboard (by clearing the disable keyboard bit),
- * disable mouse, do conversion of keycodes.
- */
- kbd_write(KBD_CNTL_REG, KBD_WRITE_MODE);
- kbd_write(KBD_DATA_REG, KBD_EKI|KBD_SYS|KBD_DMS|KBD_KCC);
-
- /*
- * now ENABLE the keyboard to set it scanning...
- */
- kbd_write(KBD_DATA_REG, KBD_ENABLE);
- if (kbd_wait_for_input() != KBD_ACK) {
- printk(KERN_WARNING "initialize_kbd: "
- "keyboard enable failed.\n");
- restore_flags(flags);
- return(-1);
- }
-
- restore_flags(flags);
-
- return (1);
-}
-#endif
-
-extern __inline__ void
-keyboard_setup(void)
+extern __inline__ void keyboard_setup(void)
{
#ifdef CONFIG_MIPS_JAZZ
if (mips_machgroup == MACH_GROUP_JAZZ) {
+ kh = (void *) JAZZ_KEYBOARD_ADDRESS;
kbd_inb_p = jazz_kbd_inb_p;
kbd_inb = jazz_kbd_inb;
kbd_outb_p = jazz_kbd_outb_p;
@@ -308,7 +195,6 @@ keyboard_setup(void)
*/
*((volatile u16 *)JAZZ_IO_IRQ_ENABLE) |= JAZZ_IE_KEYBOARD;
set_cp0_status(IE_IRQ1, IE_IRQ1);
- initialize_kbd();
} else
#endif
if (mips_machgroup == MACH_GROUP_ARC || /* this is for Deskstation */
@@ -334,6 +220,12 @@ keyboard_setup(void)
if (!send_data(0xf0) || !send_data(0x02))
printk("Scanmode 2 change failed\n");
}
+#ifdef CONFIG_SGI
+ if (mips_machgroup == MACH_SGI_INDY) {
+ kh = (struct hpc_keyb *) (KSEG1 + 0x1fbd9800 + 64);
+ }
+#endif
}
+#endif /* __KERNEL */
#endif /* __ASM_MIPS_KEYBOARD_H */
diff --git a/include/asm-mips/mipsprom.h b/include/asm-mips/mipsprom.h
new file mode 100644
index 000000000..ce7cff7f1
--- /dev/null
+++ b/include/asm-mips/mipsprom.h
@@ -0,0 +1,74 @@
+#ifndef __ASM_MIPS_PROM_H
+#define __ASM_MIPS_PROM_H
+
+#define PROM_RESET 0
+#define PROM_EXEC 1
+#define PROM_RESTART 2
+#define PROM_REINIT 3
+#define PROM_REBOOT 4
+#define PROM_AUTOBOOT 5
+#define PROM_OPEN 6
+#define PROM_READ 7
+#define PROM_WRITE 8
+#define PROM_IOCTL 9
+#define PROM_CLOSE 10
+#define PROM_GETCHAR 11
+#define PROM_PUTCHAR 12
+#define PROM_SHOWCHAR 13 /* XXX */
+#define PROM_GETS 14 /* XXX */
+#define PROM_PUTS 15 /* XXX */
+#define PROM_PRINTF 16 /* XXX */
+
+/* What are these for? */
+#define PROM_INITPROTO 17 /* XXX */
+#define PROM_PROTOENABLE 18 /* XXX */
+#define PROM_PROTODISABLE 19 /* XXX */
+#define PROM_GETPKT 20 /* XXX */
+#define PROM_PUTPKT 21 /* XXX */
+
+/* More PROM shit. Probably has to do with VME RMW cycles??? */
+#define PROM_ORW_RMW 22 /* XXX */
+#define PROM_ORH_RMW 23 /* XXX */
+#define PROM_ORB_RMW 24 /* XXX */
+#define PROM_ANDW_RMW 25 /* XXX */
+#define PROM_ANDH_RMW 26 /* XXX */
+#define PROM_ANDB_RMW 27 /* XXX */
+
+/* Cache handling stuff */
+#define PROM_FLUSHCACHE 28 /* XXX */
+#define PROM_CLEARCACHE 29 /* XXX */
+
+/* Libc alike stuff */
+#define PROM_SETJMP 30 /* XXX */
+#define PROM_LONGJMP 31 /* XXX */
+#define PROM_BEVUTLB 32 /* XXX */
+#define PROM_GETENV 33 /* XXX */
+#define PROM_SETENV 34 /* XXX */
+#define PROM_ATOB 35 /* XXX */
+#define PROM_STRCMP 36 /* XXX */
+#define PROM_STRLEN 37 /* XXX */
+#define PROM_STRCPY 38 /* XXX */
+#define PROM_STRCAT 39 /* XXX */
+
+/* Misc stuff */
+#define PROM_PARSER 40 /* XXX */
+#define PROM_RANGE 41 /* XXX */
+#define PROM_ARGVIZE 42 /* XXX */
+#define PROM_HELP 43 /* XXX */
+
+/* Entry points for some PROM commands */
+#define PROM_DUMPCMD 44 /* XXX */
+#define PROM_SETENVCMD 45 /* XXX */
+#define PROM_UNSETENVCMD 46 /* XXX */
+#define PROM_PRINTENVCMD 47 /* XXX */
+#define PROM_BEVEXCEPT 48 /* XXX */
+#define PROM_ENABLECMD 49 /* XXX */
+#define PROM_DISABLECMD 50 /* XXX */
+
+#define PROM_CLEARNOFAULT 51 /* XXX */
+#define PROM_NOTIMPLEMENT 52 /* XXX */
+
+#define PROM_NV_GET 53 /* XXX */
+#define PROM_NV_SET 54 /* XXX */
+
+#endif /* __ASM_MIPS_PROM_H */
diff --git a/include/asm-mips/offset.h b/include/asm-mips/offset.h
index c5e6f37fa..0f6e63a25 100644
--- a/include/asm-mips/offset.h
+++ b/include/asm-mips/offset.h
@@ -48,12 +48,11 @@
/* MIPS task_struct offsets. */
#define TASK_STATE 0
+#define TASK_COUNTER 4
#define TASK_PRIORITY 8
#define TASK_SIGNAL 12
#define TASK_BLOCKED 16
#define TASK_FLAGS 20
-#define TASK_SAVED_KSTACK 84
-#define TASK_KSTACK_PG 88
#define TASK_MM 912
/* MIPS specific thread_struct offsets. */
@@ -82,8 +81,8 @@
#define THREAD_OLDCTX 896
/* Linux mm_struct offsets. */
-#define MM_COUNT 0
-#define MM_PGD 4
-#define MM_CONTEXT 8
+#define MM_COUNT 12
+#define MM_PGD 8
+#define MM_CONTEXT 28
#endif /* !(_MIPS_OFFSET_H) */
diff --git a/include/asm-mips/poll.h b/include/asm-mips/poll.h
index a1d2a47d3..12c1a5ec3 100644
--- a/include/asm-mips/poll.h
+++ b/include/asm-mips/poll.h
@@ -11,7 +11,7 @@
#define POLLRDNORM 0x0040
#define POLLRDBAND 0x0080
-#define POLLWRNORM POLLOUT /* XXX */
+#define POLLWRNORM POLLOUT
#define POLLWRBAND 0x0100
/* XXX This one seems to be more-or-less nonstandard. */
diff --git a/include/asm-mips/processor.h b/include/asm-mips/processor.h
index b202ac4ca..0c47c2580 100644
--- a/include/asm-mips/processor.h
+++ b/include/asm-mips/processor.h
@@ -109,7 +109,7 @@ struct thread_struct {
#endif /* !defined (__LANGUAGE_ASSEMBLY__) */
#define INIT_MMAP { &init_mm, KSEG0, KSEG1, PAGE_SHARED, \
- VM_READ | VM_WRITE | VM_EXEC }
+ VM_READ | VM_WRITE | VM_EXEC, NULL, &init_mm.mmap }
#define INIT_TSS { \
/* \
@@ -128,7 +128,7 @@ struct thread_struct {
/* \
* Other stuff associated with the process \
*/ \
- 0, 0, 0, sizeof(init_kernel_stack) + (unsigned long)init_kernel_stack - 8, \
+ 0, 0, 0, (unsigned long)&init_task_union + KERNEL_STACK_SIZE - 8, \
(unsigned long) swapper_pg_dir, \
/* \
* For now the default is to fix address errors \
@@ -167,9 +167,8 @@ extern void start_thread(struct pt_regs * regs, unsigned long pc, unsigned long
#define alloc_task_struct() kmalloc(sizeof(struct task_struct), GFP_KERNEL)
#define free_task_struct(p) kfree(p)
-/* Kernel stack allocation/freeing. */
-extern unsigned long alloc_kernel_stack(struct task_struct *tsk);
-extern void free_kernel_stack(unsigned long stack);
+#define init_task (init_task_union.task)
+#define init_stack (init_task_union.stack)
#endif /* !defined (__LANGUAGE_ASSEMBLY__) */
#endif /* __KERNEL__ */
diff --git a/include/asm-mips/sgidefs.h b/include/asm-mips/sgidefs.h
index 23dc0447f..72d25346a 100644
--- a/include/asm-mips/sgidefs.h
+++ b/include/asm-mips/sgidefs.h
@@ -1,6 +1,4 @@
/*
- * Makefile for MIPS Linux main source directory
- *
* 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.
@@ -18,12 +16,32 @@
* problem. The kernel sources are aware of this problem, so we don't warn
* when compiling the kernel.
*/
+#if !defined(_MIPS_ISA) && !defined(__KERNEL__)
+#warning "Macro _MIPS_ISA has not been defined by specs file"
+#endif
+
+#if !defined(_MIPS_SIM) && !defined(__KERNEL__)
+#warning "Macro _MIPS_SIM has not been defined by specs file"
+#endif
+
+#if !defined(_MIPS_SZINT) && !defined(__KERNEL__)
+#warning "Macro _MIPS_SZINT has not been defined by specs file"
+#endif
+
+#if !defined(_MIPS_SZLONG) && !defined(__KERNEL__)
+#warning "Macro _MIPS_SZLONG has not been defined by specs file"
+#endif
+
+#if !defined(_MIPS_SZPTR) && !defined(__KERNEL__)
+#warning "Macro _MIPS_SZPTR has not been defined by specs file"
+#endif
+
#if (!defined(_MIPS_ISA) || \
!defined(_MIPS_SIM) || \
!defined(_MIPS_SZINT) || \
!defined(_MIPS_SZLONG) || \
!defined(_MIPS_SZPTR)) && !defined(__KERNEL__)
-#warning "Please update your GCC to GCC 2.7.2-3 or newer"
+#warning "Please update your GCC to GCC 2.7.2-4 or newer"
#endif
/*
diff --git a/include/asm-mips/sni.h b/include/asm-mips/sni.h
index 6a43b65f4..9ed5919d2 100644
--- a/include/asm-mips/sni.h
+++ b/include/asm-mips/sni.h
@@ -83,4 +83,9 @@
#define PCIMT_IRQ_INTD 24
#define PCIMT_IRQ_SCSI 25
+/*
+ * Base address for the mapped 16mb EISA bus segment.
+ */
+#define PCIMT_EISA_BASE 0xb0000000
+
#endif /* __ASM_MIPS_SNI_H */
diff --git a/include/asm-mips/spinlock.h b/include/asm-mips/spinlock.h
index d1f67424f..85376edfd 100644
--- a/include/asm-mips/spinlock.h
+++ b/include/asm-mips/spinlock.h
@@ -3,6 +3,8 @@
#ifndef __SMP__
+/* gcc 2.7.2 can crash initializing an empty structure. For now we
+ try to do though ... */
typedef struct { } spinlock_t;
#define SPIN_LOCK_UNLOCKED { }
diff --git a/include/asm-mips/system.h b/include/asm-mips/system.h
index 2d4d27871..daf477459 100644
--- a/include/asm-mips/system.h
+++ b/include/asm-mips/system.h
@@ -15,7 +15,7 @@
#include <linux/kernel.h>
extern __inline__ void
-sti(void)
+__sti(void)
{
__asm__ __volatile__(
".set\tnoreorder\n\t"
@@ -39,7 +39,7 @@ sti(void)
* no nops at all.
*/
extern __inline__ void
-cli(void)
+__cli(void)
{
__asm__ __volatile__(
".set\tnoreorder\n\t"
@@ -58,7 +58,7 @@ cli(void)
: "$1", "memory");
}
-#define save_flags(x) \
+#define __save_flags(x) \
__asm__ __volatile__( \
".set\tnoreorder\n\t" \
"mfc0\t%0,$12\n\t" \
@@ -67,7 +67,7 @@ __asm__ __volatile__( \
: /* no inputs */ \
: "memory")
-#define save_and_cli(x) \
+#define __save_and_cli(x) \
__asm__ __volatile__( \
".set\tnoreorder\n\t" \
".set\tnoat\n\t" \
@@ -85,7 +85,7 @@ __asm__ __volatile__( \
: "$1", "memory")
extern void __inline__
-restore_flags(int flags)
+__restore_flags(int flags)
{
__asm__ __volatile__(
".set\tnoreorder\n\t"
@@ -99,6 +99,15 @@ restore_flags(int flags)
: "memory");
}
+/*
+ * Non-SMP versions ...
+ */
+#define sti() __sti()
+#define cli() __cli()
+#define save_flags(x) __save_flags(x)
+#define save_and_cli(x) __save_and_cli(x)
+#define restore_flags(x) __restore_flags(x)
+
#define sync_mem() \
__asm__ __volatile__( \
".set\tnoreorder\n\t" \