ia64/xen-unstable

changeset 13096:ad886b6bdfd6

[IA64] Update sn_sal.h to 2.6.19

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
author awilliam@xenbuild2.aw
date Wed Dec 13 12:23:53 2006 -0700 (2006-12-13)
parents 7fe141be5e14
children e71fd4513352
files xen/include/asm-ia64/linux-xen/asm/sn/README.origin xen/include/asm-ia64/linux-xen/asm/sn/sn_sal.h
line diff
     1.1 --- a/xen/include/asm-ia64/linux-xen/asm/sn/README.origin	Wed Dec 13 11:18:16 2006 -0700
     1.2 +++ b/xen/include/asm-ia64/linux-xen/asm/sn/README.origin	Wed Dec 13 12:23:53 2006 -0700
     1.3 @@ -13,4 +13,5 @@ io.h			-> linux/include/asm-ia64/sn/io.h
     1.4  nodepda.h		-> linux/include/asm-ia64/sn/nodepda.h
     1.5  pcibr_provider.h	-> linux/include/asm-ia64/sn/pcibr_provider.h
     1.6  rw_mmr.h		-> linux/include/asm-ia64/sn/rw_mmr.h
     1.7 +sn_sal.h		-> linux/include/asm-ia64/sn/sn_sal.h
     1.8  types.h			-> linux/include/asm-ia64/sn/types.h
     2.1 --- a/xen/include/asm-ia64/linux-xen/asm/sn/sn_sal.h	Wed Dec 13 11:18:16 2006 -0700
     2.2 +++ b/xen/include/asm-ia64/linux-xen/asm/sn/sn_sal.h	Wed Dec 13 12:23:53 2006 -0700
     2.3 @@ -8,16 +8,16 @@
     2.4   * License.  See the file "COPYING" in the main directory of this archive
     2.5   * for more details.
     2.6   *
     2.7 - * Copyright (c) 2000-2004 Silicon Graphics, Inc.  All rights reserved.
     2.8 + * Copyright (c) 2000-2006 Silicon Graphics, Inc.  All rights reserved.
     2.9   */
    2.10  
    2.11  
    2.12 -#include <linux/config.h>
    2.13  #include <asm/sal.h>
    2.14  #include <asm/sn/sn_cpuid.h>
    2.15  #include <asm/sn/arch.h>
    2.16  #include <asm/sn/geo.h>
    2.17  #include <asm/sn/nodepda.h>
    2.18 +#include <asm/sn/shub_mmr.h>
    2.19  
    2.20  // SGI Specific Calls
    2.21  #define  SN_SAL_POD_MODE                           0x02000001
    2.22 @@ -34,8 +34,8 @@
    2.23  #define  SN_SAL_PRINT_ERROR			   0x02000012
    2.24  #define  SN_SAL_SET_ERROR_HANDLING_FEATURES	   0x0200001a	// reentrant
    2.25  #define  SN_SAL_GET_FIT_COMPT			   0x0200001b	// reentrant
    2.26 -#define  SN_SAL_GET_HUB_INFO                       0x0200001c
    2.27  #define  SN_SAL_GET_SAPIC_INFO                     0x0200001d
    2.28 +#define  SN_SAL_GET_SN_INFO                        0x0200001e
    2.29  #define  SN_SAL_CONSOLE_PUTC                       0x02000021
    2.30  #define  SN_SAL_CONSOLE_GETC                       0x02000022
    2.31  #define  SN_SAL_CONSOLE_PUTS                       0x02000023
    2.32 @@ -46,6 +46,7 @@
    2.33  #define  SN_SAL_CONSOLE_PUTB			   0x02000028
    2.34  #define  SN_SAL_CONSOLE_XMIT_CHARS		   0x0200002a
    2.35  #define  SN_SAL_CONSOLE_READC			   0x0200002b
    2.36 +#define  SN_SAL_SYSCTL_OP			   0x02000030
    2.37  #define  SN_SAL_SYSCTL_MODID_GET	           0x02000031
    2.38  #define  SN_SAL_SYSCTL_GET                         0x02000032
    2.39  #define  SN_SAL_SYSCTL_IOBRICK_MODULE_GET          0x02000033
    2.40 @@ -54,7 +55,7 @@
    2.41  #define  SN_SAL_BUS_CONFIG		   	   0x02000037
    2.42  #define  SN_SAL_SYS_SERIAL_GET			   0x02000038
    2.43  #define  SN_SAL_PARTITION_SERIAL_GET		   0x02000039
    2.44 -#define  SN_SAL_SYSCTL_PARTITION_GET		   0x0200003a
    2.45 +#define  SN_SAL_SYSCTL_PARTITION_GET               0x0200003a
    2.46  #define  SN_SAL_SYSTEM_POWER_DOWN		   0x0200003b
    2.47  #define  SN_SAL_GET_MASTER_BASEIO_NASID		   0x0200003c
    2.48  #define  SN_SAL_COHERENCE                          0x0200003d
    2.49 @@ -63,19 +64,28 @@
    2.50  
    2.51  #define  SN_SAL_SYSCTL_IOBRICK_PCI_OP		   0x02000042	// reentrant
    2.52  #define	 SN_SAL_IROUTER_OP			   0x02000043
    2.53 +#define  SN_SAL_SYSCTL_EVENT                       0x02000044
    2.54  #define  SN_SAL_IOIF_INTERRUPT			   0x0200004a
    2.55  #define  SN_SAL_HWPERF_OP			   0x02000050   // lock
    2.56  #define  SN_SAL_IOIF_ERROR_INTERRUPT		   0x02000051
    2.57 -
    2.58 +#define  SN_SAL_IOIF_PCI_SAFE			   0x02000052
    2.59  #define  SN_SAL_IOIF_SLOT_ENABLE		   0x02000053
    2.60  #define  SN_SAL_IOIF_SLOT_DISABLE		   0x02000054
    2.61  #define  SN_SAL_IOIF_GET_HUBDEV_INFO		   0x02000055
    2.62  #define  SN_SAL_IOIF_GET_PCIBUS_INFO		   0x02000056
    2.63  #define  SN_SAL_IOIF_GET_PCIDEV_INFO		   0x02000057
    2.64 -#define  SN_SAL_IOIF_GET_WIDGET_DMAFLUSH_LIST	   0x02000058
    2.65 +#define  SN_SAL_IOIF_GET_WIDGET_DMAFLUSH_LIST	   0x02000058	// deprecated
    2.66 +#define  SN_SAL_IOIF_GET_DEVICE_DMAFLUSH_LIST	   0x0200005a
    2.67  
    2.68  #define SN_SAL_HUB_ERROR_INTERRUPT		   0x02000060
    2.69 +#define SN_SAL_BTE_RECOVER			   0x02000061
    2.70 +#define SN_SAL_RESERVED_DO_NOT_USE		   0x02000062
    2.71 +#define SN_SAL_IOIF_GET_PCI_TOPOLOGY		   0x02000064
    2.72  
    2.73 +#define  SN_SAL_GET_PROM_FEATURE_SET		   0x02000065
    2.74 +#define  SN_SAL_SET_OS_FEATURE_SET		   0x02000066
    2.75 +#define  SN_SAL_INJECT_ERROR			   0x02000067
    2.76 +#define  SN_SAL_SET_CPU_NUMBER			   0x02000068
    2.77  
    2.78  /*
    2.79   * Service-specific constants
    2.80 @@ -95,6 +105,13 @@
    2.81  #define SAL_INTR_FREE		2
    2.82  
    2.83  /*
    2.84 + * operations available on the generic SN_SAL_SYSCTL_OP
    2.85 + * runtime service
    2.86 + */
    2.87 +#define SAL_SYSCTL_OP_IOBOARD		0x0001  /*  retrieve board type */
    2.88 +#define SAL_SYSCTL_OP_TIO_JLCK_RST      0x0002  /* issue TIO clock reset */
    2.89 +
    2.90 +/*
    2.91   * IRouter (i.e. generalized system controller) operations
    2.92   */
    2.93  #define SAL_IROUTER_OPEN	0	/* open a subchannel */
    2.94 @@ -112,6 +129,13 @@
    2.95  #define SAL_IROUTER_INTR_XMIT	SAL_CONSOLE_INTR_XMIT
    2.96  #define SAL_IROUTER_INTR_RECV	SAL_CONSOLE_INTR_RECV
    2.97  
    2.98 +/*
    2.99 + * Error Handling Features
   2.100 + */
   2.101 +#define SAL_ERR_FEAT_MCA_SLV_TO_OS_INIT_SLV	0x1	// obsolete
   2.102 +#define SAL_ERR_FEAT_LOG_SBES			0x2	// obsolete
   2.103 +#define SAL_ERR_FEAT_MFR_OVERRIDE		0x4
   2.104 +#define SAL_ERR_FEAT_SBE_THRESHOLD		0xffff0000
   2.105  
   2.106  /*
   2.107   * SAL Error Codes
   2.108 @@ -122,46 +146,27 @@
   2.109  #define SALRET_INVALID_ARG	(-2)
   2.110  #define SALRET_ERROR		(-3)
   2.111  
   2.112 +#define SN_SAL_FAKE_PROM			   0x02009999
   2.113  
   2.114  #ifndef XEN
   2.115  /**
   2.116 - * sn_sal_rev_major - get the major SGI SAL revision number
   2.117 - *
   2.118 - * The SGI PROM stores its version in sal_[ab]_rev_(major|minor).
   2.119 - * This routine simply extracts the major value from the
   2.120 - * @ia64_sal_systab structure constructed by ia64_sal_init().
   2.121 - */
   2.122 -static inline int
   2.123 -sn_sal_rev_major(void)
   2.124 +  * sn_sal_revision - get the SGI SAL revision number
   2.125 +  *
   2.126 +  * The SGI PROM stores its version in the sal_[ab]_rev_(major|minor).
   2.127 +  * This routine simply extracts the major and minor values and
   2.128 +  * presents them in a u32 format.
   2.129 +  *
   2.130 +  * For example, version 4.05 would be represented at 0x0405.
   2.131 +  */
   2.132 +static inline u32
   2.133 +sn_sal_rev(void)
   2.134  {
   2.135 -	struct ia64_sal_systab *systab = efi.sal_systab;
   2.136 -
   2.137 -	return (int)systab->sal_b_rev_major;
   2.138 -}
   2.139 +	struct ia64_sal_systab *systab = __va(efi.sal_systab);
   2.140  
   2.141 -/**
   2.142 - * sn_sal_rev_minor - get the minor SGI SAL revision number
   2.143 - *
   2.144 - * The SGI PROM stores its version in sal_[ab]_rev_(major|minor).
   2.145 - * This routine simply extracts the minor value from the
   2.146 - * @ia64_sal_systab structure constructed by ia64_sal_init().
   2.147 - */
   2.148 -static inline int
   2.149 -sn_sal_rev_minor(void)
   2.150 -{
   2.151 -	struct ia64_sal_systab *systab = efi.sal_systab;
   2.152 -	
   2.153 -	return (int)systab->sal_b_rev_minor;
   2.154 +	return (u32)(systab->sal_b_rev_major << 8 | systab->sal_b_rev_minor);
   2.155  }
   2.156  
   2.157  /*
   2.158 - * Specify the minimum PROM revsion required for this kernel.
   2.159 - * Note that they're stored in hex format...
   2.160 - */
   2.161 -#define SN_SAL_MIN_MAJOR	0x4  /* SN2 kernels need at least PROM 4.0 */
   2.162 -#define SN_SAL_MIN_MINOR	0x0
   2.163 -
   2.164 -/*
   2.165   * Returns the master console nasid, if the call fails, return an illegal
   2.166   * value.
   2.167   */
   2.168 @@ -205,26 +210,16 @@ ia64_sn_get_master_baseio_nasid(void)
   2.169  	return ret_stuff.v0;
   2.170  }
   2.171  
   2.172 -static inline char *
   2.173 +static inline void *
   2.174  ia64_sn_get_klconfig_addr(nasid_t nasid)
   2.175  {
   2.176  	struct ia64_sal_retval ret_stuff;
   2.177 -	int cnodeid;
   2.178  
   2.179 -	cnodeid = nasid_to_cnodeid(nasid);
   2.180  	ret_stuff.status = 0;
   2.181  	ret_stuff.v0 = 0;
   2.182  	ret_stuff.v1 = 0;
   2.183  	ret_stuff.v2 = 0;
   2.184  	SAL_CALL(ret_stuff, SN_SAL_GET_KLCONFIG_ADDR, (u64)nasid, 0, 0, 0, 0, 0, 0);
   2.185 -
   2.186 -	/*
   2.187 -	 * We should panic if a valid cnode nasid does not produce
   2.188 -	 * a klconfig address.
   2.189 -	 */
   2.190 -	if (ret_stuff.status != 0) {
   2.191 -		panic("ia64_sn_get_klconfig_addr: Returned error %lx\n", ret_stuff.status);
   2.192 -	}
   2.193  	return ret_stuff.v0 ? __va(ret_stuff.v0) : NULL;
   2.194  }
   2.195  #endif /* !XEN */
   2.196 @@ -281,7 +276,7 @@ ia64_sn_console_putc(char ch)
   2.197  	ret_stuff.v0 = 0;
   2.198  	ret_stuff.v1 = 0;
   2.199  	ret_stuff.v2 = 0;
   2.200 -	SAL_CALL_NOLOCK(ret_stuff, SN_SAL_CONSOLE_PUTC, (uint64_t)ch, 0, 0, 0, 0, 0, 0);
   2.201 +	SAL_CALL_NOLOCK(ret_stuff, SN_SAL_CONSOLE_PUTC, (u64)ch, 0, 0, 0, 0, 0, 0);
   2.202  
   2.203  	return ret_stuff.status;
   2.204  }
   2.205 @@ -298,7 +293,7 @@ ia64_sn_console_putb(const char *buf, in
   2.206  	ret_stuff.v0 = 0; 
   2.207  	ret_stuff.v1 = 0;
   2.208  	ret_stuff.v2 = 0;
   2.209 -	SAL_CALL_NOLOCK(ret_stuff, SN_SAL_CONSOLE_PUTB, (uint64_t)buf, (uint64_t)len, 0, 0, 0, 0, 0);
   2.210 +	SAL_CALL_NOLOCK(ret_stuff, SN_SAL_CONSOLE_PUTB, (u64)buf, (u64)len, 0, 0, 0, 0, 0);
   2.211  
   2.212  	if ( ret_stuff.status == 0 ) {
   2.213  		return ret_stuff.v0;
   2.214 @@ -319,7 +314,7 @@ ia64_sn_plat_specific_err_print(int (*ho
   2.215  	ret_stuff.v0 = 0;
   2.216  	ret_stuff.v1 = 0;
   2.217  	ret_stuff.v2 = 0;
   2.218 -	SAL_CALL_REENTRANT(ret_stuff, SN_SAL_PRINT_ERROR, (uint64_t)hook, (uint64_t)rec, 0, 0, 0, 0, 0);
   2.219 +	SAL_CALL_REENTRANT(ret_stuff, SN_SAL_PRINT_ERROR, (u64)hook, (u64)rec, 0, 0, 0, 0, 0);
   2.220  
   2.221  	return ret_stuff.status;
   2.222  }
   2.223 @@ -342,6 +337,25 @@ ia64_sn_plat_cpei_handler(void)
   2.224  }
   2.225  
   2.226  /*
   2.227 + * Set Error Handling Features	(Obsolete)
   2.228 + */
   2.229 +static inline u64
   2.230 +ia64_sn_plat_set_error_handling_features(void)
   2.231 +{
   2.232 +	struct ia64_sal_retval ret_stuff;
   2.233 +
   2.234 +	ret_stuff.status = 0;
   2.235 +	ret_stuff.v0 = 0;
   2.236 +	ret_stuff.v1 = 0;
   2.237 +	ret_stuff.v2 = 0;
   2.238 +	SAL_CALL_REENTRANT(ret_stuff, SN_SAL_SET_ERROR_HANDLING_FEATURES,
   2.239 +		SAL_ERR_FEAT_LOG_SBES,
   2.240 +		0, 0, 0, 0, 0, 0);
   2.241 +
   2.242 +	return ret_stuff.status;
   2.243 +}
   2.244 +
   2.245 +/*
   2.246   * Checks for console input.
   2.247   */
   2.248  static inline u64
   2.249 @@ -388,7 +402,7 @@ ia64_sn_console_intr_status(void)
   2.250   * Enable an interrupt on the SAL console device.
   2.251   */
   2.252  static inline void
   2.253 -ia64_sn_console_intr_enable(uint64_t intr)
   2.254 +ia64_sn_console_intr_enable(u64 intr)
   2.255  {
   2.256  	struct ia64_sal_retval ret_stuff;
   2.257  
   2.258 @@ -405,7 +419,7 @@ ia64_sn_console_intr_enable(uint64_t int
   2.259   * Disable an interrupt on the SAL console device.
   2.260   */
   2.261  static inline void
   2.262 -ia64_sn_console_intr_disable(uint64_t intr)
   2.263 +ia64_sn_console_intr_disable(u64 intr)
   2.264  {
   2.265  	struct ia64_sal_retval ret_stuff;
   2.266  
   2.267 @@ -431,7 +445,7 @@ ia64_sn_console_xmit_chars(char *buf, in
   2.268  	ret_stuff.v1 = 0;
   2.269  	ret_stuff.v2 = 0;
   2.270  	SAL_CALL_NOLOCK(ret_stuff, SN_SAL_CONSOLE_XMIT_CHARS,
   2.271 -		 (uint64_t)buf, (uint64_t)len,
   2.272 +		 (u64)buf, (u64)len,
   2.273  		 0, 0, 0, 0, 0);
   2.274  
   2.275  	if (ret_stuff.status == 0) {
   2.276 @@ -472,7 +486,7 @@ static inline u64
   2.277  ia64_sn_pod_mode(void)
   2.278  {
   2.279  	struct ia64_sal_retval isrv;
   2.280 -	SAL_CALL(isrv, SN_SAL_POD_MODE, 0, 0, 0, 0, 0, 0, 0);
   2.281 +	SAL_CALL_REENTRANT(isrv, SN_SAL_POD_MODE, 0, 0, 0, 0, 0, 0, 0);
   2.282  	if (isrv.status)
   2.283  		return 0;
   2.284  	return isrv.v0;
   2.285 @@ -557,7 +571,8 @@ static inline u64
   2.286  ia64_sn_partition_serial_get(void)
   2.287  {
   2.288  	struct ia64_sal_retval ret_stuff;
   2.289 -	SAL_CALL(ret_stuff, SN_SAL_PARTITION_SERIAL_GET, 0, 0, 0, 0, 0, 0, 0);
   2.290 +	ia64_sal_oemcall_reentrant(&ret_stuff, SN_SAL_PARTITION_SERIAL_GET, 0,
   2.291 +				   0, 0, 0, 0, 0, 0);
   2.292  	if (ret_stuff.status != 0)
   2.293  	    return 0;
   2.294  	return ret_stuff.v0;
   2.295 @@ -565,11 +580,10 @@ ia64_sn_partition_serial_get(void)
   2.296  
   2.297  static inline u64
   2.298  sn_partition_serial_number_val(void) {
   2.299 -	if (sn_partition_serial_number) {
   2.300 -		return(sn_partition_serial_number);
   2.301 -	} else {
   2.302 -		return(sn_partition_serial_number = ia64_sn_partition_serial_get());
   2.303 +	if (unlikely(sn_partition_serial_number == 0)) {
   2.304 +		sn_partition_serial_number = ia64_sn_partition_serial_get();
   2.305  	}
   2.306 +	return sn_partition_serial_number;
   2.307  }
   2.308  
   2.309  /*
   2.310 @@ -581,25 +595,38 @@ ia64_sn_sysctl_partition_get(nasid_t nas
   2.311  {
   2.312  	struct ia64_sal_retval ret_stuff;
   2.313  	SAL_CALL(ret_stuff, SN_SAL_SYSCTL_PARTITION_GET, nasid,
   2.314 -		 0, 0, 0, 0, 0, 0);
   2.315 +		0, 0, 0, 0, 0, 0);
   2.316  	if (ret_stuff.status != 0)
   2.317 -	    return INVALID_PARTID;
   2.318 +	    return -1;
   2.319  	return ((partid_t)ret_stuff.v0);
   2.320  }
   2.321  
   2.322  /*
   2.323 - * Returns the partition id of the current processor.
   2.324 + * Returns the physical address of the partition's reserved page through
   2.325 + * an iterative number of calls.
   2.326 + *
   2.327 + * On first call, 'cookie' and 'len' should be set to 0, and 'addr'
   2.328 + * set to the nasid of the partition whose reserved page's address is
   2.329 + * being sought.
   2.330 + * On subsequent calls, pass the values, that were passed back on the
   2.331 + * previous call.
   2.332 + *
   2.333 + * While the return status equals SALRET_MORE_PASSES, keep calling
   2.334 + * this function after first copying 'len' bytes starting at 'addr'
   2.335 + * into 'buf'. Once the return status equals SALRET_OK, 'addr' will
   2.336 + * be the physical address of the partition's reserved page. If the
   2.337 + * return status equals neither of these, an error as occurred.
   2.338   */
   2.339 -
   2.340 -extern partid_t sn_partid;
   2.341 -
   2.342 -static inline partid_t
   2.343 -sn_local_partid(void) {
   2.344 -	if (sn_partid < 0) {
   2.345 -		return (sn_partid = ia64_sn_sysctl_partition_get(cpuid_to_nasid(smp_processor_id())));
   2.346 -	} else {
   2.347 -		return sn_partid;
   2.348 -	}
   2.349 +static inline s64
   2.350 +sn_partition_reserved_page_pa(u64 buf, u64 *cookie, u64 *addr, u64 *len)
   2.351 +{
   2.352 +	struct ia64_sal_retval rv;
   2.353 +	ia64_sal_oemcall_reentrant(&rv, SN_SAL_GET_PARTITION_ADDR, *cookie,
   2.354 +				   *addr, buf, *len, 0, 0, 0);
   2.355 +	*cookie = rv.v0;
   2.356 +	*addr = rv.v1;
   2.357 +	*len = rv.v2;
   2.358 +	return rv.status;
   2.359  }
   2.360  
   2.361  /*
   2.362 @@ -621,8 +648,8 @@ static inline int
   2.363  sn_register_xp_addr_region(u64 paddr, u64 len, int operation)
   2.364  {
   2.365  	struct ia64_sal_retval ret_stuff;
   2.366 -	SAL_CALL(ret_stuff, SN_SAL_XP_ADDR_REGION, paddr, len, (u64)operation,
   2.367 -		 0, 0, 0, 0);
   2.368 +	ia64_sal_oemcall(&ret_stuff, SN_SAL_XP_ADDR_REGION, paddr, len,
   2.369 +			 (u64)operation, 0, 0, 0, 0);
   2.370  	return ret_stuff.status;
   2.371  }
   2.372  
   2.373 @@ -646,8 +673,8 @@ sn_register_nofault_code(u64 start_addr,
   2.374  	} else {
   2.375  		call = SN_SAL_NO_FAULT_ZONE_PHYSICAL;
   2.376  	}
   2.377 -	SAL_CALL(ret_stuff, call, start_addr, end_addr, return_addr, (u64)1,
   2.378 -		 0, 0, 0);
   2.379 +	ia64_sal_oemcall(&ret_stuff, call, start_addr, end_addr, return_addr,
   2.380 +			 (u64)1, 0, 0, 0);
   2.381  	return ret_stuff.status;
   2.382  }
   2.383  
   2.384 @@ -668,8 +695,8 @@ static inline int
   2.385  sn_change_coherence(u64 *new_domain, u64 *old_domain)
   2.386  {
   2.387  	struct ia64_sal_retval ret_stuff;
   2.388 -	SAL_CALL(ret_stuff, SN_SAL_COHERENCE, new_domain, old_domain, 0, 0,
   2.389 -		 0, 0, 0);
   2.390 +	ia64_sal_oemcall(&ret_stuff, SN_SAL_COHERENCE, (u64)new_domain,
   2.391 +			 (u64)old_domain, 0, 0, 0, 0, 0);
   2.392  	return ret_stuff.status;
   2.393  }
   2.394  
   2.395 @@ -682,16 +709,9 @@ static inline int
   2.396  sn_change_memprotect(u64 paddr, u64 len, u64 perms, u64 *nasid_array)
   2.397  {
   2.398  	struct ia64_sal_retval ret_stuff;
   2.399 -	int cnodeid;
   2.400 -	unsigned long irq_flags;
   2.401  
   2.402 -	cnodeid = nasid_to_cnodeid(get_node_number(paddr));
   2.403 -	// spin_lock(&NODEPDA(cnodeid)->bist_lock);
   2.404 -	local_irq_save(irq_flags);
   2.405 -	SAL_CALL_NOLOCK(ret_stuff, SN_SAL_MEMPROTECT, paddr, len, nasid_array,
   2.406 -		 perms, 0, 0, 0);
   2.407 -	local_irq_restore(irq_flags);
   2.408 -	// spin_unlock(&NODEPDA(cnodeid)->bist_lock);
   2.409 +	ia64_sal_oemcall_nolock(&ret_stuff, SN_SAL_MEMPROTECT, paddr, len,
   2.410 +				(u64)nasid_array, perms, 0, 0, 0);
   2.411  	return ret_stuff.status;
   2.412  }
   2.413  #define SN_MEMPROT_ACCESS_CLASS_0		0x14a080
   2.414 @@ -709,7 +729,8 @@ ia64_sn_power_down(void)
   2.415  {
   2.416  	struct ia64_sal_retval ret_stuff;
   2.417  	SAL_CALL(ret_stuff, SN_SAL_SYSTEM_POWER_DOWN, 0, 0, 0, 0, 0, 0, 0);
   2.418 -	while(1);
   2.419 +	while(1)
   2.420 +		cpu_relax();
   2.421  	/* never returns */
   2.422  }
   2.423  
   2.424 @@ -851,6 +872,58 @@ ia64_sn_irtr_intr_disable(nasid_t nasid,
   2.425  	return (int) rv.v0;
   2.426  }
   2.427  
   2.428 +/*
   2.429 + * Set up a node as the point of contact for system controller
   2.430 + * environmental event delivery.
   2.431 + */
   2.432 +static inline int
   2.433 +ia64_sn_sysctl_event_init(nasid_t nasid)
   2.434 +{
   2.435 +        struct ia64_sal_retval rv;
   2.436 +        SAL_CALL_REENTRANT(rv, SN_SAL_SYSCTL_EVENT, (u64) nasid,
   2.437 +			   0, 0, 0, 0, 0, 0);
   2.438 +        return (int) rv.v0;
   2.439 +}
   2.440 +
   2.441 +/*
   2.442 + * Ask the system controller on the specified nasid to reset
   2.443 + * the CX corelet clock.  Only valid on TIO nodes.
   2.444 + */
   2.445 +static inline int
   2.446 +ia64_sn_sysctl_tio_clock_reset(nasid_t nasid)
   2.447 +{
   2.448 +	struct ia64_sal_retval rv;
   2.449 +	SAL_CALL_REENTRANT(rv, SN_SAL_SYSCTL_OP, SAL_SYSCTL_OP_TIO_JLCK_RST,
   2.450 +			nasid, 0, 0, 0, 0, 0);
   2.451 +	if (rv.status != 0)
   2.452 +		return (int)rv.status;
   2.453 +	if (rv.v0 != 0)
   2.454 +		return (int)rv.v0;
   2.455 +
   2.456 +	return 0;
   2.457 +}
   2.458 +
   2.459 +/*
   2.460 + * Get the associated ioboard type for a given nasid.
   2.461 + */
   2.462 +static inline s64
   2.463 +ia64_sn_sysctl_ioboard_get(nasid_t nasid, u16 *ioboard)
   2.464 +{
   2.465 +	struct ia64_sal_retval isrv;
   2.466 +	SAL_CALL_REENTRANT(isrv, SN_SAL_SYSCTL_OP, SAL_SYSCTL_OP_IOBOARD,
   2.467 +			   nasid, 0, 0, 0, 0, 0);
   2.468 +	if (isrv.v0 != 0) {
   2.469 +		*ioboard = isrv.v0;
   2.470 +		return isrv.status;
   2.471 +	}
   2.472 +	if (isrv.v1 != 0) {
   2.473 +		*ioboard = isrv.v1;
   2.474 +		return isrv.status;
   2.475 +	}
   2.476 +
   2.477 +	return isrv.status;
   2.478 +}
   2.479 +
   2.480  /**
   2.481   * ia64_sn_get_fit_compt - read a FIT entry from the PROM header
   2.482   * @nasid: NASID of node to read
   2.483 @@ -938,15 +1011,24 @@ ia64_sn_get_sapic_info(int sapicid, int 
   2.484  /*
   2.485   * Returns information about the HUB/SHUB.
   2.486   *  In:
   2.487 - *	arg0 - SN_SAL_GET_HUB_INFO
   2.488 + *	arg0 - SN_SAL_GET_SN_INFO
   2.489   * 	arg1 - 0 (other values reserved for future use)
   2.490   *  Out:
   2.491 - *	v0 - shub type (0=shub1, 1=shub2)
   2.492 - *	v1 - masid mask (ex., 0x7ff for 11 bit nasid)
   2.493 - *	v2 - bit position of low nasid bit
   2.494 + *	v0 
   2.495 + *		[7:0]   - shub type (0=shub1, 1=shub2)
   2.496 + *		[15:8]  - Log2 max number of nodes in entire system (includes
   2.497 + *			  C-bricks, I-bricks, etc)
   2.498 + *		[23:16] - Log2 of nodes per sharing domain			 
   2.499 + * 		[31:24] - partition ID
   2.500 + * 		[39:32] - coherency_id
   2.501 + * 		[47:40] - regionsize
   2.502 + *	v1 
   2.503 + *		[15:0]  - nasid mask (ex., 0x7ff for 11 bit nasid)
   2.504 + *	 	[23:15] - bit position of low nasid bit
   2.505   */
   2.506  static inline u64
   2.507 -ia64_sn_get_hub_info(int fc, u64 *arg1, u64 *arg2, u64 *arg3)
   2.508 +ia64_sn_get_sn_info(int fc, u8 *shubtype, u16 *nasid_bitmask, u8 *nasid_shift, 
   2.509 +		u8 *systemsize, u8 *sharing_domain_size, u8 *partid, u8 *coher, u8 *reg)
   2.510  {
   2.511  	struct ia64_sal_retval ret_stuff;
   2.512  
   2.513 @@ -954,13 +1036,22 @@ ia64_sn_get_hub_info(int fc, u64 *arg1, 
   2.514  	ret_stuff.v0 = 0;
   2.515  	ret_stuff.v1 = 0;
   2.516  	ret_stuff.v2 = 0;
   2.517 -	SAL_CALL_NOLOCK(ret_stuff, SN_SAL_GET_HUB_INFO, fc, 0, 0, 0, 0, 0, 0);
   2.518 +	SAL_CALL_NOLOCK(ret_stuff, SN_SAL_GET_SN_INFO, fc, 0, 0, 0, 0, 0, 0);
   2.519  
   2.520  /***** BEGIN HACK - temp til old proms no longer supported ********/
   2.521  	if (ret_stuff.status == SALRET_NOT_IMPLEMENTED) {
   2.522 -		if (arg1) *arg1 = 0;
   2.523 -		if (arg2) *arg2 = 0x7ff;
   2.524 -		if (arg3) *arg3 = 38;
   2.525 +		int nasid = get_sapicid() & 0xfff;
   2.526 +#define SH_SHUB_ID_NODES_PER_BIT_MASK 0x001f000000000000UL
   2.527 +#define SH_SHUB_ID_NODES_PER_BIT_SHFT 48
   2.528 +		if (shubtype) *shubtype = 0;
   2.529 +		if (nasid_bitmask) *nasid_bitmask = 0x7ff;
   2.530 +		if (nasid_shift) *nasid_shift = 38;
   2.531 +		if (systemsize) *systemsize = 10;
   2.532 +		if (sharing_domain_size) *sharing_domain_size = 8;
   2.533 +		if (partid) *partid = ia64_sn_sysctl_partition_get(nasid);
   2.534 +		if (coher) *coher = nasid >> 9;
   2.535 +		if (reg) *reg = (HUB_L((u64 *) LOCAL_MMR_ADDR(SH1_SHUB_ID)) & SH_SHUB_ID_NODES_PER_BIT_MASK) >>
   2.536 +			SH_SHUB_ID_NODES_PER_BIT_SHFT;
   2.537  		return 0;
   2.538  	}
   2.539  /***** END HACK *******/
   2.540 @@ -968,9 +1059,14 @@ ia64_sn_get_hub_info(int fc, u64 *arg1, 
   2.541  	if (ret_stuff.status < 0)
   2.542  		return ret_stuff.status;
   2.543  
   2.544 -	if (arg1) *arg1 = ret_stuff.v0;
   2.545 -	if (arg2) *arg2 = ret_stuff.v1;
   2.546 -	if (arg3) *arg3 = ret_stuff.v2;
   2.547 +	if (shubtype) *shubtype = ret_stuff.v0 & 0xff;
   2.548 +	if (systemsize) *systemsize = (ret_stuff.v0 >> 8) & 0xff;
   2.549 +	if (sharing_domain_size) *sharing_domain_size = (ret_stuff.v0 >> 16) & 0xff;
   2.550 +	if (partid) *partid = (ret_stuff.v0 >> 24) & 0xff;
   2.551 +	if (coher) *coher = (ret_stuff.v0 >> 32) & 0xff;
   2.552 +	if (reg) *reg = (ret_stuff.v0 >> 40) & 0xff;
   2.553 +	if (nasid_bitmask) *nasid_bitmask = (ret_stuff.v1 & 0xffff);
   2.554 +	if (nasid_shift) *nasid_shift = (ret_stuff.v1 >> 16) & 0xff;
   2.555  	return 0;
   2.556  }
   2.557   
   2.558 @@ -991,4 +1087,75 @@ ia64_sn_hwperf_op(nasid_t nasid, u64 opc
   2.559  	return (int) rv.status;
   2.560  }
   2.561  #endif /* !XEN */
   2.562 +
   2.563 +static inline int
   2.564 +ia64_sn_ioif_get_pci_topology(u64 buf, u64 len)
   2.565 +{
   2.566 +	struct ia64_sal_retval rv;
   2.567 +	SAL_CALL_NOLOCK(rv, SN_SAL_IOIF_GET_PCI_TOPOLOGY, buf, len, 0, 0, 0, 0, 0);
   2.568 +	return (int) rv.status;
   2.569 +}
   2.570 +
   2.571 +/*
   2.572 + * BTE error recovery is implemented in SAL
   2.573 + */
   2.574 +static inline int
   2.575 +ia64_sn_bte_recovery(nasid_t nasid)
   2.576 +{
   2.577 +	struct ia64_sal_retval rv;
   2.578 +
   2.579 +	rv.status = 0;
   2.580 +	SAL_CALL_NOLOCK(rv, SN_SAL_BTE_RECOVER, (u64)nasid, 0, 0, 0, 0, 0, 0);
   2.581 +	if (rv.status == SALRET_NOT_IMPLEMENTED)
   2.582 +		return 0;
   2.583 +	return (int) rv.status;
   2.584 +}
   2.585 +
   2.586 +static inline int
   2.587 +ia64_sn_is_fake_prom(void)
   2.588 +{
   2.589 +	struct ia64_sal_retval rv;
   2.590 +	SAL_CALL_NOLOCK(rv, SN_SAL_FAKE_PROM, 0, 0, 0, 0, 0, 0, 0);
   2.591 +	return (rv.status == 0);
   2.592 +}
   2.593 +
   2.594 +static inline int
   2.595 +ia64_sn_get_prom_feature_set(int set, unsigned long *feature_set)
   2.596 +{
   2.597 +	struct ia64_sal_retval rv;
   2.598 +
   2.599 +	SAL_CALL_NOLOCK(rv, SN_SAL_GET_PROM_FEATURE_SET, set, 0, 0, 0, 0, 0, 0);
   2.600 +	if (rv.status != 0)
   2.601 +		return rv.status;
   2.602 +	*feature_set = rv.v0;
   2.603 +	return 0;
   2.604 +}
   2.605 +
   2.606 +static inline int
   2.607 +ia64_sn_set_os_feature(int feature)
   2.608 +{
   2.609 +	struct ia64_sal_retval rv;
   2.610 +
   2.611 +	SAL_CALL_NOLOCK(rv, SN_SAL_SET_OS_FEATURE_SET, feature, 0, 0, 0, 0, 0, 0);
   2.612 +	return rv.status;
   2.613 +}
   2.614 +
   2.615 +static inline int
   2.616 +sn_inject_error(u64 paddr, u64 *data, u64 *ecc)
   2.617 +{
   2.618 +	struct ia64_sal_retval ret_stuff;
   2.619 +
   2.620 +	ia64_sal_oemcall_nolock(&ret_stuff, SN_SAL_INJECT_ERROR, paddr, (u64)data,
   2.621 +				(u64)ecc, 0, 0, 0, 0);
   2.622 +	return ret_stuff.status;
   2.623 +}
   2.624 +
   2.625 +static inline int
   2.626 +ia64_sn_set_cpu_number(int cpu)
   2.627 +{
   2.628 +	struct ia64_sal_retval rv;
   2.629 +
   2.630 +	SAL_CALL_NOLOCK(rv, SN_SAL_SET_CPU_NUMBER, cpu, 0, 0, 0, 0, 0, 0);
   2.631 +	return rv.status;
   2.632 +}
   2.633  #endif /* _ASM_IA64_SN_SN_SAL_H */