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