1 #ifndef _ASM_IA64_SN_SN_SAL_H 2 #define _ASM_IA64_SN_SN_SAL_H 3 4 /* 5 * System Abstraction Layer definitions for IA64 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) 2000-2006 Silicon Graphics, Inc. All rights reserved. 12 */ 13 14 #include <linux/types.h> 15 #include <asm/sal.h> 16 17 // SGI Specific Calls 18 #define SN_SAL_GET_PARTITION_ADDR 0x02000009 19 #define SN_SAL_MEMPROTECT 0x0200003e 20 21 #define SN_SAL_WATCHLIST_ALLOC 0x02000070 22 #define SN_SAL_WATCHLIST_FREE 0x02000071 23 24 /* 25 * SAL Error Codes 26 */ 27 #define SALRET_MORE_PASSES 1 28 #define SALRET_OK 0 29 #define SALRET_NOT_IMPLEMENTED (-1) 30 #define SALRET_INVALID_ARG (-2) 31 #define SALRET_ERROR (-3) 32 33 #define SN_SAL_FAKE_PROM 0x02009999 34 35 /* 36 * Returns the physical address of the partition's reserved page through 37 * an iterative number of calls. 38 * 39 * On first call, 'cookie' and 'len' should be set to 0, and 'addr' 40 * set to the nasid of the partition whose reserved page's address is 41 * being sought. 42 * On subsequent calls, pass the values, that were passed back on the 43 * previous call. 44 * 45 * While the return status equals SALRET_MORE_PASSES, keep calling 46 * this function after first copying 'len' bytes starting at 'addr' 47 * into 'buf'. Once the return status equals SALRET_OK, 'addr' will 48 * be the physical address of the partition's reserved page. If the 49 * return status equals neither of these, an error as occurred. 50 */ 51 static inline s64 52 sn_partition_reserved_page_pa(u64 buf, u64 *cookie, u64 *addr, u64 *len) 53 { 54 struct ia64_sal_retval rv; 55 ia64_sal_oemcall_reentrant(&rv, SN_SAL_GET_PARTITION_ADDR, *cookie, 56 *addr, buf, *len, 0, 0, 0); 57 *cookie = rv.v0; 58 *addr = rv.v1; 59 *len = rv.v2; 60 return rv.status; 61 } 62 63 /* 64 * Change memory access protections for a physical address range. 65 * nasid_array is not used on Altix, but may be in future architectures. 66 * Available memory protection access classes are defined after the function. 67 */ 68 static inline int 69 sn_change_memprotect(u64 paddr, u64 len, u64 perms, u64 *nasid_array) 70 { 71 struct ia64_sal_retval ret_stuff; 72 73 ia64_sal_oemcall_nolock(&ret_stuff, SN_SAL_MEMPROTECT, paddr, len, 74 (u64)nasid_array, perms, 0, 0, 0); 75 return ret_stuff.status; 76 } 77 #define SN_MEMPROT_ACCESS_CLASS_0 0x14a080 78 #define SN_MEMPROT_ACCESS_CLASS_1 0x2520c2 79 #define SN_MEMPROT_ACCESS_CLASS_2 0x14a1ca 80 #define SN_MEMPROT_ACCESS_CLASS_3 0x14a290 81 #define SN_MEMPROT_ACCESS_CLASS_6 0x084080 82 #define SN_MEMPROT_ACCESS_CLASS_7 0x021080 83 84 static inline int 85 ia64_sn_is_fake_prom(void) 86 { 87 struct ia64_sal_retval rv; 88 SAL_CALL_NOLOCK(rv, SN_SAL_FAKE_PROM, 0, 0, 0, 0, 0, 0, 0); 89 return (rv.status == 0); 90 } 91 92 union sn_watchlist_u { 93 u64 val; 94 struct { 95 u64 blade : 16, 96 size : 32, 97 filler : 16; 98 }; 99 }; 100 101 static inline int 102 sn_mq_watchlist_alloc(int blade, void *mq, unsigned int mq_size, 103 unsigned long *intr_mmr_offset) 104 { 105 struct ia64_sal_retval rv; 106 unsigned long addr; 107 union sn_watchlist_u size_blade; 108 int watchlist; 109 110 addr = (unsigned long)mq; 111 size_blade.size = mq_size; 112 size_blade.blade = blade; 113 114 /* 115 * bios returns watchlist number or negative error number. 116 */ 117 ia64_sal_oemcall_nolock(&rv, SN_SAL_WATCHLIST_ALLOC, addr, 118 size_blade.val, (u64)intr_mmr_offset, 119 (u64)&watchlist, 0, 0, 0); 120 if (rv.status < 0) 121 return rv.status; 122 123 return watchlist; 124 } 125 126 static inline int 127 sn_mq_watchlist_free(int blade, int watchlist_num) 128 { 129 struct ia64_sal_retval rv; 130 ia64_sal_oemcall_nolock(&rv, SN_SAL_WATCHLIST_FREE, blade, 131 watchlist_num, 0, 0, 0, 0, 0); 132 return rv.status; 133 } 134 #endif /* _ASM_IA64_SN_SN_SAL_H */ 135