OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [arch/] [sparc/] [prom/] [init.c] - Blame information for rev 1777

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1624 jcastillo
/* $Id: init.c,v 1.1 2005-12-20 09:49:32 jcastillo Exp $
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
 */
7
 
8
#include <linux/config.h>
9
#include <linux/kernel.h>
10
 
11
#include <asm/openprom.h>
12
#include <asm/oplib.h>
13
 
14
struct linux_romvec *romvec;
15
enum prom_major_version prom_vers;
16
unsigned int prom_rev, prom_prev;
17
 
18
/* The root node of the prom device tree. */
19
int prom_root_node;
20
 
21
/* Pointer to the device tree operations structure. */
22
struct linux_nodeops *prom_nodeops;
23
 
24
/* You must call prom_init() before you attempt to use any of the
25
 * routines in the prom library.  It returns 0 on success, 1 on
26
 * failure.  It gets passed the pointer to the PROM vector.
27
 */
28
 
29
extern void prom_meminit(void);
30
extern void prom_ranges_init(void);
31
 
32
void
33
prom_init(struct linux_romvec *rp)
34
{
35
        romvec = rp;
36
 
37
#if CONFIG_AP1000
38
        prom_vers = PROM_AP1000;
39
        prom_meminit();
40
        prom_ranges_init();
41
        return;
42
#endif
43
        switch(romvec->pv_romvers) {
44
        case 0:
45
                prom_vers = PROM_V0;
46
                break;
47
        case 2:
48
                prom_vers = PROM_V2;
49
                break;
50
        case 3:
51
                prom_vers = PROM_V3;
52
                break;
53
        case 4:
54
                prom_vers = PROM_P1275;
55
                prom_printf("PROMLIB: Sun IEEE Prom not supported yet\n");
56
                prom_halt();
57
                break;
58
        default:
59
                prom_printf("PROMLIB: Bad PROM version %d\n",
60
                            romvec->pv_romvers);
61
                prom_halt();
62
                break;
63
        };
64
 
65
        prom_rev = romvec->pv_plugin_revision;
66
        prom_prev = romvec->pv_printrev;
67
        prom_nodeops = romvec->pv_nodeops;
68
 
69
        prom_root_node = prom_getsibling(0);
70
        if((prom_root_node == 0) || (prom_root_node == -1))
71
                prom_halt();
72
 
73
        if((((unsigned long) prom_nodeops) == 0) ||
74
           (((unsigned long) prom_nodeops) == -1))
75
                prom_halt();
76
 
77
        prom_meminit();
78
 
79
        prom_ranges_init();
80
 
81
        printk("PROMLIB: Sun Boot Prom Version %d Revision %d\n",
82
               romvec->pv_romvers, prom_rev);
83
 
84
        /* Initialization successful. */
85
        return;
86
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.