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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [include/] [asm-ppc64/] [lmb.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
#ifndef _PPC64_LMB_H
2
#define _PPC64_LMB_H
3
 
4
/*
5
 * Definitions for talking to the Open Firmware PROM on
6
 * Power Macintosh computers.
7
 *
8
 * Copyright (C) 2001 Peter Bergner, IBM Corp.
9
 *
10
 * This program is free software; you can redistribute it and/or
11
 * modify it under the terms of the GNU General Public License
12
 * as published by the Free Software Foundation; either version
13
 * 2 of the License, or (at your option) any later version.
14
 */
15
 
16
#include <linux/config.h>
17
#include <asm/prom.h>
18
 
19
extern unsigned long reloc_offset(void);
20
 
21
#define MAX_LMB_REGIONS 64
22
 
23
union lmb_reg_property {
24
        struct reg_property32 addr32[MAX_LMB_REGIONS];
25
        struct reg_property64 addr64[MAX_LMB_REGIONS];
26
};
27
 
28
#define LMB_MEMORY_AREA 1
29
#define LMB_IO_AREA     2
30
 
31
#define LMB_ALLOC_ANYWHERE      0
32
#define LMB_ALLOC_FIRST4GBYTE   (1UL<<32)
33
 
34
struct lmb_property {
35
        unsigned long base;
36
        unsigned long physbase;
37
        unsigned long size;
38
        unsigned long type;
39
};
40
 
41
struct lmb_region {
42
        unsigned long cnt;
43
        unsigned long size;
44
        unsigned long iosize;
45
        unsigned long lcd_size;         /* Least Common Denominator */
46
        struct lmb_property region[MAX_LMB_REGIONS+1];
47
};
48
 
49
struct lmb {
50
        unsigned long debug;
51
        unsigned long rmo_size;
52
        struct lmb_region memory;
53
        struct lmb_region reserved;
54
};
55
 
56
extern struct lmb lmb;
57
 
58
extern void lmb_init(void);
59
extern void lmb_analyze(void);
60
extern long lmb_add(unsigned long, unsigned long);
61
#ifdef CONFIG_MSCHUNKS
62
extern long lmb_add_io(unsigned long base, unsigned long size);
63
#endif /* CONFIG_MSCHUNKS */
64
extern long lmb_reserve(unsigned long, unsigned long);
65
extern unsigned long lmb_alloc(unsigned long, unsigned long);
66
extern unsigned long lmb_alloc_base(unsigned long, unsigned long, unsigned long);
67
extern unsigned long lmb_phys_mem_size(void);
68
extern unsigned long lmb_end_of_DRAM(void);
69
extern unsigned long lmb_abs_to_phys(unsigned long);
70
extern void lmb_dump(char *);
71
 
72
static inline unsigned long
73
lmb_addrs_overlap(unsigned long base1, unsigned long size1,
74
                  unsigned long base2, unsigned long size2)
75
{
76
        return ((base1 < (base2+size2)) && (base2 < (base1+size1)));
77
}
78
 
79
static inline long
80
lmb_regions_overlap(struct lmb_region *rgn, unsigned long r1, unsigned long r2)
81
{
82
        unsigned long base1 = rgn->region[r1].base;
83
        unsigned long size1 = rgn->region[r1].size;
84
        unsigned long base2 = rgn->region[r2].base;
85
        unsigned long size2 = rgn->region[r2].size;
86
 
87
        return lmb_addrs_overlap(base1,size1,base2,size2);
88
}
89
 
90
static inline long
91
lmb_addrs_adjacent(unsigned long base1, unsigned long size1,
92
                   unsigned long base2, unsigned long size2)
93
{
94
        if ( base2 == base1 + size1 ) {
95
                return 1;
96
        } else if ( base1 == base2 + size2 ) {
97
                return -1;
98
        }
99
        return 0;
100
}
101
 
102
static inline long
103
lmb_regions_adjacent(struct lmb_region *rgn, unsigned long r1, unsigned long r2)
104
{
105
        unsigned long base1 = rgn->region[r1].base;
106
        unsigned long size1 = rgn->region[r1].size;
107
        unsigned long type1 = rgn->region[r1].type;
108
        unsigned long base2 = rgn->region[r2].base;
109
        unsigned long size2 = rgn->region[r2].size;
110
        unsigned long type2 = rgn->region[r2].type;
111
 
112
        return (type1 == type2) && lmb_addrs_adjacent(base1,size1,base2,size2);
113
}
114
 
115
#endif /* _PPC64_LMB_H */

powered by: WebSVN 2.1.0

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