1 /*
2  *
3  * This file is subject to the terms and conditions of the GNU General Public
4  * License.  See the file "COPYING" in the main directory of this archive
5  * for more details.
6  *
7  * Copyright (C) 2000-2003 Silicon Graphics, Inc.  All rights reserved.
8  */
9 
10 #include <linux/config.h>
11 
12 /*
13  * Structure of the mem config of the node as a SN MI reg
14  * Medusa supports this reg config.
15  *
16  * BankSize nibble to bank size mapping
17  *
18  *      1 - 64 MB
19  *      2 - 128 MB
20  *      3 - 256 MB
21  *      4 - 512 MB
22  *      5 - 1024 MB (1GB)
23  */
24 
25 #define MBSHIFT				20
26 
27 #ifdef SGI_SN2
28 typedef struct node_memmap_s
29 {
30         unsigned int    b0size  :3,     /* 0-2   bank 0 size */
31                         b0dou   :1,     /* 3     bank 0 is 2-sided */
32                         hack0   :4,     /* 4-7   bank 0 hack */
33         		b1size  :3,     /* 8-10  bank 1 size */
34                         b1dou   :1,     /* 11    bank 1 is 2-sided */
35                         hack1   :4,     /* 12-15 bank 1 hack */
36         		b2size  :3,     /* 16-18 bank 2 size */
37                         b2dou   :1,     /* 19    bank 1 is 2-sided */
38                         hack2   :4,     /* 20-23 bank 2 hack */
39         		b3size  :3,     /* 24-26 bank 3 size */
40                         b3dou   :1,     /* 27    bank 3 is 2-sided */
41                         hack3   :4;     /* 28-31 bank 3 hack */
42 } node_memmap_t ;
43 
44 #define PROXIMITY_DOMAIN(nasid) (((nasid)>>1) & 255)
45 #define SN2_BANK_SIZE_SHIFT		(MBSHIFT+6)     /* 64 MB */
46 #define MD_BANKS_PER_NODE 4
47 #define MD_BANKSIZE			(1UL << 34)
48 
49 #define MAX_SN_NODES            256
50 #define MAX_LSAPICS             512
51 #define MAX_CPUS_NODE           4
52 #define MAX_CPUS                (MAX_CPUS_NODE*MAX_SN_NODES)
53 #define CPUS_PER_FSB            2
54 #define CPUS_PER_FSB_MASK       (CPUS_PER_FSB-1)
55 #define MAX_NASID               2048
56 
57 #endif
58 
59 #define FPROM_BUG()             do {while (1);} while (0)
60 
61 typedef struct sn_memmap_s
62 {
63 	short		nasid ;
64 	short		cpuconfig;
65 	node_memmap_t 	node_memmap ;
66 } sn_memmap_t ;
67 
68 typedef struct sn_config_s
69 {
70 	int		cpus;
71 	int		nodes;
72 	sn_memmap_t	memmap[1];		/* start of array */
73 } sn_config_t;
74 
75 struct acpi_table_memory_affinity;
76 
77 extern long base_nasid;
78 
79 extern void build_init(unsigned long);
80 extern int build_efi_memmap(void *, int);
81 extern int GetNumNodes(void);
82 extern int GetNumCpus(void);
83 extern int IsCpuPresent(int, int);
84 extern int GetNasid(int);
85 extern void* build_memory_srat(struct acpi_table_memory_affinity *);
86 extern void GetLogicalCpu(int, int *, int *);
87