root/arch/sparc/prom/init.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. prom_init

   1 /* init.c:  Initialize internal variables used by the PROM
   2  *          library functions.
   3  *
   4  * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
   5  */
   6 
   7 #include <asm/openprom.h>
   8 #include <asm/oplib.h>
   9 
  10 struct linux_romvec *romvec;
  11 enum prom_major_version prom_vers;
  12 unsigned int prom_rev, prom_prev;
  13 
  14 /* The root node of the prom device tree. */
  15 int prom_root_node;
  16 
  17 /* Pointer to the device tree operations structure. */
  18 struct linux_nodeops *prom_nodeops;
  19 
  20 /* You must call prom_init() before you attempt to use any of the
  21  * routines in the prom library.  It returns 0 on success, 1 on
  22  * failure.  It gets passed the pointer to the PROM vector.
  23  */
  24 
  25 extern void prom_meminit(void);
  26 extern void prom_ranges_init(void);
  27 
  28 int
  29 prom_init(struct linux_romvec *rp)
     /* [previous][next][first][last][top][bottom][index][help] */
  30 {
  31         if(!rp) return 1;
  32         romvec = rp;
  33         if(romvec->pv_magic_cookie != LINUX_OPPROM_MAGIC)
  34                 return 1;
  35 
  36         /* Ok, we seem to have a sane romvec here. */
  37         switch(romvec->pv_romvers) {
  38         case 0:
  39                 prom_vers = PROM_V0;
  40                 break;
  41         case 2:
  42                 prom_vers = PROM_V2;
  43                 break;
  44         case 3:
  45                 prom_vers = PROM_V3;
  46                 break;
  47         case 4:
  48                 prom_vers = PROM_P1275;
  49                 prom_printf("PROMLIB: Sun IEEE Prom not supported yet\n");
  50                 return 1;
  51                 break;
  52         default:
  53                 prom_printf("PROMLIB: Bad PROM version %d\n",
  54                             romvec->pv_romvers);
  55                 return 1;
  56                 break;
  57         };
  58 
  59         prom_rev = romvec->pv_plugin_revision;
  60         prom_prev = romvec->pv_printrev;
  61         prom_nodeops = romvec->pv_nodeops;
  62 
  63         prom_root_node = prom_getsibling(0);
  64         if((prom_root_node == 0) || (prom_root_node == -1))
  65                 return 1;
  66 
  67         if((((unsigned long) prom_nodeops) == 0) || 
  68            (((unsigned long) prom_nodeops) == -1))
  69                 return 1;
  70 
  71         prom_meminit();
  72         prom_ranges_init();
  73 
  74         prom_printf("PROMLIB: Sun Boot Prom Version %d Revision %d\n",
  75                     romvec->pv_romvers, prom_rev);
  76 
  77         /* Initialization successful. */
  78         return 0;
  79 }

/* [previous][next][first][last][top][bottom][index][help] */