18c2ecf20Sopenharmony_ci#ifndef _ASM_IA64_SN_SN_SAL_H 28c2ecf20Sopenharmony_ci#define _ASM_IA64_SN_SN_SAL_H 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ci/* 58c2ecf20Sopenharmony_ci * System Abstraction Layer definitions for IA64 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public 88c2ecf20Sopenharmony_ci * License. See the file "COPYING" in the main directory of this archive 98c2ecf20Sopenharmony_ci * for more details. 108c2ecf20Sopenharmony_ci * 118c2ecf20Sopenharmony_ci * Copyright (c) 2000-2006 Silicon Graphics, Inc. All rights reserved. 128c2ecf20Sopenharmony_ci */ 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci#include <linux/types.h> 158c2ecf20Sopenharmony_ci#include <asm/sal.h> 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci// SGI Specific Calls 188c2ecf20Sopenharmony_ci#define SN_SAL_GET_PARTITION_ADDR 0x02000009 198c2ecf20Sopenharmony_ci#define SN_SAL_MEMPROTECT 0x0200003e 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci#define SN_SAL_WATCHLIST_ALLOC 0x02000070 228c2ecf20Sopenharmony_ci#define SN_SAL_WATCHLIST_FREE 0x02000071 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci/* 258c2ecf20Sopenharmony_ci * SAL Error Codes 268c2ecf20Sopenharmony_ci */ 278c2ecf20Sopenharmony_ci#define SALRET_MORE_PASSES 1 288c2ecf20Sopenharmony_ci#define SALRET_OK 0 298c2ecf20Sopenharmony_ci#define SALRET_NOT_IMPLEMENTED (-1) 308c2ecf20Sopenharmony_ci#define SALRET_INVALID_ARG (-2) 318c2ecf20Sopenharmony_ci#define SALRET_ERROR (-3) 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci/* 348c2ecf20Sopenharmony_ci * Returns the physical address of the partition's reserved page through 358c2ecf20Sopenharmony_ci * an iterative number of calls. 368c2ecf20Sopenharmony_ci * 378c2ecf20Sopenharmony_ci * On first call, 'cookie' and 'len' should be set to 0, and 'addr' 388c2ecf20Sopenharmony_ci * set to the nasid of the partition whose reserved page's address is 398c2ecf20Sopenharmony_ci * being sought. 408c2ecf20Sopenharmony_ci * On subsequent calls, pass the values, that were passed back on the 418c2ecf20Sopenharmony_ci * previous call. 428c2ecf20Sopenharmony_ci * 438c2ecf20Sopenharmony_ci * While the return status equals SALRET_MORE_PASSES, keep calling 448c2ecf20Sopenharmony_ci * this function after first copying 'len' bytes starting at 'addr' 458c2ecf20Sopenharmony_ci * into 'buf'. Once the return status equals SALRET_OK, 'addr' will 468c2ecf20Sopenharmony_ci * be the physical address of the partition's reserved page. If the 478c2ecf20Sopenharmony_ci * return status equals neither of these, an error as occurred. 488c2ecf20Sopenharmony_ci */ 498c2ecf20Sopenharmony_cistatic inline s64 508c2ecf20Sopenharmony_cisn_partition_reserved_page_pa(u64 buf, u64 *cookie, u64 *addr, u64 *len) 518c2ecf20Sopenharmony_ci{ 528c2ecf20Sopenharmony_ci struct ia64_sal_retval rv; 538c2ecf20Sopenharmony_ci ia64_sal_oemcall_reentrant(&rv, SN_SAL_GET_PARTITION_ADDR, *cookie, 548c2ecf20Sopenharmony_ci *addr, buf, *len, 0, 0, 0); 558c2ecf20Sopenharmony_ci *cookie = rv.v0; 568c2ecf20Sopenharmony_ci *addr = rv.v1; 578c2ecf20Sopenharmony_ci *len = rv.v2; 588c2ecf20Sopenharmony_ci return rv.status; 598c2ecf20Sopenharmony_ci} 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_ci/* 628c2ecf20Sopenharmony_ci * Change memory access protections for a physical address range. 638c2ecf20Sopenharmony_ci * nasid_array is not used on Altix, but may be in future architectures. 648c2ecf20Sopenharmony_ci * Available memory protection access classes are defined after the function. 658c2ecf20Sopenharmony_ci */ 668c2ecf20Sopenharmony_cistatic inline int 678c2ecf20Sopenharmony_cisn_change_memprotect(u64 paddr, u64 len, u64 perms, u64 *nasid_array) 688c2ecf20Sopenharmony_ci{ 698c2ecf20Sopenharmony_ci struct ia64_sal_retval ret_stuff; 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_ci ia64_sal_oemcall_nolock(&ret_stuff, SN_SAL_MEMPROTECT, paddr, len, 728c2ecf20Sopenharmony_ci (u64)nasid_array, perms, 0, 0, 0); 738c2ecf20Sopenharmony_ci return ret_stuff.status; 748c2ecf20Sopenharmony_ci} 758c2ecf20Sopenharmony_ci#define SN_MEMPROT_ACCESS_CLASS_0 0x14a080 768c2ecf20Sopenharmony_ci#define SN_MEMPROT_ACCESS_CLASS_1 0x2520c2 778c2ecf20Sopenharmony_ci#define SN_MEMPROT_ACCESS_CLASS_2 0x14a1ca 788c2ecf20Sopenharmony_ci#define SN_MEMPROT_ACCESS_CLASS_3 0x14a290 798c2ecf20Sopenharmony_ci#define SN_MEMPROT_ACCESS_CLASS_6 0x084080 808c2ecf20Sopenharmony_ci#define SN_MEMPROT_ACCESS_CLASS_7 0x021080 818c2ecf20Sopenharmony_ci 828c2ecf20Sopenharmony_ciunion sn_watchlist_u { 838c2ecf20Sopenharmony_ci u64 val; 848c2ecf20Sopenharmony_ci struct { 858c2ecf20Sopenharmony_ci u64 blade : 16, 868c2ecf20Sopenharmony_ci size : 32, 878c2ecf20Sopenharmony_ci filler : 16; 888c2ecf20Sopenharmony_ci }; 898c2ecf20Sopenharmony_ci}; 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_cistatic inline int 928c2ecf20Sopenharmony_cisn_mq_watchlist_alloc(int blade, void *mq, unsigned int mq_size, 938c2ecf20Sopenharmony_ci unsigned long *intr_mmr_offset) 948c2ecf20Sopenharmony_ci{ 958c2ecf20Sopenharmony_ci struct ia64_sal_retval rv; 968c2ecf20Sopenharmony_ci unsigned long addr; 978c2ecf20Sopenharmony_ci union sn_watchlist_u size_blade; 988c2ecf20Sopenharmony_ci int watchlist; 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_ci addr = (unsigned long)mq; 1018c2ecf20Sopenharmony_ci size_blade.size = mq_size; 1028c2ecf20Sopenharmony_ci size_blade.blade = blade; 1038c2ecf20Sopenharmony_ci 1048c2ecf20Sopenharmony_ci /* 1058c2ecf20Sopenharmony_ci * bios returns watchlist number or negative error number. 1068c2ecf20Sopenharmony_ci */ 1078c2ecf20Sopenharmony_ci ia64_sal_oemcall_nolock(&rv, SN_SAL_WATCHLIST_ALLOC, addr, 1088c2ecf20Sopenharmony_ci size_blade.val, (u64)intr_mmr_offset, 1098c2ecf20Sopenharmony_ci (u64)&watchlist, 0, 0, 0); 1108c2ecf20Sopenharmony_ci if (rv.status < 0) 1118c2ecf20Sopenharmony_ci return rv.status; 1128c2ecf20Sopenharmony_ci 1138c2ecf20Sopenharmony_ci return watchlist; 1148c2ecf20Sopenharmony_ci} 1158c2ecf20Sopenharmony_ci 1168c2ecf20Sopenharmony_cistatic inline int 1178c2ecf20Sopenharmony_cisn_mq_watchlist_free(int blade, int watchlist_num) 1188c2ecf20Sopenharmony_ci{ 1198c2ecf20Sopenharmony_ci struct ia64_sal_retval rv; 1208c2ecf20Sopenharmony_ci ia64_sal_oemcall_nolock(&rv, SN_SAL_WATCHLIST_FREE, blade, 1218c2ecf20Sopenharmony_ci watchlist_num, 0, 0, 0, 0, 0); 1228c2ecf20Sopenharmony_ci return rv.status; 1238c2ecf20Sopenharmony_ci} 1248c2ecf20Sopenharmony_ci#endif /* _ASM_IA64_SN_SN_SAL_H */ 125