From: James S. <jsi...@us...> - 2002-01-20 03:54:48
|
Update of /cvsroot/linuxconsole/ruby/linux/arch/arm/kernel In directory usw-pr-cvs1:/tmp/cvs-serv23561/arch/arm/kernel Modified Files: setup.c traps.c Log Message: Synced to 2.5.X. Index: setup.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/arch/arm/kernel/setup.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- setup.c 2001/11/23 04:10:15 1.6 +++ setup.c 2002/01/20 03:54:44 1.7 @@ -16,6 +16,7 @@ #include <linux/blk.h> #include <linux/bootmem.h> #include <linux/seq_file.h> +#include <linux/tty.h> #include <linux/init.h> #include <asm/elf.h> @@ -103,6 +104,109 @@ #define lp1 io_res[1] #define lp2 io_res[2] +#ifdef CONFIG_CPU_32 +static const char *cache_types[16] = { + "write-through", + "write-back", + "write-back", + "undefined 3", + "undefined 4", + "undefined 5", + "write-back", + "write-back", + "undefined 8", + "undefined 9", + "undefined 10", + "undefined 11", + "undefined 12", + "undefined 13", + "undefined 14", + "undefined 15", +}; + +static const char *cache_clean[16] = { + "not required", + "read-block", + "cp15 c7 ops", + "undefined 3", + "undefined 4", + "undefined 5", + "cp15 c7 ops", + "cp15 c7 ops", + "undefined 8", + "undefined 9", + "undefined 10", + "undefined 11", + "undefined 12", + "undefined 13", + "undefined 14", + "undefined 15", +}; + +static const char *cache_lockdown[16] = { + "not supported", + "not supported", + "not supported", + "undefined 3", + "undefined 4", + "undefined 5", + "format A", + "format B", + "undefined 8", + "undefined 9", + "undefined 10", + "undefined 11", + "undefined 12", + "undefined 13", + "undefined 14", + "undefined 15", +}; + +#define CACHE_TYPE(x) (((x) >> 25) & 15) +#define CACHE_S(x) ((x) & (1 << 24)) +#define CACHE_DSIZE(x) (((x) >> 12) & 4095) /* only if S=1 */ +#define CACHE_ISIZE(x) ((x) & 4095) + +#define CACHE_SIZE(y) (((y) >> 6) & 7) +#define CACHE_ASSOC(y) (((y) >> 3) & 7) +#define CACHE_M(y) ((y) & (1 << 2)) +#define CACHE_LINE(y) ((y) & 3) + +static inline void dump_cache(const char *prefix, unsigned int cache) +{ + unsigned int mult = 2 + CACHE_M(cache) ? 1 : 0; + + printk("%s size %dK associativity %d line length %d sets %d\n", + prefix, + mult << (8 + CACHE_SIZE(cache)), + (mult << CACHE_ASSOC(cache)) >> 1, + 8 << CACHE_LINE(cache), + 1 << (6 + CACHE_SIZE(cache) - CACHE_ASSOC(cache) - + CACHE_LINE(cache))); +} + +static inline void dump_cpu_cache_id(void) +{ + unsigned int cache_info; + + asm("mrc p15, 0, %0, c0, c0, 1" : "=r" (cache_info)); + + if (cache_info == processor_id) + return; + + printk("CPU: D %s cache\n", cache_types[CACHE_TYPE(cache_info)]); + if (CACHE_S(cache_info)) { + dump_cache("CPU: I cache", CACHE_ISIZE(cache_info)); + dump_cache("CPU: D cache", CACHE_DSIZE(cache_info)); + } else { + dump_cache("CPU: cache", CACHE_ISIZE(cache_info)); + } +} + +#else +#define dump_cpu_cache_id() do { } while (0) +#endif + static void __init setup_processor(void) { extern struct proc_info_list __proc_info_begin, __proc_info_end; @@ -137,6 +241,8 @@ proc_info.manufacturer, proc_info.cpu_name, (int)processor_id & 15); + dump_cpu_cache_id(); + sprintf(system_utsname.machine, "%s%c", list->arch_name, ENDIANNESS); sprintf(elf_platform, "%s%c", list->elf_name, ENDIANNESS); elf_hwcap = list->elf_hwcap; @@ -144,7 +250,7 @@ cpu_proc_init(); } -static struct machine_desc * __init setup_architecture(unsigned int nr) +static struct machine_desc * __init setup_machine(unsigned int nr) { extern struct machine_desc __arch_info_begin, __arch_info_end; struct machine_desc *list; @@ -166,7 +272,7 @@ while (1); } - printk("Architecture: %s\n", list->name); + printk("Machine: %s\n", list->name); if (compat) printk(KERN_WARNING "Using compatibility code " "scheduled for removal in v%d.%d.%d\n", @@ -229,7 +335,7 @@ setup_ramdisk(int doload, int prompt, int image_start, unsigned int rd_sz) { #ifdef CONFIG_BLK_DEV_RAM - extern int rd_size; + extern int rd_size, rd_image_start, rd_prompt, rd_doload; rd_image_start = image_start; rd_prompt = prompt; @@ -456,10 +562,10 @@ struct machine_desc *mdesc; char *from = default_command_line; - ROOT_DEV = MKDEV(0, 255); + ROOT_DEV = mk_kdev(0, 255); setup_processor(); - mdesc = setup_architecture(machine_arch_type); + mdesc = setup_machine(machine_arch_type); machine_name = mdesc->name; if (mdesc->soft_reboot) @@ -523,6 +629,41 @@ NULL }; +static const char *proc_arch[16] = { + "undefined 0", + "4", + "4T", + "5", + "5T", + "5TE", + "undefined 6", + "undefined 7", + "undefined 8", + "undefined 9", + "undefined 10", + "undefined 11", + "undefined 12", + "undefined 13", + "undefined 14", + "undefined 15" +}; + +static void +c_show_cache(struct seq_file *m, const char *type, unsigned int cache) +{ + unsigned int mult = 2 + CACHE_M(cache) ? 1 : 0; + + seq_printf(m, "%s size\t\t: %d\n" + "%s assoc\t\t: %d\n" + "%s line length\t: %d\n" + "%s sets\t\t: %d\n", + type, mult << (8 + CACHE_SIZE(cache)), + type, (mult << CACHE_ASSOC(cache)) >> 1, + type, 8 << CACHE_LINE(cache), + type, 1 << (6 + CACHE_SIZE(cache) - CACHE_ASSOC(cache) - + CACHE_LINE(cache))); +} + static int c_show(struct seq_file *m, void *v) { int i; @@ -542,7 +683,60 @@ if (elf_hwcap & (1 << i)) seq_printf(m, "%s ", hwcap_str[i]); - seq_puts(m, "\n\n"); + seq_puts(m, "\n"); + + if ((processor_id & 0x0000f000) == 0x00000000) { + /* pre-ARM7 */ + seq_printf(m, "CPU part\t\t: %07x\n", processor_id >> 4); + } else if ((processor_id & 0x0000f000) == 0x00007000) { + /* ARM7 */ + seq_printf(m, "CPU implementor\t: 0x%02x\n" + "CPU architecture: %s\n" + "CPU variant\t: 0x%02x\n" + "CPU part\t: 0x%03x\n", + processor_id >> 24, + processor_id & (1 << 23) ? "4T" : "3", + (processor_id >> 16) & 127, + (processor_id >> 4) & 0xfff); + } else { + /* post-ARM7 */ + seq_printf(m, "CPU implementor\t: 0x%02x\n" + "CPU architecture: %s\n" + "CPU variant\t: 0x%x\n" + "CPU part\t: 0x%03x\n", + processor_id >> 24, + proc_arch[(processor_id >> 16) & 15], + (processor_id >> 20) & 15, + (processor_id >> 4) & 0xfff); + } + seq_printf(m, "CPU revision\t: %d\n", processor_id & 15); + +#ifdef CONFIG_CPU_32 + { + unsigned int cache_info; + + asm("mrc p15, 0, %0, c0, c0, 1" : "=r" (cache_info)); + if (cache_info != processor_id) { + seq_printf(m, "Cache type\t: %s\n" + "Cache clean\t: %s\n" + "Cache lockdown\t: %s\n" + "Cache unified\t: %s\n", + cache_types[CACHE_TYPE(cache_info)], + cache_clean[CACHE_TYPE(cache_info)], + cache_lockdown[CACHE_TYPE(cache_info)], + CACHE_S(cache_info) ? "separate I,D" : "unified"); + + if (CACHE_S(cache_info)) { + c_show_cache(m, "I", CACHE_ISIZE(cache_info)); + c_show_cache(m, "D", CACHE_DSIZE(cache_info)); + } else { + c_show_cache(m, "Cache", CACHE_ISIZE(cache_info)); + } + } + } +#endif + + seq_puts(m, "\n"); seq_printf(m, "Hardware\t: %s\n", machine_name); seq_printf(m, "Revision\t: %04x\n", system_rev); Index: traps.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/arch/arm/kernel/traps.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- traps.c 2001/11/02 00:57:43 1.2 +++ traps.c 2002/01/20 03:54:44 1.3 @@ -53,7 +53,7 @@ */ static int verify_stack(unsigned long sp) { - if (sp < PAGE_OFFSET || sp > (unsigned long)high_memory) + if (sp < PAGE_OFFSET || (sp > (unsigned long)high_memory && high_memory != 0)) return -EFAULT; return 0; @@ -62,13 +62,16 @@ /* * Dump out the contents of some memory nicely... */ -void dump_mem(unsigned long bottom, unsigned long top) +static void dump_mem(const char *str, unsigned long bottom, unsigned long top) { unsigned long p = bottom & ~31; int i; + printk("%s", str); + printk("(0x%08lx to 0x%08lx)\n", bottom, top); + for (p = bottom & ~31; p < top;) { - printk("%08lx: ", p); + printk("%04lx: ", p & 0xffff); for (i = 0; i < 8; i++, p += 4) { unsigned int val; @@ -79,21 +82,11 @@ __get_user(val, (unsigned long *)p); printk("%08x ", val); } - if (i == 3) - printk(" "); } printk ("\n"); } } -/* - * These constants are for searching for possible module text - * segments. VMALLOC_OFFSET comes from mm/vmalloc.c; MODULE_RANGE is - * a guess of how much space is likely to be vmalloced. - */ -#define VMALLOC_OFFSET (8*1024*1024) -#define MODULE_RANGE (8*1024*1024) - static void dump_instr(struct pt_regs *regs) { unsigned long addr = instruction_pointer(regs); @@ -122,8 +115,7 @@ static void dump_stack(struct task_struct *tsk, unsigned long sp) { - printk("Stack:\n"); - dump_mem(sp - 16, 8192+(unsigned long)tsk); + dump_mem("Stack: ", sp - 16, 8192+(unsigned long)tsk); } static void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk) @@ -289,10 +281,9 @@ handler[reason], processor_modes[proc_mode]); /* - * We need to switch to kernel mode so that we can - * use __get_user to safely read from kernel space. - * Note that we now dump the code first, just in case - * the backtrace kills us. + * We need to switch to kernel mode so that we can use __get_user + * to safely read from kernel space. Note that we now dump the + * code first, just in case the backtrace kills us. */ fs = get_fs(); set_fs(KERNEL_DS); @@ -301,10 +292,8 @@ * Dump out the vectors and stub routines. Maybe a better solution * would be to dump them out only if we detect that they are corrupted. */ - printk(KERN_CRIT "Vectors:\n"); - dump_mem(vectors, 0x40); - printk(KERN_CRIT "Stubs:\n"); - dump_mem(vectors + 0x200, 0x4b8); + dump_mem(KERN_CRIT "Vectors: ", vectors, vectors + 0x40); + dump_mem(KERN_CRIT "Stubs: ", vectors + 0x200, vectors + 0x4b8); set_fs(fs); @@ -529,11 +518,6 @@ void abort(void) { - void *lr = __builtin_return_address(0); - - printk(KERN_CRIT "abort() called from %p! (Please " - "report to rm...@ar...)\n", lr); - BUG(); /* if that doesn't kill us, halt */ |