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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [drivers/] [acpi/] [numa.c] - Blame information for rev 1774

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

Line No. Rev Author Line
1 1275 phoenix
/*
2
 *  acpi_numa.c - ACPI NUMA support
3
 *
4
 *  Copyright (C) 2002 Takayoshi Kochi <t-kochi@bq.jp.nec.com>
5
 *
6
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7
 *
8
 *  This program is free software; you can redistribute it and/or modify
9
 *  it under the terms of the GNU General Public License as published by
10
 *  the Free Software Foundation; either version 2 of the License, or
11
 *  (at your option) any later version.
12
 *
13
 *  This program is distributed in the hope that it will be useful,
14
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 *  GNU General Public License for more details.
17
 *
18
 *  You should have received a copy of the GNU General Public License
19
 *  along with this program; if not, write to the Free Software
20
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21
 *
22
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23
 *
24
 */
25
 
26
#include <linux/config.h>
27
#include <linux/init.h>
28
#include <linux/kernel.h>
29
#include <linux/types.h>
30
#include <linux/errno.h>
31
#include <linux/acpi.h>
32
 
33
#define PREFIX                  "ACPI: "
34
 
35
extern int __init acpi_table_parse_madt_family (enum acpi_table_id id, unsigned long madt_size, int entry_id, acpi_madt_entry_handler handler);
36
 
37
void __init
38
acpi_table_print_srat_entry (
39
        acpi_table_entry_header *header)
40
{
41
        if (!header)
42
                return;
43
 
44
        switch (header->type) {
45
 
46
        case ACPI_SRAT_PROCESSOR_AFFINITY:
47
        {
48
                struct acpi_table_processor_affinity *p =
49
                        (struct acpi_table_processor_affinity*) header;
50
                printk(KERN_INFO PREFIX "SRAT Processor (id[0x%02x] eid[0x%02x]) in proximity domain %d %s\n",
51
                       p->apic_id, p->lsapic_eid, p->proximity_domain,
52
                       p->flags.enabled?"enabled":"disabled");
53
        }
54
                break;
55
 
56
        case ACPI_SRAT_MEMORY_AFFINITY:
57
        {
58
                struct acpi_table_memory_affinity *p =
59
                        (struct acpi_table_memory_affinity*) header;
60
                printk(KERN_INFO PREFIX "SRAT Memory (0x%08x%08x length 0x%08x%08x type 0x%x) in proximity domain %d %s%s\n",
61
                       p->base_addr_hi, p->base_addr_lo, p->length_hi, p->length_lo,
62
                       p->memory_type, p->proximity_domain,
63
                       p->flags.enabled ? "enabled" : "disabled",
64
                       p->flags.hot_pluggable ? " hot-pluggable" : "");
65
        }
66
                break;
67
 
68
        default:
69
                printk(KERN_WARNING PREFIX "Found unsupported SRAT entry (type = 0x%x)\n",
70
                        header->type);
71
                break;
72
        }
73
}
74
 
75
 
76
static int __init
77
acpi_parse_slit (unsigned long phys_addr, unsigned long size)
78
{
79
        struct acpi_table_slit  *slit;
80
        u32                     localities;
81
 
82
        if (!phys_addr || !size)
83
                return -EINVAL;
84
 
85
        slit = (struct acpi_table_slit *) __va(phys_addr);
86
 
87
        /* downcast just for %llu vs %lu for i386/ia64  */
88
        localities = (u32) slit->localities;
89
 
90
        printk(KERN_INFO PREFIX "SLIT localities %ux%u\n", localities, localities);
91
 
92
        acpi_numa_slit_init(slit);
93
 
94
        return 0;
95
}
96
 
97
 
98
static int __init
99
acpi_parse_processor_affinity (acpi_table_entry_header *header)
100
{
101
        struct acpi_table_processor_affinity *processor_affinity = NULL;
102
 
103
        processor_affinity = (struct acpi_table_processor_affinity*) header;
104
        if (!processor_affinity)
105
                return -EINVAL;
106
 
107
        acpi_table_print_srat_entry(header);
108
 
109
        /* let architecture-dependent part to do it */
110
        acpi_numa_processor_affinity_init(processor_affinity);
111
 
112
        return 0;
113
}
114
 
115
 
116
static int __init
117
acpi_parse_memory_affinity (acpi_table_entry_header *header)
118
{
119
        struct acpi_table_memory_affinity *memory_affinity = NULL;
120
 
121
        memory_affinity = (struct acpi_table_memory_affinity*) header;
122
        if (!memory_affinity)
123
                return -EINVAL;
124
 
125
        acpi_table_print_srat_entry(header);
126
 
127
        /* let architecture-dependent part to do it */
128
        acpi_numa_memory_affinity_init(memory_affinity);
129
 
130
        return 0;
131
}
132
 
133
 
134
static int __init
135
acpi_parse_srat (unsigned long phys_addr, unsigned long size)
136
{
137
        struct acpi_table_srat  *srat = NULL;
138
 
139
        if (!phys_addr || !size)
140
                return -EINVAL;
141
 
142
        srat = (struct acpi_table_srat *) __va(phys_addr);
143
 
144
        printk(KERN_INFO PREFIX "SRAT revision %d\n", srat->table_revision);
145
 
146
        return 0;
147
}
148
 
149
 
150
int __init
151
acpi_table_parse_srat (
152
        enum acpi_srat_entry_id id,
153
        acpi_madt_entry_handler handler)
154
{
155
        return acpi_table_parse_madt_family(ACPI_SRAT, sizeof(struct acpi_table_srat),
156
                                            id, handler);
157
}
158
 
159
 
160
int __init
161
acpi_numa_init()
162
{
163
        int                     result;
164
 
165
        /* SRAT: Static Resource Affinity Table */
166
        result = acpi_table_parse(ACPI_SRAT, acpi_parse_srat);
167
 
168
        if (result > 0) {
169
                result = acpi_table_parse_srat(ACPI_SRAT_PROCESSOR_AFFINITY,
170
                                               acpi_parse_processor_affinity);
171
                result = acpi_table_parse_srat(ACPI_SRAT_MEMORY_AFFINITY,
172
                                               acpi_parse_memory_affinity);
173
        } else {
174
                /* FIXME */
175
                printk("Warning: acpi_table_parse(ACPI_SRAT) returned %d!\n",result);
176
        }
177
 
178
        /* SLIT: System Locality Information Table */
179
        result = acpi_table_parse(ACPI_SLIT, acpi_parse_slit);
180
        if (result < 1) {
181
                /* FIXME */
182
                printk("Warning: acpi_table_parse(ACPI_SLIT) returned %d!\n",result);
183
        }
184
 
185
        acpi_numa_arch_fixup();
186
        return 0;
187
}

powered by: WebSVN 2.1.0

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