vserver 2.0 rc7
[linux-2.6.git] / arch / sparc64 / kernel / setup.c
1 /*  $Id: setup.c,v 1.72 2002/02/09 19:49:30 davem Exp $
2  *  linux/arch/sparc64/kernel/setup.c
3  *
4  *  Copyright (C) 1995,1996  David S. Miller (davem@caip.rutgers.edu)
5  *  Copyright (C) 1997       Jakub Jelinek (jj@sunsite.mff.cuni.cz)
6  */
7
8 #include <linux/errno.h>
9 #include <linux/sched.h>
10 #include <linux/kernel.h>
11 #include <linux/mm.h>
12 #include <linux/stddef.h>
13 #include <linux/unistd.h>
14 #include <linux/ptrace.h>
15 #include <linux/slab.h>
16 #include <asm/smp.h>
17 #include <linux/user.h>
18 #include <linux/a.out.h>
19 #include <linux/tty.h>
20 #include <linux/delay.h>
21 #include <linux/config.h>
22 #include <linux/fs.h>
23 #include <linux/seq_file.h>
24 #include <linux/syscalls.h>
25 #include <linux/kdev_t.h>
26 #include <linux/major.h>
27 #include <linux/string.h>
28 #include <linux/init.h>
29 #include <linux/inet.h>
30 #include <linux/console.h>
31 #include <linux/root_dev.h>
32 #include <linux/interrupt.h>
33 #include <linux/cpu.h>
34 #include <linux/initrd.h>
35
36 #include <asm/segment.h>
37 #include <asm/system.h>
38 #include <asm/io.h>
39 #include <asm/processor.h>
40 #include <asm/oplib.h>
41 #include <asm/page.h>
42 #include <asm/pgtable.h>
43 #include <asm/idprom.h>
44 #include <asm/head.h>
45 #include <asm/starfire.h>
46 #include <asm/mmu_context.h>
47 #include <asm/timer.h>
48 #include <asm/sections.h>
49 #include <asm/setup.h>
50 #include <asm/mmu.h>
51
52 #ifdef CONFIG_IP_PNP
53 #include <net/ipconfig.h>
54 #endif
55
56 struct screen_info screen_info = {
57         0, 0,                   /* orig-x, orig-y */
58         0,                      /* unused */
59         0,                      /* orig-video-page */
60         0,                      /* orig-video-mode */
61         128,                    /* orig-video-cols */
62         0, 0, 0,                /* unused, ega_bx, unused */
63         54,                     /* orig-video-lines */
64         0,                      /* orig-video-isVGA */
65         16                      /* orig-video-points */
66 };
67
68 /* Typing sync at the prom prompt calls the function pointed to by
69  * the sync callback which I set to the following function.
70  * This should sync all filesystems and return, for now it just
71  * prints out pretty messages and returns.
72  */
73
74 void (*prom_palette)(int);
75 void (*prom_keyboard)(void);
76
77 static void
78 prom_console_write(struct console *con, const char *s, unsigned n)
79 {
80         prom_write(s, n);
81 }
82
83 static struct console prom_console = {
84         .name =         "prom",
85         .write =        prom_console_write,
86         .flags =        CON_CONSDEV | CON_ENABLED,
87         .index =        -1,
88 };
89
90 #define PROM_TRUE       -1
91 #define PROM_FALSE      0
92
93 /* Pretty sick eh? */
94 int prom_callback(long *args)
95 {
96         struct console *cons, *saved_console = NULL;
97         unsigned long flags;
98         char *cmd;
99         extern spinlock_t prom_entry_lock;
100
101         if (!args)
102                 return -1;
103         if (!(cmd = (char *)args[0]))
104                 return -1;
105
106         /*
107          * The callback can be invoked on the cpu that first dropped 
108          * into prom_cmdline after taking the serial interrupt, or on 
109          * a slave processor that was smp_captured() if the 
110          * administrator has done a switch-cpu inside obp. In either 
111          * case, the cpu is marked as in-interrupt. Drop IRQ locks.
112          */
113         irq_exit();
114
115         /* XXX Revisit the locking here someday.  This is a debugging
116          * XXX feature so it isnt all that critical.  -DaveM
117          */
118         local_irq_save(flags);
119
120         spin_unlock(&prom_entry_lock);
121         cons = console_drivers;
122         while (cons) {
123                 unregister_console(cons);
124                 cons->flags &= ~(CON_PRINTBUFFER);
125                 cons->next = saved_console;
126                 saved_console = cons;
127                 cons = console_drivers;
128         }
129         register_console(&prom_console);
130         if (!strcmp(cmd, "sync")) {
131                 prom_printf("PROM `%s' command...\n", cmd);
132                 show_free_areas();
133                 if (current->pid != 0) {
134                         local_irq_enable();
135                         sys_sync();
136                         local_irq_disable();
137                 }
138                 args[2] = 0;
139                 args[args[1] + 3] = -1;
140                 prom_printf("Returning to PROM\n");
141         } else if (!strcmp(cmd, "va>tte-data")) {
142                 unsigned long ctx, va;
143                 unsigned long tte = 0;
144                 long res = PROM_FALSE;
145
146                 ctx = args[3];
147                 va = args[4];
148                 if (ctx) {
149                         /*
150                          * Find process owning ctx, lookup mapping.
151                          */
152                         struct task_struct *p;
153                         struct mm_struct *mm = NULL;
154                         pgd_t *pgdp;
155                         pud_t *pudp;
156                         pmd_t *pmdp;
157                         pte_t *ptep;
158
159                         for_each_process(p) {
160                                 mm = p->mm;
161                                 if (CTX_NRBITS(mm->context) == ctx)
162                                         break;
163                         }
164                         if (!mm ||
165                             CTX_NRBITS(mm->context) != ctx)
166                                 goto done;
167
168                         pgdp = pgd_offset(mm, va);
169                         if (pgd_none(*pgdp))
170                                 goto done;
171                         pudp = pud_offset(pgdp, va);
172                         if (pud_none(*pudp))
173                                 goto done;
174                         pmdp = pmd_offset(pudp, va);
175                         if (pmd_none(*pmdp))
176                                 goto done;
177
178                         /* Preemption implicitly disabled by virtue of
179                          * being called from inside OBP.
180                          */
181                         ptep = pte_offset_map(pmdp, va);
182                         if (pte_present(*ptep)) {
183                                 tte = pte_val(*ptep);
184                                 res = PROM_TRUE;
185                         }
186                         pte_unmap(ptep);
187                         goto done;
188                 }
189
190                 if ((va >= KERNBASE) && (va < (KERNBASE + (4 * 1024 * 1024)))) {
191                         unsigned long kernel_pctx = 0;
192
193                         if (tlb_type == cheetah_plus)
194                                 kernel_pctx |= (CTX_CHEETAH_PLUS_NUC |
195                                                 CTX_CHEETAH_PLUS_CTX0);
196
197                         /* Spitfire Errata #32 workaround */
198                         __asm__ __volatile__("stxa      %0, [%1] %2\n\t"
199                                              "flush     %%g6"
200                                              : /* No outputs */
201                                              : "r" (kernel_pctx),
202                                                "r" (PRIMARY_CONTEXT),
203                                                "i" (ASI_DMMU));
204
205                         /*
206                          * Locked down tlb entry.
207                          */
208
209                         if (tlb_type == spitfire)
210                                 tte = spitfire_get_dtlb_data(SPITFIRE_HIGHEST_LOCKED_TLBENT);
211                         else if (tlb_type == cheetah || tlb_type == cheetah_plus)
212                                 tte = cheetah_get_ldtlb_data(CHEETAH_HIGHEST_LOCKED_TLBENT);
213
214                         res = PROM_TRUE;
215                         goto done;
216                 }
217
218                 if (va < PGDIR_SIZE) {
219                         /*
220                          * vmalloc or prom_inherited mapping.
221                          */
222                         pgd_t *pgdp;
223                         pud_t *pudp;
224                         pmd_t *pmdp;
225                         pte_t *ptep;
226                         int error;
227
228                         if ((va >= LOW_OBP_ADDRESS) && (va < HI_OBP_ADDRESS)) {
229                                 tte = prom_virt_to_phys(va, &error);
230                                 if (!error)
231                                         res = PROM_TRUE;
232                                 goto done;
233                         }
234                         pgdp = pgd_offset_k(va);
235                         if (pgd_none(*pgdp))
236                                 goto done;
237                         pudp = pud_offset(pgdp, va);
238                         if (pud_none(*pudp))
239                                 goto done;
240                         pmdp = pmd_offset(pudp, va);
241                         if (pmd_none(*pmdp))
242                                 goto done;
243
244                         /* Preemption implicitly disabled by virtue of
245                          * being called from inside OBP.
246                          */
247                         ptep = pte_offset_kernel(pmdp, va);
248                         if (pte_present(*ptep)) {
249                                 tte = pte_val(*ptep);
250                                 res = PROM_TRUE;
251                         }
252                         goto done;
253                 }
254
255                 if (va < PAGE_OFFSET) {
256                         /*
257                          * No mappings here.
258                          */
259                         goto done;
260                 }
261
262                 if (va & (1UL << 40)) {
263                         /*
264                          * I/O page.
265                          */
266
267                         tte = (__pa(va) & _PAGE_PADDR) |
268                               _PAGE_VALID | _PAGE_SZ4MB |
269                               _PAGE_E | _PAGE_P | _PAGE_W;
270                         res = PROM_TRUE;
271                         goto done;
272                 }
273
274                 /*
275                  * Normal page.
276                  */
277                 tte = (__pa(va) & _PAGE_PADDR) |
278                       _PAGE_VALID | _PAGE_SZ4MB |
279                       _PAGE_CP | _PAGE_CV | _PAGE_P | _PAGE_W;
280                 res = PROM_TRUE;
281
282         done:
283                 if (res == PROM_TRUE) {
284                         args[2] = 3;
285                         args[args[1] + 3] = 0;
286                         args[args[1] + 4] = res;
287                         args[args[1] + 5] = tte;
288                 } else {
289                         args[2] = 2;
290                         args[args[1] + 3] = 0;
291                         args[args[1] + 4] = res;
292                 }
293         } else if (!strcmp(cmd, ".soft1")) {
294                 unsigned long tte;
295
296                 tte = args[3];
297                 prom_printf("%lx:\"%s%s%s%s%s\" ",
298                             (tte & _PAGE_SOFT) >> 7,
299                             tte & _PAGE_MODIFIED ? "M" : "-",
300                             tte & _PAGE_ACCESSED ? "A" : "-",
301                             tte & _PAGE_READ     ? "W" : "-",
302                             tte & _PAGE_WRITE    ? "R" : "-",
303                             tte & _PAGE_PRESENT  ? "P" : "-");
304
305                 args[2] = 2;
306                 args[args[1] + 3] = 0;
307                 args[args[1] + 4] = PROM_TRUE;
308         } else if (!strcmp(cmd, ".soft2")) {
309                 unsigned long tte;
310
311                 tte = args[3];
312                 prom_printf("%lx ", (tte & 0x07FC000000000000UL) >> 50);
313
314                 args[2] = 2;
315                 args[args[1] + 3] = 0;
316                 args[args[1] + 4] = PROM_TRUE;
317         } else {
318                 prom_printf("unknown PROM `%s' command...\n", cmd);
319         }
320         unregister_console(&prom_console);
321         while (saved_console) {
322                 cons = saved_console;
323                 saved_console = cons->next;
324                 register_console(cons);
325         }
326         spin_lock(&prom_entry_lock);
327         local_irq_restore(flags);
328
329         /*
330          * Restore in-interrupt status for a resume from obp.
331          */
332         irq_enter();
333         return 0;
334 }
335
336 unsigned int boot_flags = 0;
337 #define BOOTME_DEBUG  0x1
338 #define BOOTME_SINGLE 0x2
339
340 /* Exported for mm/init.c:paging_init. */
341 unsigned long cmdline_memory_size = 0;
342
343 static struct console prom_debug_console = {
344         .name =         "debug",
345         .write =        prom_console_write,
346         .flags =        CON_PRINTBUFFER,
347         .index =        -1,
348 };
349
350 /* XXX Implement this at some point... */
351 void kernel_enter_debugger(void)
352 {
353 }
354
355 int obp_system_intr(void)
356 {
357         if (boot_flags & BOOTME_DEBUG) {
358                 printk("OBP: system interrupted\n");
359                 prom_halt();
360                 return 1;
361         }
362         return 0;
363 }
364
365 /* 
366  * Process kernel command line switches that are specific to the
367  * SPARC or that require special low-level processing.
368  */
369 static void __init process_switch(char c)
370 {
371         switch (c) {
372         case 'd':
373                 boot_flags |= BOOTME_DEBUG;
374                 break;
375         case 's':
376                 boot_flags |= BOOTME_SINGLE;
377                 break;
378         case 'h':
379                 prom_printf("boot_flags_init: Halt!\n");
380                 prom_halt();
381                 break;
382         case 'p':
383                 /* Use PROM debug console. */
384                 register_console(&prom_debug_console);
385                 break;
386         case 'P':
387                 /* Force UltraSPARC-III P-Cache on. */
388                 if (tlb_type != cheetah) {
389                         printk("BOOT: Ignoring P-Cache force option.\n");
390                         break;
391                 }
392                 cheetah_pcache_forced_on = 1;
393                 add_taint(TAINT_MACHINE_CHECK);
394                 cheetah_enable_pcache();
395                 break;
396
397         default:
398                 printk("Unknown boot switch (-%c)\n", c);
399                 break;
400         }
401 }
402
403 static void __init process_console(char *commands)
404 {
405         serial_console = 0;
406         commands += 8;
407         /* Linux-style serial */
408         if (!strncmp(commands, "ttyS", 4))
409                 serial_console = simple_strtoul(commands + 4, NULL, 10) + 1;
410         else if (!strncmp(commands, "tty", 3)) {
411                 char c = *(commands + 3);
412                 /* Solaris-style serial */
413                 if (c == 'a' || c == 'b') {
414                         serial_console = c - 'a' + 1;
415                         prom_printf ("Using /dev/tty%c as console.\n", c);
416                 }
417                 /* else Linux-style fbcon, not serial */
418         }
419 #if defined(CONFIG_PROM_CONSOLE)
420         if (!strncmp(commands, "prom", 4)) {
421                 char *p;
422
423                 for (p = commands - 8; *p && *p != ' '; p++)
424                         *p = ' ';
425                 conswitchp = &prom_con;
426         }
427 #endif
428 }
429
430 static void __init boot_flags_init(char *commands)
431 {
432         while (*commands) {
433                 /* Move to the start of the next "argument". */
434                 while (*commands && *commands == ' ')
435                         commands++;
436
437                 /* Process any command switches, otherwise skip it. */
438                 if (*commands == '\0')
439                         break;
440                 if (*commands == '-') {
441                         commands++;
442                         while (*commands && *commands != ' ')
443                                 process_switch(*commands++);
444                         continue;
445                 }
446                 if (!strncmp(commands, "console=", 8)) {
447                         process_console(commands);
448                 } else if (!strncmp(commands, "mem=", 4)) {
449                         /*
450                          * "mem=XXX[kKmM]" overrides the PROM-reported
451                          * memory size.
452                          */
453                         cmdline_memory_size = simple_strtoul(commands + 4,
454                                                              &commands, 0);
455                         if (*commands == 'K' || *commands == 'k') {
456                                 cmdline_memory_size <<= 10;
457                                 commands++;
458                         } else if (*commands=='M' || *commands=='m') {
459                                 cmdline_memory_size <<= 20;
460                                 commands++;
461                         }
462                 }
463                 while (*commands && *commands != ' ')
464                         commands++;
465         }
466 }
467
468 extern int prom_probe_memory(void);
469 extern unsigned long start, end;
470 extern void panic_setup(char *, int *);
471
472 extern unsigned short root_flags;
473 extern unsigned short root_dev;
474 extern unsigned short ram_flags;
475 #define RAMDISK_IMAGE_START_MASK        0x07FF
476 #define RAMDISK_PROMPT_FLAG             0x8000
477 #define RAMDISK_LOAD_FLAG               0x4000
478
479 extern int root_mountflags;
480
481 char reboot_command[COMMAND_LINE_SIZE];
482
483 static struct pt_regs fake_swapper_regs = { { 0, }, 0, 0, 0, 0 };
484
485 void register_prom_callbacks(void)
486 {
487         prom_setcallback(prom_callback);
488         prom_feval(": linux-va>tte-data 2 \" va>tte-data\" $callback drop ; "
489                    "' linux-va>tte-data to va>tte-data");
490         prom_feval(": linux-.soft1 1 \" .soft1\" $callback 2drop ; "
491                    "' linux-.soft1 to .soft1");
492         prom_feval(": linux-.soft2 1 \" .soft2\" $callback 2drop ; "
493                    "' linux-.soft2 to .soft2");
494 }
495
496 extern void paging_init(void);
497
498 void __init setup_arch(char **cmdline_p)
499 {
500         unsigned long highest_paddr;
501         int i;
502
503         /* Initialize PROM console and command line. */
504         *cmdline_p = prom_getbootargs();
505         strcpy(saved_command_line, *cmdline_p);
506
507         printk("ARCH: SUN4U\n");
508
509 #ifdef CONFIG_DUMMY_CONSOLE
510         conswitchp = &dummy_con;
511 #elif defined(CONFIG_PROM_CONSOLE)
512         conswitchp = &prom_con;
513 #endif
514
515 #ifdef CONFIG_SMP
516         i = (unsigned long)&irq_stat[1] - (unsigned long)&irq_stat[0];
517         if ((i == SMP_CACHE_BYTES) || (i == (2 * SMP_CACHE_BYTES))) {
518                 extern unsigned int irqsz_patchme[1];
519                 irqsz_patchme[0] |= ((i == SMP_CACHE_BYTES) ? SMP_CACHE_BYTES_SHIFT : \
520                                                         SMP_CACHE_BYTES_SHIFT + 1);
521                 flushi((long)&irqsz_patchme[0]);
522         } else {
523                 prom_printf("Unexpected size of irq_stat[] elements\n");
524                 prom_halt();
525         }
526 #endif
527         /* Work out if we are starfire early on */
528         check_if_starfire();
529
530         boot_flags_init(*cmdline_p);
531
532         idprom_init();
533         (void) prom_probe_memory();
534
535         /* In paging_init() we tip off this value to see if we need
536          * to change init_mm.pgd to point to the real alias mapping.
537          */
538         phys_base = 0xffffffffffffffffUL;
539         highest_paddr = 0UL;
540         for (i = 0; sp_banks[i].num_bytes != 0; i++) {
541                 unsigned long top;
542
543                 if (sp_banks[i].base_addr < phys_base)
544                         phys_base = sp_banks[i].base_addr;
545                 top = sp_banks[i].base_addr +
546                         sp_banks[i].num_bytes;
547                 if (highest_paddr < top)
548                         highest_paddr = top;
549         }
550         pfn_base = phys_base >> PAGE_SHIFT;
551
552         switch (tlb_type) {
553         default:
554         case spitfire:
555                 kern_base = spitfire_get_itlb_data(sparc64_highest_locked_tlbent());
556                 kern_base &= _PAGE_PADDR_SF;
557                 break;
558
559         case cheetah:
560         case cheetah_plus:
561                 kern_base = cheetah_get_litlb_data(sparc64_highest_locked_tlbent());
562                 kern_base &= _PAGE_PADDR;
563                 break;
564         };
565
566         kern_size = (unsigned long)&_end - (unsigned long)KERNBASE;
567
568         if (!root_flags)
569                 root_mountflags &= ~MS_RDONLY;
570         ROOT_DEV = old_decode_dev(root_dev);
571 #ifdef CONFIG_BLK_DEV_INITRD
572         rd_image_start = ram_flags & RAMDISK_IMAGE_START_MASK;
573         rd_prompt = ((ram_flags & RAMDISK_PROMPT_FLAG) != 0);
574         rd_doload = ((ram_flags & RAMDISK_LOAD_FLAG) != 0);     
575 #endif
576
577         init_task.thread_info->kregs = &fake_swapper_regs;
578
579 #ifdef CONFIG_IP_PNP
580         if (!ic_set_manually) {
581                 int chosen = prom_finddevice ("/chosen");
582                 u32 cl, sv, gw;
583                 
584                 cl = prom_getintdefault (chosen, "client-ip", 0);
585                 sv = prom_getintdefault (chosen, "server-ip", 0);
586                 gw = prom_getintdefault (chosen, "gateway-ip", 0);
587                 if (cl && sv) {
588                         ic_myaddr = cl;
589                         ic_servaddr = sv;
590                         if (gw)
591                                 ic_gateway = gw;
592 #if defined(CONFIG_IP_PNP_BOOTP) || defined(CONFIG_IP_PNP_RARP)
593                         ic_proto_enabled = 0;
594 #endif
595                 }
596         }
597 #endif
598
599         paging_init();
600 }
601
602 static int __init set_preferred_console(void)
603 {
604         int idev, odev;
605
606         /* The user has requested a console so this is already set up. */
607         if (serial_console >= 0)
608                 return -EBUSY;
609
610         idev = prom_query_input_device();
611         odev = prom_query_output_device();
612         if (idev == PROMDEV_IKBD && odev == PROMDEV_OSCREEN) {
613                 serial_console = 0;
614         } else if (idev == PROMDEV_ITTYA && odev == PROMDEV_OTTYA) {
615                 serial_console = 1;
616         } else if (idev == PROMDEV_ITTYB && odev == PROMDEV_OTTYB) {
617                 serial_console = 2;
618         } else {
619                 prom_printf("Inconsistent console: "
620                             "input %d, output %d\n",
621                             idev, odev);
622                 prom_halt();
623         }
624
625         if (serial_console)
626                 return add_preferred_console("ttyS", serial_console - 1, NULL);
627
628         return -ENODEV;
629 }
630 console_initcall(set_preferred_console);
631
632 /* BUFFER is PAGE_SIZE bytes long. */
633
634 extern char *sparc_cpu_type;
635 extern char *sparc_fpu_type;
636
637 extern void smp_info(struct seq_file *);
638 extern void smp_bogo(struct seq_file *);
639 extern void mmu_info(struct seq_file *);
640
641 static int show_cpuinfo(struct seq_file *m, void *__unused)
642 {
643         seq_printf(m, 
644                    "cpu\t\t: %s\n"
645                    "fpu\t\t: %s\n"
646                    "promlib\t\t: Version 3 Revision %d\n"
647                    "prom\t\t: %d.%d.%d\n"
648                    "type\t\t: sun4u\n"
649                    "ncpus probed\t: %ld\n"
650                    "ncpus active\t: %ld\n"
651 #ifndef CONFIG_SMP
652                    "Cpu0Bogo\t: %lu.%02lu\n"
653                    "Cpu0ClkTck\t: %016lx\n"
654 #endif
655                    ,
656                    sparc_cpu_type,
657                    sparc_fpu_type,
658                    prom_rev,
659                    prom_prev >> 16,
660                    (prom_prev >> 8) & 0xff,
661                    prom_prev & 0xff,
662                    (long)num_possible_cpus(),
663                    (long)num_online_cpus()
664 #ifndef CONFIG_SMP
665                    , cpu_data(0).udelay_val/(500000/HZ),
666                    (cpu_data(0).udelay_val/(5000/HZ)) % 100,
667                    cpu_data(0).clock_tick
668 #endif
669                 );
670 #ifdef CONFIG_SMP
671         smp_bogo(m);
672 #endif
673         mmu_info(m);
674 #ifdef CONFIG_SMP
675         smp_info(m);
676 #endif
677         return 0;
678 }
679
680 static void *c_start(struct seq_file *m, loff_t *pos)
681 {
682         /* The pointer we are returning is arbitrary,
683          * it just has to be non-NULL and not IS_ERR
684          * in the success case.
685          */
686         return *pos == 0 ? &c_start : NULL;
687 }
688
689 static void *c_next(struct seq_file *m, void *v, loff_t *pos)
690 {
691         ++*pos;
692         return c_start(m, pos);
693 }
694
695 static void c_stop(struct seq_file *m, void *v)
696 {
697 }
698
699 struct seq_operations cpuinfo_op = {
700         .start =c_start,
701         .next = c_next,
702         .stop = c_stop,
703         .show = show_cpuinfo,
704 };
705
706 extern int stop_a_enabled;
707
708 void sun_do_break(void)
709 {
710         if (!stop_a_enabled)
711                 return;
712
713         prom_printf("\n");
714         flush_user_windows();
715
716         prom_cmdline();
717 }
718
719 int serial_console = -1;
720 int stop_a_enabled = 1;
721
722 static int __init topology_init(void)
723 {
724         int i, err;
725
726         err = -ENOMEM;
727         for (i = 0; i < NR_CPUS; i++) {
728                 if (cpu_possible(i)) {
729                         struct cpu *p = kmalloc(sizeof(*p), GFP_KERNEL);
730
731                         if (p) {
732                                 memset(p, 0, sizeof(*p));
733                                 register_cpu(p, i, NULL);
734                                 err = 0;
735                         }
736                 }
737         }
738
739         return err;
740 }
741
742 subsys_initcall(topology_init);