Subversion Repositories shark

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
422 giacomo 1
/*
2
 * linux/include/asm-i386/topology.h
3
 *
4
 * Written by: Matthew Dobson, IBM Corporation
5
 *
6
 * Copyright (C) 2002, IBM Corp.
7
 *
8
 * All rights reserved.          
9
 *
10
 * This program is free software; you can redistribute it and/or modify
11
 * it under the terms of the GNU General Public License as published by
12
 * the Free Software Foundation; either version 2 of the License, or
13
 * (at your option) any later version.
14
 *
15
 * This program is distributed in the hope that it will be useful, but
16
 * WITHOUT ANY WARRANTY; without even the implied warranty of
17
 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
18
 * NON INFRINGEMENT.  See the GNU General Public License for more
19
 * details.
20
 *
21
 * You should have received a copy of the GNU General Public License
22
 * along with this program; if not, write to the Free Software
23
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24
 *
25
 * Send feedback to <colpatch@us.ibm.com>
26
 */
27
#ifndef _ASM_I386_TOPOLOGY_H
28
#define _ASM_I386_TOPOLOGY_H
29
 
30
#ifdef CONFIG_NUMA
31
 
32
#include <asm/mpspec.h>
33
 
34
#include <linux/cpumask.h>
35
 
36
/* Mappings between logical cpu number and node number */
37
extern cpumask_t node_2_cpu_mask[];
38
extern int cpu_2_node[];
39
 
40
/* Returns the number of the node containing CPU 'cpu' */
41
static inline int cpu_to_node(int cpu)
42
{
43
        return cpu_2_node[cpu];
44
}
45
 
46
/* Returns the number of the node containing MemBlk 'memblk' */
47
#define memblk_to_node(memblk) (memblk)
48
 
49
/* Returns the number of the node containing Node 'node'.  This architecture is flat,
50
   so it is a pretty simple function! */
51
#define parent_node(node) (node)
52
 
53
/* Returns a bitmask of CPUs on Node 'node'. */
54
static inline cpumask_t node_to_cpumask(int node)
55
{
56
        return node_2_cpu_mask[node];
57
}
58
 
59
/* Returns the number of the first CPU on Node 'node'. */
60
static inline int node_to_first_cpu(int node)
61
{
62
        cpumask_t mask = node_to_cpumask(node);
63
        return first_cpu(mask);
64
}
65
 
66
/* Returns the number of the first MemBlk on Node 'node' */
67
#define node_to_memblk(node) (node)
68
 
69
/* Returns the number of the node containing PCI bus 'bus' */
70
static inline cpumask_t pcibus_to_cpumask(int bus)
71
{
72
        return node_to_cpumask(mp_bus_id_to_node[bus]);
73
}
74
 
75
/* Cross-node load balancing interval. */
76
#define NODE_BALANCE_RATE 100
77
 
78
#else /* !CONFIG_NUMA */
79
/*
80
 * Other i386 platforms should define their own version of the
81
 * above macros here.
82
 */
83
 
84
#include <asm-generic/topology.h>
85
 
86
#endif /* CONFIG_NUMA */
87
 
88
#endif /* _ASM_I386_TOPOLOGY_H */