📄 setup.c
字号:
&clipper_mv, &dp264_mv, &eb164_mv, &eb64p_mv, &eb66_mv, &eb66p_mv, &eiger_mv, &jensen_mv, &lx164_mv, &lynx_mv, &miata_mv, &mikasa_mv, &mikasa_primo_mv, &monet_mv, &nautilus_mv, &noname_mv, &noritake_mv, &noritake_primo_mv, &p2k_mv, &pc164_mv, &privateer_mv, &rawhide_mv, &ruffian_mv, &rx164_mv, &sable_mv, &sable_gamma_mv, &shark_mv, &sx164_mv, &takara_mv, &webbrick_mv, &wildfire_mv, &xl_mv, &xlt_mv }; size_t i; for (i = 0; i < N(all_vecs); ++i) { struct alpha_machine_vector *mv = all_vecs[i]; if (strcasecmp(mv->vector_name, name) == 0) return mv; } return NULL;}static voidget_sysnames(unsigned long type, unsigned long variation, unsigned long cpu, char **type_name, char **variation_name){ unsigned long member; /* If not in the tables, make it UNKNOWN, else set type name to family */ if (type < N(systype_names)) { *type_name = systype_names[type]; } else if ((type > ST_API_BIAS) && (type - ST_API_BIAS) < N(api_names)) { *type_name = api_names[type - ST_API_BIAS]; } else if ((type > ST_UNOFFICIAL_BIAS) && (type - ST_UNOFFICIAL_BIAS) < N(unofficial_names)) { *type_name = unofficial_names[type - ST_UNOFFICIAL_BIAS]; } else { *type_name = sys_unknown; *variation_name = sys_unknown; return; } /* Set variation to "0"; if variation is zero, done. */ *variation_name = systype_names[0]; if (variation == 0) { return; } member = (variation >> 10) & 0x3f; /* member ID is a bit-field */ cpu &= 0xffffffff; /* make it usable */ switch (type) { /* select by family */ default: /* default to variation "0" for now */ break; case ST_DEC_EB164: if (member < N(eb164_indices)) *variation_name = eb164_names[eb164_indices[member]]; /* PC164 may show as EB164 variation, but with EV56 CPU, so, since no true EB164 had anything but EV5... */ if (eb164_indices[member] == 0 && cpu == EV56_CPU) *variation_name = eb164_names[1]; /* make it PC164 */ break; case ST_DEC_ALCOR: if (member < N(alcor_indices)) *variation_name = alcor_names[alcor_indices[member]]; break; case ST_DEC_EB64P: if (member < N(eb64p_indices)) *variation_name = eb64p_names[eb64p_indices[member]]; break; case ST_DEC_EB66: if (member < N(eb66_indices)) *variation_name = eb66_names[eb66_indices[member]]; break; case ST_DEC_MARVEL: if (member < N(marvel_indices)) *variation_name = marvel_names[marvel_indices[member]]; break; case ST_DEC_RAWHIDE: if (member < N(rawhide_indices)) *variation_name = rawhide_names[rawhide_indices[member]]; break; case ST_DEC_TITAN: *variation_name = titan_names[0]; /* default */ if (member < N(titan_indices)) *variation_name = titan_names[titan_indices[member]]; break; case ST_DEC_TSUNAMI: if (member < N(tsunami_indices)) *variation_name = tsunami_names[tsunami_indices[member]]; break; }}/* * A change was made to the HWRPB via an ECO and the following code * tracks a part of the ECO. In HWRPB versions less than 5, the ECO * was not implemented in the console firmware. If it's revision 5 or * greater we can get the name of the platform as an ASCII string from * the HWRPB. That's what this function does. It checks the revision * level and if the string is in the HWRPB it returns the address of * the string--a pointer to the name of the platform. * * Returns: * - Pointer to a ASCII string if it's in the HWRPB * - Pointer to a blank string if the data is not in the HWRPB. */static char *platform_string(void){ struct dsr_struct *dsr; static char unk_system_string[] = "N/A"; /* Go to the console for the string pointer. * If the rpb_vers is not 5 or greater the rpb * is old and does not have this data in it. */ if (hwrpb->revision < 5) return (unk_system_string); else { /* The Dynamic System Recognition struct * has the system platform name starting * after the character count of the string. */ dsr = ((struct dsr_struct *) ((char *)hwrpb + hwrpb->dsr_offset)); return ((char *)dsr + (dsr->sysname_off + sizeof(long))); }}static intget_nr_processors(struct percpu_struct *cpubase, unsigned long num){ struct percpu_struct *cpu; unsigned long i; int count = 0; for (i = 0; i < num; i++) { cpu = (struct percpu_struct *) ((char *)cpubase + i*hwrpb->processor_size); if ((cpu->flags & 0x1cc) == 0x1cc) count++; } return count;}static voidshow_cache_size (struct seq_file *f, const char *which, int shape){ if (shape == -1) seq_printf (f, "%s\t\t: n/a\n", which); else if (shape == 0) seq_printf (f, "%s\t\t: unknown\n", which); else seq_printf (f, "%s\t\t: %dK, %d-way, %db line\n", which, shape >> 10, shape & 15, 1 << ((shape >> 4) & 15));}static intshow_cpuinfo(struct seq_file *f, void *slot){ extern struct unaligned_stat { unsigned long count, va, pc; } unaligned[2]; static char cpu_names[][8] = { "EV3", "EV4", "Simulate", "LCA4", "EV5", "EV45", "EV56", "EV6", "PCA56", "PCA57", "EV67", "EV68CB", "EV68AL", "EV68CX", "EV7", "EV79", "EV69" }; struct percpu_struct *cpu = slot; unsigned int cpu_index; char *cpu_name; char *systype_name; char *sysvariation_name; int nr_processors; cpu_index = (unsigned) (cpu->type - 1); cpu_name = "Unknown"; if (cpu_index < N(cpu_names)) cpu_name = cpu_names[cpu_index]; get_sysnames(hwrpb->sys_type, hwrpb->sys_variation, cpu->type, &systype_name, &sysvariation_name); nr_processors = get_nr_processors(cpu, hwrpb->nr_processors); seq_printf(f, "cpu\t\t\t: Alpha\n" "cpu model\t\t: %s\n" "cpu variation\t\t: %ld\n" "cpu revision\t\t: %ld\n" "cpu serial number\t: %s\n" "system type\t\t: %s\n" "system variation\t: %s\n" "system revision\t\t: %ld\n" "system serial number\t: %s\n" "cycle frequency [Hz]\t: %lu %s\n" "timer frequency [Hz]\t: %lu.%02lu\n" "page size [bytes]\t: %ld\n" "phys. address bits\t: %ld\n" "max. addr. space #\t: %ld\n" "BogoMIPS\t\t: %lu.%02lu\n" "kernel unaligned acc\t: %ld (pc=%lx,va=%lx)\n" "user unaligned acc\t: %ld (pc=%lx,va=%lx)\n" "platform string\t\t: %s\n" "cpus detected\t\t: %d\n", cpu_name, cpu->variation, cpu->revision, (char*)cpu->serial_no, systype_name, sysvariation_name, hwrpb->sys_revision, (char*)hwrpb->ssn, est_cycle_freq ? : hwrpb->cycle_freq, est_cycle_freq ? "est." : "", hwrpb->intr_freq / 4096, (100 * hwrpb->intr_freq / 4096) % 100, hwrpb->pagesize, hwrpb->pa_bits, hwrpb->max_asn, loops_per_jiffy / (500000/HZ), (loops_per_jiffy / (5000/HZ)) % 100, unaligned[0].count, unaligned[0].pc, unaligned[0].va, unaligned[1].count, unaligned[1].pc, unaligned[1].va, platform_string(), nr_processors);#ifdef CONFIG_SMP seq_printf(f, "cpus active\t\t: %d\n" "cpu active mask\t\t: %016lx\n", num_online_cpus(), cpus_addr(cpu_possible_map)[0]);#endif show_cache_size (f, "L1 Icache", alpha_l1i_cacheshape); show_cache_size (f, "L1 Dcache", alpha_l1d_cacheshape); show_cache_size (f, "L2 cache", alpha_l2_cacheshape); show_cache_size (f, "L3 cache", alpha_l3_cacheshape); return 0;}static int __initread_mem_block(int *addr, int stride, int size){ long nloads = size / stride, cnt, tmp; __asm__ __volatile__( " rpcc %0\n" "1: ldl %3,0(%2)\n" " subq %1,1,%1\n" /* Next two XORs introduce an explicit data dependency between consecutive loads in the loop, which will give us true load latency. */ " xor %3,%2,%2\n" " xor %3,%2,%2\n" " addq %2,%4,%2\n" " bne %1,1b\n" " rpcc %3\n" " subl %3,%0,%0\n" : "=&r" (cnt), "=&r" (nloads), "=&r" (addr), "=&r" (tmp) : "r" (stride), "1" (nloads), "2" (addr)); return cnt / (size / stride);}#define CSHAPE(totalsize, linesize, assoc) \ ((totalsize & ~0xff) | (linesize << 4) | assoc)/* ??? EV5 supports up to 64M, but did the systems with more than 16M of BCACHE ever exist? */#define MAX_BCACHE_SIZE 16*1024*1024/* Note that the offchip caches are direct mapped on all Alphas. */static int __initexternal_cache_probe(int minsize, int width){ int cycles, prev_cycles = 1000000; int stride = 1 << width; long size = minsize, maxsize = MAX_BCACHE_SIZE * 2; if (maxsize > (max_low_pfn + 1) << PAGE_SHIFT) maxsize = 1 << (floor_log2(max_low_pfn + 1) + PAGE_SHIFT); /* Get the first block cached. */ read_mem_block(__va(0), stride, size); while (size < maxsize) { /* Get an average load latency in cycles. */ cycles = read_mem_block(__va(0), stride, size); if (cycles > prev_cycles * 2) { /* Fine, we exceed the cache. */ printk("%ldK Bcache detected; load hit latency %d " "cycles, load miss latency %d cycles\n", size >> 11, prev_cycles, cycles); return CSHAPE(size >> 1, width, 1); } /* Try to get the next block cached. */ read_mem_block(__va(size), stride, size); prev_cycles = cycles; size <<= 1; } return -1; /* No BCACHE found. */}static void __initdetermine_cpu_caches (unsigned int cpu_type){ int L1I, L1D, L2, L3; switch (cpu_type) { case EV4_CPU: case EV45_CPU: { if (cpu_type == EV4_CPU) L1I = CSHAPE(8*1024, 5, 1); else L1I = CSHAPE(16*1024, 5, 1); L1D = L1I; L3 = -1; /* BIU_CTL is a write-only Abox register. PALcode has a shadow copy, and may be available from some versions of the CSERVE PALcall. If we can get it, then unsigned long biu_ctl, size; size = 128*1024 * (1 << ((biu_ctl >> 28) & 7)); L2 = CSHAPE (size, 5, 1); Unfortunately, we can't rely on that. */ L2 = external_cache_probe(128*1024, 5); break; } case LCA4_CPU: { unsigned long car, size; L1I = L1D = CSHAPE(8*1024, 5, 1); L3 = -1; car = *(vuip) phys_to_virt (0x120000078UL); size = 64*1024 * (1 << ((car >> 5) & 7)); /* No typo -- 8 byte cacheline size. Whodathunk. */ L2 = (car & 1 ? CSHAPE (size, 3, 1) : -1); break; } case EV5_CPU: case EV56_CPU: { unsigned long sc_ctl, width; L1I = L1D = CSHAPE(8*1024, 5, 1); /* Check the line size of the Scache. */ sc_ctl = *(vulp) phys_to_virt (0xfffff000a8UL); width = sc_ctl & 0x1000 ? 6 : 5; L2 = CSHAPE (96*1024, width, 3); /* BC_CONTROL and BC_CONFIG are write-only IPRs. PALcode has a shadow copy, and may be available from some versions of the CSERVE PALcall. If we can get it, then unsigned long bc_control, bc_config, size; size = 1024*1024 * (1 << ((bc_config & 7) - 1)); L3 = (bc_control & 1 ? CSHAPE (size, width, 1) : -1); Unfortunately, we can't rely on that. */ L3 = external_cache_probe(1024*1024, width); break; } case PCA56_CPU: case PCA57_CPU: { unsigned long cbox_config, size; if (cpu_type == PCA56_CPU) { L1I = CSHAPE(16*1024, 6, 1); L1D = CSHAPE(8*1024, 5, 1); } else { L1I = CSHAPE(32*1024, 6, 2); L1D = CSHAPE(16*1024, 5, 1); } L3 = -1; cbox_config = *(vulp) phys_to_virt (0xfffff00008UL); size = 512*1024 * (1 << ((cbox_config >> 12) & 3));#if 0 L2 = ((cbox_config >> 31) & 1 ? CSHAPE (size, 6, 1) : -1);#else L2 = external_cache_probe(512*1024, 6);#endif break; } case EV6_CPU: case EV67_CPU: case EV68CB_CPU: case EV68AL_CPU: case EV68CX_CPU: case EV69_CPU: L1I = L1D = CSHAPE(64*1024, 6, 2); L2 = external_cache_probe(1024*1024, 6); L3 = -1; break; case EV7_CPU: case EV79_CPU: L1I = L1D = CSHAPE(64*1024, 6, 2); L2 = CSHAPE(7*1024*1024/4, 6, 7); L3 = -1; break; default: /* Nothing known about this cpu type. */ L1I = L1D = L2 = L3 = 0; break; } alpha_l1i_cacheshape = L1I; alpha_l1d_cacheshape = L1D; alpha_l2_cacheshape = L2; alpha_l3_cacheshape = L3;}/* * We show only CPU #0 info. */static void *c_start(struct seq_file *f, loff_t *pos){ return *pos ? NULL : (char *)hwrpb + hwrpb->processor_offset;}static void *c_next(struct seq_file *f, void *v, loff_t *pos){ return NULL;}static voidc_stop(struct seq_file *f, void *v){}struct seq_operations cpuinfo_op = { .start = c_start, .next = c_next, .stop = c_stop, .show = show_cpuinfo,};static intalpha_panic_event(struct notifier_block *this, unsigned long event, void *ptr){#if 1 /* FIXME FIXME FIXME */ /* If we are using SRM and serial console, just hard halt here. */ if (alpha_using_srm && srmcons_output) __halt();#endif return NOTIFY_DONE;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -