init_64.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * init.c: Initialize internal variables used by the PROM
  3. * library functions.
  4. *
  5. * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
  6. * Copyright (C) 1996,1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
  7. */
  8. #include <linux/kernel.h>
  9. #include <linux/init.h>
  10. #include <linux/string.h>
  11. #include <linux/ctype.h>
  12. #include <asm/openprom.h>
  13. #include <asm/oplib.h>
  14. /* OBP version string. */
  15. char prom_version[80];
  16. /* The root node of the prom device tree. */
  17. int prom_stdout;
  18. phandle prom_chosen_node;
  19. /* You must call prom_init() before you attempt to use any of the
  20. * routines in the prom library. It returns 0 on success, 1 on
  21. * failure. It gets passed the pointer to the PROM vector.
  22. */
  23. extern void prom_cif_init(void *, void *);
  24. void __init prom_init(void *cif_handler, void *cif_stack)
  25. {
  26. phandle node;
  27. prom_cif_init(cif_handler, cif_stack);
  28. prom_chosen_node = prom_finddevice(prom_chosen_path);
  29. if (!prom_chosen_node || (s32)prom_chosen_node == -1)
  30. prom_halt();
  31. prom_stdout = prom_getint(prom_chosen_node, "stdout");
  32. node = prom_finddevice("/openprom");
  33. if (!node || (s32)node == -1)
  34. prom_halt();
  35. prom_getstring(node, "version", prom_version, sizeof(prom_version));
  36. prom_printf("\n");
  37. }
  38. void __init prom_init_report(void)
  39. {
  40. printk("PROMLIB: Sun IEEE Boot Prom '%s'\n", prom_version);
  41. printk("PROMLIB: Root node compatible: %s\n", prom_root_compatible);
  42. }