[IA64-SGI] Add new vendor-specific SAL calls for:

- notifying the PROM of specific features that are supported by the OS.
This is used to enable PROM feature if and only if the corresponding
feature is implemented in the OS

- fetch feature sets that are supported by the current PROM. This allows
the OS to selectively enable features when the PROM support is available.

Signed-off-by: Jack Steiner <steiner@sgi.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>

authored by

Jack Steiner and committed by
Tony Luck
a1cddb88 d8971fcb

+103 -20
+19 -11
arch/ia64/sn/kernel/setup.c
··· 49 49 #include <asm/sn/clksupport.h> 50 50 #include <asm/sn/sn_sal.h> 51 51 #include <asm/sn/geo.h> 52 + #include <asm/sn/sn_feature_sets.h> 52 53 #include "xtalk/xwidgetdev.h" 53 54 #include "xtalk/hubdev.h" 54 55 #include <asm/sn/klconfig.h> ··· 100 99 int sn_prom_type; /* 0=hardware, 1=medusa/realprom, 2=medusa/fakeprom */ 101 100 102 101 short physical_node_map[MAX_PHYSNODE_ID]; 102 + static unsigned long sn_prom_features[MAX_PROM_FEATURE_SETS]; 103 103 104 104 EXPORT_SYMBOL(physical_node_map); 105 105 ··· 275 273 u32 version = sn_sal_rev(); 276 274 extern void sn_cpu_init(void); 277 275 278 - ia64_sn_plat_set_error_handling_features(); 276 + ia64_sn_plat_set_error_handling_features(); // obsolete 277 + ia64_sn_set_os_feature(OSF_MCA_SLV_TO_OS_INIT_SLV); 278 + ia64_sn_set_os_feature(OSF_FEAT_LOG_SBES); 279 + 279 280 280 281 #if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE) 281 282 /* ··· 320 315 } 321 316 322 317 printk("SGI SAL version %x.%02x\n", version >> 8, version & 0x00FF); 323 - 324 - /* 325 - * Confirm the SAL we're running on is recent enough... 326 - */ 327 - if (version < SN_SAL_MIN_VERSION) { 328 - printk(KERN_ERR "This kernel needs SGI SAL version >= " 329 - "%x.%02x\n", SN_SAL_MIN_VERSION >> 8, 330 - SN_SAL_MIN_VERSION & 0x00FF); 331 - panic("PROM version too old\n"); 332 - } 333 318 334 319 master_nasid = boot_get_nasid(); 335 320 ··· 475 480 */ 476 481 if (nodepdaindr[0] == NULL) 477 482 return; 483 + 484 + for (i = 0; i < MAX_PROM_FEATURE_SETS; i++) 485 + if (ia64_sn_get_prom_feature_set(i, &sn_prom_features[i]) != 0) 486 + break; 478 487 479 488 cpuid = smp_processor_id(); 480 489 cpuphyid = get_sapicid(); ··· 651 652 652 653 return -1; 653 654 } 655 + 656 + int sn_prom_feature_available(int id) 657 + { 658 + if (id >= BITS_PER_LONG * MAX_PROM_FEATURE_SETS) 659 + return 0; 660 + return test_bit(id, sn_prom_features); 661 + } 662 + EXPORT_SYMBOL(sn_prom_feature_available); 663 +
+57
include/asm-ia64/sn/sn_feature_sets.h
··· 1 + #ifndef _ASM_IA64_SN_FEATURE_SETS_H 2 + #define _ASM_IA64_SN_FEATURE_SETS_H 3 + 4 + /* 5 + * SN PROM Features 6 + * 7 + * This file is subject to the terms and conditions of the GNU General Public 8 + * License. See the file "COPYING" in the main directory of this archive 9 + * for more details. 10 + * 11 + * Copyright (c) 2005 Silicon Graphics, Inc. All rights reserved. 12 + */ 13 + 14 + 15 + #include <asm/types.h> 16 + #include <asm/bitops.h> 17 + 18 + /* --------------------- PROM Features -----------------------------*/ 19 + extern int sn_prom_feature_available(int id); 20 + 21 + #define MAX_PROM_FEATURE_SETS 2 22 + 23 + /* 24 + * The following defines features that may or may not be supported by the 25 + * current PROM. The OS uses sn_prom_feature_available(feature) to test for 26 + * the presence of a PROM feature. Down rev (old) PROMs will always test 27 + * "false" for new features. 28 + * 29 + * Use: 30 + * if (sn_prom_feature_available(PRF_FEATURE_XXX)) 31 + * ... 32 + */ 33 + 34 + /* 35 + * Example: feature XXX 36 + */ 37 + #define PRF_FEATURE_XXX 0 38 + 39 + 40 + 41 + /* --------------------- OS Features -------------------------------*/ 42 + 43 + /* 44 + * The following defines OS features that are optionally present in 45 + * the operating system. 46 + * During boot, PROM is notified of these features via a series of calls: 47 + * 48 + * ia64_sn_set_os_feature(feature1); 49 + * 50 + * Once enabled, a feature cannot be disabled. 51 + * 52 + * By default, features are disabled unless explicitly enabled. 53 + */ 54 + #define OSF_MCA_SLV_TO_OS_INIT_SLV 0 55 + #define OSF_FEAT_LOG_SBES 1 56 + 57 + #endif /* _ASM_IA64_SN_FEATURE_SETS_H */
+27 -9
include/asm-ia64/sn/sn_sal.h
··· 80 80 #define SN_SAL_BTE_RECOVER 0x02000061 81 81 #define SN_SAL_IOIF_GET_PCI_TOPOLOGY 0x02000062 82 82 83 + #define SN_SAL_GET_PROM_FEATURE_SET 0x02000065 84 + #define SN_SAL_SET_OS_FEATURE_SET 0x02000066 85 + 83 86 /* 84 87 * Service-specific constants 85 88 */ ··· 121 118 /* 122 119 * Error Handling Features 123 120 */ 124 - #define SAL_ERR_FEAT_MCA_SLV_TO_OS_INIT_SLV 0x1 125 - #define SAL_ERR_FEAT_LOG_SBES 0x2 121 + #define SAL_ERR_FEAT_MCA_SLV_TO_OS_INIT_SLV 0x1 // obsolete 122 + #define SAL_ERR_FEAT_LOG_SBES 0x2 // obsolete 126 123 #define SAL_ERR_FEAT_MFR_OVERRIDE 0x4 127 124 #define SAL_ERR_FEAT_SBE_THRESHOLD 0xffff0000 128 125 ··· 153 150 154 151 return (u32)(systab->sal_b_rev_major << 8 | systab->sal_b_rev_minor); 155 152 } 156 - 157 - /* 158 - * Specify the minimum PROM revsion required for this kernel. 159 - * Note that they're stored in hex format... 160 - */ 161 - #define SN_SAL_MIN_VERSION 0x0404 162 153 163 154 /* 164 155 * Returns the master console nasid, if the call fails, return an illegal ··· 333 336 } 334 337 335 338 /* 336 - * Set Error Handling Features 339 + * Set Error Handling Features (Obsolete) 337 340 */ 338 341 static inline u64 339 342 ia64_sn_plat_set_error_handling_features(void) ··· 1095 1098 struct ia64_sal_retval rv; 1096 1099 SAL_CALL_NOLOCK(rv, SN_SAL_FAKE_PROM, 0, 0, 0, 0, 0, 0, 0); 1097 1100 return (rv.status == 0); 1101 + } 1102 + 1103 + static inline int 1104 + ia64_sn_get_prom_feature_set(int set, unsigned long *feature_set) 1105 + { 1106 + struct ia64_sal_retval rv; 1107 + 1108 + SAL_CALL_NOLOCK(rv, SN_SAL_GET_PROM_FEATURE_SET, set, 0, 0, 0, 0, 0, 0); 1109 + if (rv.status != 0) 1110 + return rv.status; 1111 + *feature_set = rv.v0; 1112 + return 0; 1113 + } 1114 + 1115 + static inline int 1116 + ia64_sn_set_os_feature(int feature) 1117 + { 1118 + struct ia64_sal_retval rv; 1119 + 1120 + SAL_CALL_NOLOCK(rv, SN_SAL_SET_OS_FEATURE_SET, feature, 0, 0, 0, 0, 0, 0); 1121 + return rv.status; 1098 1122 } 1099 1123 1100 1124 #endif /* _ASM_IA64_SN_SN_SAL_H */