X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=arch%2Falpha%2Fkernel%2Fsetup.c;h=a94e6d93e2eedb695f83e718a2fd3eba1b674807;hb=e0ff8aa1acd079b70e796571917ae0449b7c465b;hp=d1f1e0cdfa61c64c2c0f60bc709b4349c465f5de;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/arch/alpha/kernel/setup.c b/arch/alpha/kernel/setup.c index d1f1e0cdf..a94e6d93e 100644 --- a/arch/alpha/kernel/setup.c +++ b/arch/alpha/kernel/setup.c @@ -19,29 +19,32 @@ #include #include #include -#include +#include #include -#include /* CONFIG_ALPHA_LCA etc */ #include #include +#include #include #include #include #include +#include #include #include #include #include #include #include +#include #ifdef CONFIG_MAGIC_SYSRQ #include #include #endif #include +#include #include -extern struct notifier_block *panic_notifier_list; +extern struct atomic_notifier_head panic_notifier_list; static int alpha_panic_event(struct notifier_block *, unsigned long, void *); static struct notifier_block alpha_panic_block = { alpha_panic_event, @@ -110,10 +113,6 @@ struct alpha_machine_vector alpha_mv; int alpha_using_srm; #endif -unsigned char aux_device_present = 0xaa; - -#define N(a) (sizeof(a)/sizeof(a[0])) - static struct alpha_machine_vector *get_sysvec(unsigned long, unsigned long, unsigned long); static struct alpha_machine_vector *get_sysvec_byname(const char *); @@ -122,7 +121,6 @@ static void get_sysnames(unsigned long, unsigned long, unsigned long, static void determine_cpu_caches (unsigned int); static char command_line[COMMAND_LINE_SIZE]; -char saved_command_line[COMMAND_LINE_SIZE]; /* * The format of "screen_info" is strange, and due to early @@ -213,14 +211,14 @@ static void __init reserve_std_resources(void) { static struct resource standard_io_resources[] = { - { "rtc", -1, -1 }, - { "dma1", 0x00, 0x1f }, - { "pic1", 0x20, 0x3f }, - { "timer", 0x40, 0x5f }, - { "keyboard", 0x60, 0x6f }, - { "dma page reg", 0x80, 0x8f }, - { "pic2", 0xa0, 0xbf }, - { "dma2", 0xc0, 0xdf }, + { .name = "rtc", .start = -1, .end = -1 }, + { .name = "dma1", .start = 0x00, .end = 0x1f }, + { .name = "pic1", .start = 0x20, .end = 0x3f }, + { .name = "timer", .start = 0x40, .end = 0x5f }, + { .name = "keyboard", .start = 0x60, .end = 0x6f }, + { .name = "dma page reg", .start = 0x80, .end = 0x8f }, + { .name = "pic2", .start = 0xa0, .end = 0xbf }, + { .name = "dma2", .start = 0xc0, .end = 0xdf }, }; struct resource *io = &ioport_resource; @@ -239,13 +237,10 @@ reserve_std_resources(void) standard_io_resources[0].start = RTC_PORT(0); standard_io_resources[0].end = RTC_PORT(0) + 0x10; - for (i = 0; i < N(standard_io_resources); ++i) + for (i = 0; i < ARRAY_SIZE(standard_io_resources); ++i) request_resource(io, standard_io_resources+i); } -#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT) -#define PFN_DOWN(x) ((x) >> PAGE_SHIFT) -#define PFN_PHYS(x) ((x) << PAGE_SHIFT) #define PFN_MAX PFN_DOWN(0x80000000) #define for_each_mem_cluster(memdesc, cluster, i) \ for ((cluster) = (memdesc)->cluster, (i) = 0; \ @@ -474,10 +469,21 @@ page_is_ram(unsigned long pfn) return 0; } -#undef PFN_UP -#undef PFN_DOWN -#undef PFN_PHYS -#undef PFN_MAX +static int __init +register_cpus(void) +{ + int i; + + for_each_possible_cpu(i) { + struct cpu *p = kzalloc(sizeof(*p), GFP_KERNEL); + if (!p) + return -ENOMEM; + register_cpu(p, i); + } + return 0; +} + +arch_initcall(register_cpus); void __init setup_arch(char **cmdline_p) @@ -509,7 +515,8 @@ setup_arch(char **cmdline_p) } /* Register a call for panic conditions. */ - notifier_chain_register(&panic_notifier_list, &alpha_panic_block); + atomic_notifier_chain_register(&panic_notifier_list, + &alpha_panic_block); #ifdef CONFIG_ALPHA_GENERIC /* Assume that we've booted from SRM if we haven't booted from MILO. @@ -908,13 +915,13 @@ get_sysvec(unsigned long type, unsigned long variation, unsigned long cpu) /* Search the system tables first... */ vec = NULL; - if (type < N(systype_vecs)) { + if (type < ARRAY_SIZE(systype_vecs)) { vec = systype_vecs[type]; } else if ((type > ST_API_BIAS) && - (type - ST_API_BIAS) < N(api_vecs)) { + (type - ST_API_BIAS) < ARRAY_SIZE(api_vecs)) { vec = api_vecs[type - ST_API_BIAS]; } else if ((type > ST_UNOFFICIAL_BIAS) && - (type - ST_UNOFFICIAL_BIAS) < N(unofficial_vecs)) { + (type - ST_UNOFFICIAL_BIAS) < ARRAY_SIZE(unofficial_vecs)) { vec = unofficial_vecs[type - ST_UNOFFICIAL_BIAS]; } @@ -928,11 +935,11 @@ get_sysvec(unsigned long type, unsigned long variation, unsigned long cpu) switch (type) { case ST_DEC_ALCOR: - if (member < N(alcor_indices)) + if (member < ARRAY_SIZE(alcor_indices)) vec = alcor_vecs[alcor_indices[member]]; break; case ST_DEC_EB164: - if (member < N(eb164_indices)) + if (member < ARRAY_SIZE(eb164_indices)) vec = eb164_vecs[eb164_indices[member]]; /* PC164 may show as EB164 variation with EV56 CPU, but, since no true EB164 had anything but EV5... */ @@ -940,24 +947,24 @@ get_sysvec(unsigned long type, unsigned long variation, unsigned long cpu) vec = &pc164_mv; break; case ST_DEC_EB64P: - if (member < N(eb64p_indices)) + if (member < ARRAY_SIZE(eb64p_indices)) vec = eb64p_vecs[eb64p_indices[member]]; break; case ST_DEC_EB66: - if (member < N(eb66_indices)) + if (member < ARRAY_SIZE(eb66_indices)) vec = eb66_vecs[eb66_indices[member]]; break; case ST_DEC_MARVEL: - if (member < N(marvel_indices)) + if (member < ARRAY_SIZE(marvel_indices)) vec = marvel_vecs[marvel_indices[member]]; break; case ST_DEC_TITAN: vec = titan_vecs[0]; /* default */ - if (member < N(titan_indices)) + if (member < ARRAY_SIZE(titan_indices)) vec = titan_vecs[titan_indices[member]]; break; case ST_DEC_TSUNAMI: - if (member < N(tsunami_indices)) + if (member < ARRAY_SIZE(tsunami_indices)) vec = tsunami_vecs[tsunami_indices[member]]; break; case ST_DEC_1000: @@ -1029,7 +1036,7 @@ get_sysvec_byname(const char *name) size_t i; - for (i = 0; i < N(all_vecs); ++i) { + for (i = 0; i < ARRAY_SIZE(all_vecs); ++i) { struct alpha_machine_vector *mv = all_vecs[i]; if (strcasecmp(mv->vector_name, name) == 0) return mv; @@ -1045,13 +1052,13 @@ get_sysnames(unsigned long type, unsigned long variation, unsigned long cpu, /* If not in the tables, make it UNKNOWN, else set type name to family */ - if (type < N(systype_names)) { + if (type < ARRAY_SIZE(systype_names)) { *type_name = systype_names[type]; } else if ((type > ST_API_BIAS) && - (type - ST_API_BIAS) < N(api_names)) { + (type - ST_API_BIAS) < ARRAY_SIZE(api_names)) { *type_name = api_names[type - ST_API_BIAS]; } else if ((type > ST_UNOFFICIAL_BIAS) && - (type - ST_UNOFFICIAL_BIAS) < N(unofficial_names)) { + (type - ST_UNOFFICIAL_BIAS) < ARRAY_SIZE(unofficial_names)) { *type_name = unofficial_names[type - ST_UNOFFICIAL_BIAS]; } else { *type_name = sys_unknown; @@ -1073,7 +1080,7 @@ get_sysnames(unsigned long type, unsigned long variation, unsigned long cpu, default: /* default to variation "0" for now */ break; case ST_DEC_EB164: - if (member < N(eb164_indices)) + if (member < ARRAY_SIZE(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... */ @@ -1081,32 +1088,32 @@ get_sysnames(unsigned long type, unsigned long variation, unsigned long cpu, *variation_name = eb164_names[1]; /* make it PC164 */ break; case ST_DEC_ALCOR: - if (member < N(alcor_indices)) + if (member < ARRAY_SIZE(alcor_indices)) *variation_name = alcor_names[alcor_indices[member]]; break; case ST_DEC_EB64P: - if (member < N(eb64p_indices)) + if (member < ARRAY_SIZE(eb64p_indices)) *variation_name = eb64p_names[eb64p_indices[member]]; break; case ST_DEC_EB66: - if (member < N(eb66_indices)) + if (member < ARRAY_SIZE(eb66_indices)) *variation_name = eb66_names[eb66_indices[member]]; break; case ST_DEC_MARVEL: - if (member < N(marvel_indices)) + if (member < ARRAY_SIZE(marvel_indices)) *variation_name = marvel_names[marvel_indices[member]]; break; case ST_DEC_RAWHIDE: - if (member < N(rawhide_indices)) + if (member < ARRAY_SIZE(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)) + if (member < ARRAY_SIZE(titan_indices)) *variation_name = titan_names[titan_indices[member]]; break; case ST_DEC_TSUNAMI: - if (member < N(tsunami_indices)) + if (member < ARRAY_SIZE(tsunami_indices)) *variation_name = tsunami_names[tsunami_indices[member]]; break; } @@ -1201,7 +1208,7 @@ show_cpuinfo(struct seq_file *f, void *slot) cpu_index = (unsigned) (cpu->type - 1); cpu_name = "Unknown"; - if (cpu_index < N(cpu_names)) + if (cpu_index < ARRAY_SIZE(cpu_names)) cpu_name = cpu_names[cpu_index]; get_sysnames(hwrpb->sys_type, hwrpb->sys_variation, @@ -1246,9 +1253,9 @@ show_cpuinfo(struct seq_file *f, void *slot) platform_string(), nr_processors); #ifdef CONFIG_SMP - seq_printf(f, "cpus active\t\t: %ld\n" + seq_printf(f, "cpus active\t\t: %d\n" "cpu active mask\t\t: %016lx\n", - num_online_cpus(), cpu_present_mask); + num_online_cpus(), cpus_addr(cpu_possible_map)[0]); #endif show_cache_size (f, "L1 Icache", alpha_l1i_cacheshape); @@ -1359,7 +1366,7 @@ determine_cpu_caches (unsigned int cpu_type) L1I = L1D = CSHAPE(8*1024, 5, 1); L3 = -1; - car = *(vuip) phys_to_virt (0x120000078); + 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); @@ -1374,7 +1381,7 @@ determine_cpu_caches (unsigned int cpu_type) L1I = L1D = CSHAPE(8*1024, 5, 1); /* Check the line size of the Scache. */ - sc_ctl = *(vulp) phys_to_virt (0xfffff000a8); + sc_ctl = *(vulp) phys_to_virt (0xfffff000a8UL); width = sc_ctl & 0x1000 ? 6 : 5; L2 = CSHAPE (96*1024, width, 3); @@ -1406,7 +1413,7 @@ determine_cpu_caches (unsigned int cpu_type) } L3 = -1; - cbox_config = *(vulp) phys_to_virt (0xfffff00008); + cbox_config = *(vulp) phys_to_virt (0xfffff00008UL); size = 512*1024 * (1 << ((cbox_config >> 12) & 3)); #if 0 @@ -1486,3 +1493,20 @@ alpha_panic_event(struct notifier_block *this, unsigned long event, void *ptr) #endif return NOTIFY_DONE; } + +static __init int add_pcspkr(void) +{ + struct platform_device *pd; + int ret; + + pd = platform_device_alloc("pcspkr", -1); + if (!pd) + return -ENOMEM; + + ret = platform_device_add(pd); + if (ret) + platform_device_put(pd); + + return ret; +} +device_initcall(add_pcspkr);