diff -urN linux-2.1.122-pre1/arch/i386/kernel/mtrr.c linux/arch/i386/kernel/mtrr.c --- linux-2.1.122-pre1/arch/i386/kernel/mtrr.c Wed Sep 2 12:16:51 1998 +++ linux/arch/i386/kernel/mtrr.c Thu Sep 10 17:17:11 1998 @@ -117,6 +117,14 @@ 19980611 Richard Gooch Always define . v1.22 + 19980901 Richard Gooch + Removed module support in order to tidy up code. + Added sanity check for / before . + Created addition queue for prior to SMP commence. + v1.23 + 19980910 Richard Gooch + Removed sanity checks and addition queue: Linus prefers an OOPS. + v1.24 */ #include #include @@ -149,7 +157,7 @@ #include #include -#define MTRR_VERSION "1.22 (19980611)" +#define MTRR_VERSION "1.24 (19980910)" #define TRUE 1 #define FALSE 0 @@ -658,13 +666,8 @@ } /* End Function set_mtrr_smp */ -/* A warning that is common to the module and non-module cases. */ /* Some BIOS's are fucked and don't set all MTRRs the same! */ -#ifdef MODULE -static void mtrr_state_warn (unsigned long mask) -#else __initfunc(static void mtrr_state_warn (unsigned long mask)) -#endif { if (!mask) return; if (mask & MTRR_CHANGE_MASK_FIXED) @@ -676,37 +679,6 @@ printk ("mtrr: probably your BIOS does not setup all CPUs\n"); } /* End Function mtrr_state_warn */ -#ifdef MODULE -/* As a module, copy the MTRR state using an IPI handler. */ - -static volatile unsigned long smp_changes_mask = 0; - -static void copy_mtrr_state_handler (struct set_mtrr_context *ctxt, void *info) -{ - unsigned long mask, count; - struct mtrr_state *smp_mtrr_state = info; - - mask = set_mtrr_state (smp_mtrr_state, ctxt); - /* Use the atomic bitops to update the global mask */ - for (count = 0; count < sizeof mask * 8; ++count) - { - if (mask & 0x01) set_bit (count, &smp_changes_mask); - mask >>= 1; - } -} /* End Function copy_mtrr_state_handler */ - -/* Copies the entire MTRR state of this CPU to all the others. */ -static void copy_mtrr_state (void) -{ - struct mtrr_state ms; - - get_mtrr_state (&ms); - do_all_cpus (copy_mtrr_state_handler, &ms, FALSE); - finalize_mtrr_state (&ms); - mtrr_state_warn (smp_changes_mask); -} /* End Function copy_mtrr_state */ - -#endif /* MODULE */ #endif /* __SMP__ */ static char *attrib_to_str (int x) @@ -1163,7 +1135,7 @@ EXPORT_SYMBOL(mtrr_add); EXPORT_SYMBOL(mtrr_del); -#if defined(__SMP__) && !defined(MODULE) +#ifdef __SMP__ static volatile unsigned long smp_changes_mask __initdata = 0; static struct mtrr_state smp_mtrr_state __initdata = {0, 0}; @@ -1196,26 +1168,18 @@ } } /* End Function mtrr_init_secondary_cpu */ -#endif +#endif /* __SMP__ */ -#ifdef MODULE -int init_module (void) -#else __initfunc(int mtrr_init(void)) -#endif { if ( !(boot_cpu_data.x86_capability & X86_FEATURE_MTRR) ) return 0; -# if !defined(__SMP__) || defined(MODULE) +# ifndef __SMP__ printk("mtrr: v%s Richard Gooch (rgooch@atnf.csiro.au)\n", MTRR_VERSION); # endif # ifdef __SMP__ -# ifdef MODULE - copy_mtrr_state (); -# else /* MODULE */ finalize_mtrr_state (&smp_mtrr_state); mtrr_state_warn (smp_changes_mask); -# endif /* MODULE */ # endif /* __SMP__ */ # ifdef CONFIG_PROC_FS @@ -1224,17 +1188,4 @@ init_table (); return 0; -} - -#ifdef MODULE -void cleanup_module (void) -{ - if ( !(boot_cpu_data.x86_capability & X86_FEATURE_MTRR) ) return; -# ifdef CONFIG_PROC_FS - proc_unregister (&proc_root, PROC_MTRR); -# endif -# ifdef __SMP__ - mtrr_hook = NULL; -# endif -} -#endif +} /* End Function mtrr_init */ diff -urN linux-2.1.122-pre1/include/asm-alpha/init_steps.h linux/include/asm-alpha/init_steps.h --- linux-2.1.122-pre1/include/asm-alpha/init_steps.h Thu Jan 1 10:00:00 1970 +++ linux/include/asm-alpha/init_steps.h Thu Sep 10 17:03:05 1998 @@ -0,0 +1,21 @@ +/* include/asm-alpha/init_steps.h + + Copyright (C) 1998 Richard Gooch + Licenced under the GPL. + + This file contains architecture-specific setup code required during the + initialisation process. Multiple sequence points are defined. + +*/ +#ifndef _alpha_INIT_STEPS_H +#define _alpha_INIT_STEPS_H + +__initfunc(static void arch_pre_bus_init(void)) +{ +} /* End Function arch_pre_bus_init */ + +__initfunc(static void arch_post_bus_init(void)) +{ +} /* End Function arch_post_bus_init */ + +#endif /* _alpha_INIT_STEPS_H */ diff -urN linux-2.1.122-pre1/include/asm-arm/init_steps.h linux/include/asm-arm/init_steps.h --- linux-2.1.122-pre1/include/asm-arm/init_steps.h Thu Jan 1 10:00:00 1970 +++ linux/include/asm-arm/init_steps.h Thu Sep 10 17:03:05 1998 @@ -0,0 +1,21 @@ +/* include/asm-arm/init_steps.h + + Copyright (C) 1998 Richard Gooch + Licenced under the GPL. + + This file contains architecture-specific setup code required during the + initialisation process. Multiple sequence points are defined. + +*/ +#ifndef _arm_INIT_STEPS_H +#define _arm_INIT_STEPS_H + +__initfunc(static void arch_pre_bus_init(void)) +{ +} /* End Function arch_pre_bus_init */ + +__initfunc(static void arch_post_bus_init(void)) +{ +} /* End Function arch_post_bus_init */ + +#endif /* _arm_INIT_STEPS_H */ diff -urN linux-2.1.122-pre1/include/asm-i386/init_steps.h linux/include/asm-i386/init_steps.h --- linux-2.1.122-pre1/include/asm-i386/init_steps.h Thu Jan 1 10:00:00 1970 +++ linux/include/asm-i386/init_steps.h Thu Sep 10 17:03:05 1998 @@ -0,0 +1,28 @@ +/* include/asm-i386/init_steps.h + + Copyright (C) 1998 Richard Gooch + Licenced under the GPL. + + This file contains architecture-specific setup code required during the + initialisation process. Multiple sequence points are defined. + +*/ +#ifndef _i386_INIT_STEPS_H +#define _i386_INIT_STEPS_H + +#ifdef CONFIG_MTRR +# include +#endif + +__initfunc(static void arch_pre_bus_init(void)) +{ +#ifdef CONFIG_MTRR + mtrr_init (); +#endif +} /* End Function arch_pre_bus_init */ + +__initfunc(static void arch_post_bus_init(void)) +{ +} /* End Function arch_post_bus_init */ + +#endif /* _i386_INIT_STEPS_H */ diff -urN linux-2.1.122-pre1/include/asm-m68k/init_steps.h linux/include/asm-m68k/init_steps.h --- linux-2.1.122-pre1/include/asm-m68k/init_steps.h Thu Jan 1 10:00:00 1970 +++ linux/include/asm-m68k/init_steps.h Thu Sep 10 17:03:05 1998 @@ -0,0 +1,21 @@ +/* include/asm-m68k/init_steps.h + + Copyright (C) 1998 Richard Gooch + Licenced under the GPL. + + This file contains architecture-specific setup code required during the + initialisation process. Multiple sequence points are defined. + +*/ +#ifndef _m68k_INIT_STEPS_H +#define _m68k_INIT_STEPS_H + +__initfunc(static void arch_pre_bus_init(void)) +{ +} /* End Function arch_pre_bus_init */ + +__initfunc(static void arch_post_bus_init(void)) +{ +} /* End Function arch_post_bus_init */ + +#endif /* _m68k_INIT_STEPS_H */ diff -urN linux-2.1.122-pre1/include/asm-mips/init_steps.h linux/include/asm-mips/init_steps.h --- linux-2.1.122-pre1/include/asm-mips/init_steps.h Thu Jan 1 10:00:00 1970 +++ linux/include/asm-mips/init_steps.h Thu Sep 10 17:03:05 1998 @@ -0,0 +1,21 @@ +/* include/asm-mips/init_steps.h + + Copyright (C) 1998 Richard Gooch + Licenced under the GPL. + + This file contains architecture-specific setup code required during the + initialisation process. Multiple sequence points are defined. + +*/ +#ifndef _mips_INIT_STEPS_H +#define _mips_INIT_STEPS_H + +__initfunc(static void arch_pre_bus_init(void)) +{ +} /* End Function arch_pre_bus_init */ + +__initfunc(static void arch_post_bus_init(void)) +{ +} /* End Function arch_post_bus_init */ + +#endif /* _mips_INIT_STEPS_H */ diff -urN linux-2.1.122-pre1/include/asm-ppc/init_steps.h linux/include/asm-ppc/init_steps.h --- linux-2.1.122-pre1/include/asm-ppc/init_steps.h Thu Jan 1 10:00:00 1970 +++ linux/include/asm-ppc/init_steps.h Thu Sep 10 17:03:05 1998 @@ -0,0 +1,21 @@ +/* include/asm-ppc/init_steps.h + + Copyright (C) 1998 Richard Gooch + Licenced under the GPL. + + This file contains architecture-specific setup code required during the + initialisation process. Multiple sequence points are defined. + +*/ +#ifndef _ppc_INIT_STEPS_H +#define _ppc_INIT_STEPS_H + +__initfunc(static void arch_pre_bus_init(void)) +{ +} /* End Function arch_pre_bus_init */ + +__initfunc(static void arch_post_bus_init(void)) +{ +} /* End Function arch_post_bus_init */ + +#endif /* _ppc_INIT_STEPS_H */ diff -urN linux-2.1.122-pre1/include/asm-sparc/init_steps.h linux/include/asm-sparc/init_steps.h --- linux-2.1.122-pre1/include/asm-sparc/init_steps.h Thu Jan 1 10:00:00 1970 +++ linux/include/asm-sparc/init_steps.h Thu Sep 10 17:03:05 1998 @@ -0,0 +1,21 @@ +/* include/asm-sparc/init_steps.h + + Copyright (C) 1998 Richard Gooch + Licenced under the GPL. + + This file contains architecture-specific setup code required during the + initialisation process. Multiple sequence points are defined. + +*/ +#ifndef _sparc_INIT_STEPS_H +#define _sparc_INIT_STEPS_H + +__initfunc(static void arch_pre_bus_init(void)) +{ +} /* End Function arch_pre_bus_init */ + +__initfunc(static void arch_post_bus_init(void)) +{ +} /* End Function arch_post_bus_init */ + +#endif /* _sparc_INIT_STEPS_H */ diff -urN linux-2.1.122-pre1/include/asm-sparc64/init_steps.h linux/include/asm-sparc64/init_steps.h --- linux-2.1.122-pre1/include/asm-sparc64/init_steps.h Thu Jan 1 10:00:00 1970 +++ linux/include/asm-sparc64/init_steps.h Thu Sep 10 17:03:05 1998 @@ -0,0 +1,21 @@ +/* include/asm-sparc64/init_steps.h + + Copyright (C) 1998 Richard Gooch + Licenced under the GPL. + + This file contains architecture-specific setup code required during the + initialisation process. Multiple sequence points are defined. + +*/ +#ifndef _sparc64_INIT_STEPS_H +#define _sparc64_INIT_STEPS_H + +__initfunc(static void arch_pre_bus_init(void)) +{ +} /* End Function arch_pre_bus_init */ + +__initfunc(static void arch_post_bus_init(void)) +{ +} /* End Function arch_post_bus_init */ + +#endif /* _sparc64_INIT_STEPS_H */ diff -urN linux-2.1.122-pre1/init/main.c linux/init/main.c --- linux-2.1.122-pre1/init/main.c Thu Sep 10 15:04:52 1998 +++ linux/init/main.c Thu Sep 10 17:05:10 1998 @@ -36,6 +36,7 @@ #include #include #include +#include #include @@ -47,10 +48,6 @@ #include #endif -#ifdef CONFIG_MTRR -# include -#endif - /* * Versions of gcc older than that listed below may actually compile * and link okay, but the end product can have subtle run time bugs. @@ -1121,15 +1118,6 @@ * Now we can finally start doing some real work.. */ -#if defined(CONFIG_MTRR) /* Do this after SMP initialization */ -/* - * We should probably create some architecture-dependent "fixup after - * everything is up" style function where this would belong better - * than in init/main.c.. - */ - mtrr_init(); -#endif - #ifdef CONFIG_SYSCTL sysctl_init(); #endif @@ -1141,6 +1129,7 @@ * Ok, at this point all CPU's should be initialized, so * we can start looking into devices.. */ + arch_pre_bus_init(); #ifdef CONFIG_PCI pci_init(); #endif @@ -1156,6 +1145,7 @@ #ifdef CONFIG_ARCH_ACORN ecard_init(); #endif + arch_post_bus_init(); /* * We count on the initial thread going ok