Commit 71a5d027 authored by Jack Steiner's avatar Jack Steiner Committed by Tony Luck

[IA64-SGI] - new macros for SGI SN simulator

This patch changes some macros that are used when running kernel on the
SGI simulator.
Signed-off-by: default avatarJack Steiner <steiner@sgi.com>
Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
parent 8e4641b3
...@@ -384,7 +384,7 @@ static int __init sn_pci_init(void) ...@@ -384,7 +384,7 @@ static int __init sn_pci_init(void)
extern void register_sn_procfs(void); extern void register_sn_procfs(void);
#endif #endif
if (!ia64_platform_is("sn2") || IS_RUNNING_ON_SIMULATOR()) if (!ia64_platform_is("sn2") || IS_RUNNING_ON_FAKE_PROM())
return 0; return 0;
/* /*
......
...@@ -96,6 +96,7 @@ u8 sn_coherency_id; ...@@ -96,6 +96,7 @@ u8 sn_coherency_id;
EXPORT_SYMBOL(sn_coherency_id); EXPORT_SYMBOL(sn_coherency_id);
u8 sn_region_size; u8 sn_region_size;
EXPORT_SYMBOL(sn_region_size); EXPORT_SYMBOL(sn_region_size);
int sn_prom_type; /* 0=hardware, 1=medusa/realprom, 2=medusa/fakeprom */
short physical_node_map[MAX_PHYSNODE_ID]; short physical_node_map[MAX_PHYSNODE_ID];
...@@ -459,6 +460,14 @@ void __init sn_cpu_init(void) ...@@ -459,6 +460,14 @@ void __init sn_cpu_init(void)
int i; int i;
static int wars_have_been_checked; static int wars_have_been_checked;
if (smp_processor_id() == 0 && IS_MEDUSA()) {
if (ia64_sn_is_fake_prom())
sn_prom_type = 2;
else
sn_prom_type = 1;
printk("Running on medusa with %s PROM\n", (sn_prom_type == 1) ? "real" : "fake");
}
memset(pda, 0, sizeof(pda)); memset(pda, 0, sizeof(pda));
if (ia64_sn_get_sn_info(0, &sn_hub_info->shub2, &sn_hub_info->nasid_bitmask, &sn_hub_info->nasid_shift, if (ia64_sn_get_sn_info(0, &sn_hub_info->shub2, &sn_hub_info->nasid_bitmask, &sn_hub_info->nasid_shift,
&sn_system_size, &sn_sharing_domain_size, &sn_partition_id, &sn_system_size, &sn_sharing_domain_size, &sn_partition_id,
...@@ -556,6 +565,10 @@ static void __init scan_for_ionodes(void) ...@@ -556,6 +565,10 @@ static void __init scan_for_ionodes(void)
int nasid = 0; int nasid = 0;
lboard_t *brd; lboard_t *brd;
/* fakeprom does not support klgraph */
if (IS_RUNNING_ON_FAKE_PROM())
return;
/* Setup ionodes with memory */ /* Setup ionodes with memory */
for (nasid = 0; nasid < MAX_PHYSNODE_ID; nasid += 2) { for (nasid = 0; nasid < MAX_PHYSNODE_ID; nasid += 2) {
char *klgraph_header; char *klgraph_header;
...@@ -567,8 +580,6 @@ static void __init scan_for_ionodes(void) ...@@ -567,8 +580,6 @@ static void __init scan_for_ionodes(void)
cnodeid = -1; cnodeid = -1;
klgraph_header = __va(ia64_sn_get_klconfig_addr(nasid)); klgraph_header = __va(ia64_sn_get_klconfig_addr(nasid));
if (!klgraph_header) { if (!klgraph_header) {
if (IS_RUNNING_ON_SIMULATOR())
continue;
BUG(); /* All nodes must have klconfig tables! */ BUG(); /* All nodes must have klconfig tables! */
} }
cnodeid = nasid_to_cnodeid(nasid); cnodeid = nasid_to_cnodeid(nasid);
......
...@@ -10,16 +10,17 @@ ...@@ -10,16 +10,17 @@
#include <linux/config.h> #include <linux/config.h>
#ifdef CONFIG_IA64_SGI_SN_SIM
#define SNMAGIC 0xaeeeeeee8badbeefL #define SNMAGIC 0xaeeeeeee8badbeefL
#define IS_RUNNING_ON_SIMULATOR() ({long sn; asm("mov %0=cpuid[%1]" : "=r"(sn) : "r"(2)); sn == SNMAGIC;}) #define IS_MEDUSA() ({long sn; asm("mov %0=cpuid[%1]" : "=r"(sn) : "r"(2)); sn == SNMAGIC;})
#ifdef CONFIG_IA64_SGI_SN_SIM
#define SIMULATOR_SLEEP() asm("nop.i 0x8beef") #define SIMULATOR_SLEEP() asm("nop.i 0x8beef")
#define IS_RUNNING_ON_SIMULATOR() (sn_prom_type)
#define IS_RUNNING_ON_FAKE_PROM() (sn_prom_type == 2)
extern int sn_prom_type; /* 0=hardware, 1=medusa/realprom, 2=medusa/fakeprom */
#else #else
#define IS_RUNNING_ON_SIMULATOR() (0) #define IS_RUNNING_ON_SIMULATOR() (0)
#define IS_RUNNING_ON_FAKE_PROM() (0)
#define SIMULATOR_SLEEP() #define SIMULATOR_SLEEP()
#endif #endif
......
...@@ -132,6 +132,8 @@ ...@@ -132,6 +132,8 @@
#define SALRET_INVALID_ARG (-2) #define SALRET_INVALID_ARG (-2)
#define SALRET_ERROR (-3) #define SALRET_ERROR (-3)
#define SN_SAL_FAKE_PROM 0x02009999
/** /**
* sn_sal_rev_major - get the major SGI SAL revision number * sn_sal_rev_major - get the major SGI SAL revision number
...@@ -1105,4 +1107,12 @@ ia64_sn_bte_recovery(nasid_t nasid) ...@@ -1105,4 +1107,12 @@ ia64_sn_bte_recovery(nasid_t nasid)
return (int) rv.status; return (int) rv.status;
} }
static inline int
ia64_sn_is_fake_prom(void)
{
struct ia64_sal_retval rv;
SAL_CALL_NOLOCK(rv, SN_SAL_FAKE_PROM, 0, 0, 0, 0, 0, 0, 0);
return (rv.status == 0);
}
#endif /* _ASM_IA64_SN_SN_SAL_H */ #endif /* _ASM_IA64_SN_SN_SAL_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment