X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=include%2Fasm-ia64%2Fsn%2Fsn_sal.h;h=4ecc05e8ad5772a16016d6fe6c927492a19846c1;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=3d3d324a229a9affb5d03d99dec5634c788c1470;hpb=87fc8d1bb10cd459024a742c6a10961fefcef18f;p=linux-2.6.git diff --git a/include/asm-ia64/sn/sn_sal.h b/include/asm-ia64/sn/sn_sal.h index 3d3d324a2..4ecc05e8a 100644 --- a/include/asm-ia64/sn/sn_sal.h +++ b/include/asm-ia64/sn/sn_sal.h @@ -16,9 +16,8 @@ #include #include #include +#include #include -#include - // SGI Specific Calls #define SN_SAL_POD_MODE 0x02000001 @@ -35,6 +34,8 @@ #define SN_SAL_PRINT_ERROR 0x02000012 #define SN_SAL_SET_ERROR_HANDLING_FEATURES 0x0200001a // reentrant #define SN_SAL_GET_FIT_COMPT 0x0200001b // reentrant +#define SN_SAL_GET_HUB_INFO 0x0200001c +#define SN_SAL_GET_SAPIC_INFO 0x0200001d #define SN_SAL_CONSOLE_PUTC 0x02000021 #define SN_SAL_CONSOLE_GETC 0x02000022 #define SN_SAL_CONSOLE_PUTS 0x02000023 @@ -62,7 +63,19 @@ #define SN_SAL_SYSCTL_IOBRICK_PCI_OP 0x02000042 // reentrant #define SN_SAL_IROUTER_OP 0x02000043 +#define SN_SAL_IOIF_INTERRUPT 0x0200004a #define SN_SAL_HWPERF_OP 0x02000050 // lock +#define SN_SAL_IOIF_ERROR_INTERRUPT 0x02000051 + +#define SN_SAL_IOIF_SLOT_ENABLE 0x02000053 +#define SN_SAL_IOIF_SLOT_DISABLE 0x02000054 +#define SN_SAL_IOIF_GET_HUBDEV_INFO 0x02000055 +#define SN_SAL_IOIF_GET_PCIBUS_INFO 0x02000056 +#define SN_SAL_IOIF_GET_PCIDEV_INFO 0x02000057 +#define SN_SAL_IOIF_GET_WIDGET_DMAFLUSH_LIST 0x02000058 + +#define SN_SAL_HUB_ERROR_INTERRUPT 0x02000060 + /* * Service-specific constants @@ -77,16 +90,9 @@ #define SAL_CONSOLE_INTR_XMIT 1 /* output interrupt */ #define SAL_CONSOLE_INTR_RECV 2 /* input interrupt */ -#ifdef CONFIG_HOTPLUG_PCI_SGI -/* power up / power down / reset a PCI slot or bus */ -#define SAL_SYSCTL_PCI_POWER_UP 0 -#define SAL_SYSCTL_PCI_POWER_DOWN 1 -#define SAL_SYSCTL_PCI_RESET 2 - -/* what type of I/O brick? */ -#define SAL_SYSCTL_IO_XTALK 0 /* connected via a compute node */ - -#endif /* CONFIG_HOTPLUG_PCI_SGI */ +/* interrupt handling */ +#define SAL_INTR_ALLOC 1 +#define SAL_INTR_FREE 2 /* * IRouter (i.e. generalized system controller) operations @@ -116,19 +122,6 @@ #define SALRET_INVALID_ARG (-2) #define SALRET_ERROR (-3) -/* - * SN_SAL_SET_ERROR_HANDLING_FEATURES bit settings - */ -enum -{ - /* if "rz always" is set, have the mca slaves call os_init_slave */ - SN_SAL_EHF_MCA_SLV_TO_OS_INIT_SLV=0, - /* do not rz on tlb checks, even if "rz always" is set */ - SN_SAL_EHF_NO_RZ_TLBC, - /* do not rz on PIO reads to I/O space, even if "rz always" is set */ - SN_SAL_EHF_NO_RZ_IO_READ, -}; - /** * sn_sal_rev_major - get the major SGI SAL revision number @@ -164,10 +157,8 @@ sn_sal_rev_minor(void) * Specify the minimum PROM revsion required for this kernel. * Note that they're stored in hex format... */ -#define SN_SAL_MIN_MAJOR 0x3 /* SN2 kernels need at least PROM 3.40 */ -#define SN_SAL_MIN_MINOR 0x40 - -u64 ia64_sn_probe_io_slot(long paddr, long size, void *data_ptr); +#define SN_SAL_MIN_MAJOR 0x4 /* SN2 kernels need at least PROM 4.0 */ +#define SN_SAL_MIN_MINOR 0x0 /* * Returns the master console nasid, if the call fails, return an illegal @@ -213,7 +204,7 @@ ia64_sn_get_master_baseio_nasid(void) return ret_stuff.v0; } -static inline u64 +static inline char * ia64_sn_get_klconfig_addr(nasid_t nasid) { struct ia64_sal_retval ret_stuff; @@ -233,7 +224,7 @@ ia64_sn_get_klconfig_addr(nasid_t nasid) if (ret_stuff.status != 0) { panic("ia64_sn_get_klconfig_addr: Returned error %lx\n", ret_stuff.status); } - return(ret_stuff.v0); + return ret_stuff.v0 ? __va(ret_stuff.v0) : NULL; } /* @@ -484,6 +475,52 @@ ia64_sn_pod_mode(void) return isrv.v0; } +/** + * ia64_sn_probe_mem - read from memory safely + * @addr: address to probe + * @size: number bytes to read (1,2,4,8) + * @data_ptr: address to store value read by probe (-1 returned if probe fails) + * + * Call into the SAL to do a memory read. If the read generates a machine + * check, this routine will recover gracefully and return -1 to the caller. + * @addr is usually a kernel virtual address in uncached space (i.e. the + * address starts with 0xc), but if called in physical mode, @addr should + * be a physical address. + * + * Return values: + * 0 - probe successful + * 1 - probe failed (generated MCA) + * 2 - Bad arg + * <0 - PAL error + */ +static inline u64 +ia64_sn_probe_mem(long addr, long size, void *data_ptr) +{ + struct ia64_sal_retval isrv; + + SAL_CALL(isrv, SN_SAL_PROBE, addr, size, 0, 0, 0, 0, 0); + + if (data_ptr) { + switch (size) { + case 1: + *((u8*)data_ptr) = (u8)isrv.v0; + break; + case 2: + *((u16*)data_ptr) = (u16)isrv.v0; + break; + case 4: + *((u32*)data_ptr) = (u32)isrv.v0; + break; + case 8: + *((u64*)data_ptr) = (u64)isrv.v0; + break; + default: + isrv.status = 2; + } + } + return isrv.status; +} + /* * Retrieve the system serial number as an ASCII string. */ @@ -646,12 +683,12 @@ sn_change_memprotect(u64 paddr, u64 len, u64 perms, u64 *nasid_array) unsigned long irq_flags; cnodeid = nasid_to_cnodeid(get_node_number(paddr)); - spin_lock(&NODEPDA(cnodeid)->bist_lock); + // spin_lock(&NODEPDA(cnodeid)->bist_lock); local_irq_save(irq_flags); SAL_CALL_NOLOCK(ret_stuff, SN_SAL_MEMPROTECT, paddr, len, nasid_array, perms, 0, 0, 0); local_irq_restore(irq_flags); - spin_unlock(&NODEPDA(cnodeid)->bist_lock); + // spin_unlock(&NODEPDA(cnodeid)->bist_lock); return ret_stuff.status; } #define SN_MEMPROT_ACCESS_CLASS_0 0x14a080 @@ -695,7 +732,7 @@ ia64_sn_fru_capture(void) */ static inline u64 ia64_sn_sysctl_iobrick_pci_op(nasid_t n, u64 connection_type, - u64 bus, slotid_t slot, + u64 bus, char slot, u64 action) { struct ia64_sal_retval rv = {0, 0, 0, 0}; @@ -707,26 +744,6 @@ ia64_sn_sysctl_iobrick_pci_op(nasid_t n, u64 connection_type, return 0; } -/* - * Tell the prom how the OS wants to handle specific error features. - * It takes an array of 7 u64. - */ -static inline u64 -ia64_sn_set_error_handling_features(const u64 *feature_bits) -{ - struct ia64_sal_retval rv = {0, 0, 0, 0}; - - SAL_CALL_REENTRANT(rv, SN_SAL_SET_ERROR_HANDLING_FEATURES, - feature_bits[0], - feature_bits[1], - feature_bits[2], - feature_bits[3], - feature_bits[4], - feature_bits[5], - feature_bits[6]); - return rv.status; -} - /* * Open a subchannel for sending arbitrary data to the system @@ -875,6 +892,85 @@ ia64_sn_irtr_init(nasid_t nasid, void *buf, int len) return (int) rv.status; } +/* + * Returns the nasid, subnode & slice corresponding to a SAPIC ID + * + * In: + * arg0 - SN_SAL_GET_SAPIC_INFO + * arg1 - sapicid (lid >> 16) + * Out: + * v0 - nasid + * v1 - subnode + * v2 - slice + */ +static inline u64 +ia64_sn_get_sapic_info(int sapicid, int *nasid, int *subnode, int *slice) +{ + struct ia64_sal_retval ret_stuff; + + ret_stuff.status = 0; + ret_stuff.v0 = 0; + ret_stuff.v1 = 0; + ret_stuff.v2 = 0; + SAL_CALL_NOLOCK(ret_stuff, SN_SAL_GET_SAPIC_INFO, sapicid, 0, 0, 0, 0, 0, 0); + +/***** BEGIN HACK - temp til old proms no longer supported ********/ + if (ret_stuff.status == SALRET_NOT_IMPLEMENTED) { + if (nasid) *nasid = sapicid & 0xfff; + if (subnode) *subnode = (sapicid >> 13) & 1; + if (slice) *slice = (sapicid >> 12) & 3; + return 0; + } +/***** END HACK *******/ + + if (ret_stuff.status < 0) + return ret_stuff.status; + + if (nasid) *nasid = (int) ret_stuff.v0; + if (subnode) *subnode = (int) ret_stuff.v1; + if (slice) *slice = (int) ret_stuff.v2; + return 0; +} + +/* + * Returns information about the HUB/SHUB. + * In: + * arg0 - SN_SAL_GET_HUB_INFO + * arg1 - 0 (other values reserved for future use) + * Out: + * v0 - shub type (0=shub1, 1=shub2) + * v1 - masid mask (ex., 0x7ff for 11 bit nasid) + * v2 - bit position of low nasid bit + */ +static inline u64 +ia64_sn_get_hub_info(int fc, u64 *arg1, u64 *arg2, u64 *arg3) +{ + struct ia64_sal_retval ret_stuff; + + ret_stuff.status = 0; + ret_stuff.v0 = 0; + ret_stuff.v1 = 0; + ret_stuff.v2 = 0; + SAL_CALL_NOLOCK(ret_stuff, SN_SAL_GET_HUB_INFO, fc, 0, 0, 0, 0, 0, 0); + +/***** BEGIN HACK - temp til old proms no longer supported ********/ + if (ret_stuff.status == SALRET_NOT_IMPLEMENTED) { + if (arg1) *arg1 = 0; + if (arg2) *arg2 = 0x7ff; + if (arg3) *arg3 = 38; + return 0; + } +/***** END HACK *******/ + + if (ret_stuff.status < 0) + return ret_stuff.status; + + if (arg1) *arg1 = ret_stuff.v0; + if (arg2) *arg2 = ret_stuff.v1; + if (arg3) *arg3 = ret_stuff.v2; + return 0; +} + /* * This is the access point to the Altix PROM hardware performance * and status monitoring interface. For info on using this, see