1 #ifndef _ASM_IA64_SN_SN_SAL_H
2 #define _ASM_IA64_SN_SN_SAL_H
5 * System Abstraction Layer definitions for IA64
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
11 * Copyright (c) 2000-2004 Silicon Graphics, Inc. All rights reserved.
15 #include <linux/config.h>
17 #include <asm/sn/sn_cpuid.h>
18 #include <asm/sn/arch.h>
19 #include <asm/sn/geo.h>
20 #include <asm/sn/nodepda.h>
23 #define SN_SAL_POD_MODE 0x02000001
24 #define SN_SAL_SYSTEM_RESET 0x02000002
25 #define SN_SAL_PROBE 0x02000003
26 #define SN_SAL_GET_MASTER_NASID 0x02000004
27 #define SN_SAL_GET_KLCONFIG_ADDR 0x02000005
28 #define SN_SAL_LOG_CE 0x02000006
29 #define SN_SAL_REGISTER_CE 0x02000007
30 #define SN_SAL_GET_PARTITION_ADDR 0x02000009
31 #define SN_SAL_XP_ADDR_REGION 0x0200000f
32 #define SN_SAL_NO_FAULT_ZONE_VIRTUAL 0x02000010
33 #define SN_SAL_NO_FAULT_ZONE_PHYSICAL 0x02000011
34 #define SN_SAL_PRINT_ERROR 0x02000012
35 #define SN_SAL_SET_ERROR_HANDLING_FEATURES 0x0200001a // reentrant
36 #define SN_SAL_GET_FIT_COMPT 0x0200001b // reentrant
37 #define SN_SAL_GET_HUB_INFO 0x0200001c
38 #define SN_SAL_GET_SAPIC_INFO 0x0200001d
39 #define SN_SAL_CONSOLE_PUTC 0x02000021
40 #define SN_SAL_CONSOLE_GETC 0x02000022
41 #define SN_SAL_CONSOLE_PUTS 0x02000023
42 #define SN_SAL_CONSOLE_GETS 0x02000024
43 #define SN_SAL_CONSOLE_GETS_TIMEOUT 0x02000025
44 #define SN_SAL_CONSOLE_POLL 0x02000026
45 #define SN_SAL_CONSOLE_INTR 0x02000027
46 #define SN_SAL_CONSOLE_PUTB 0x02000028
47 #define SN_SAL_CONSOLE_XMIT_CHARS 0x0200002a
48 #define SN_SAL_CONSOLE_READC 0x0200002b
49 #define SN_SAL_SYSCTL_MODID_GET 0x02000031
50 #define SN_SAL_SYSCTL_GET 0x02000032
51 #define SN_SAL_SYSCTL_IOBRICK_MODULE_GET 0x02000033
52 #define SN_SAL_SYSCTL_IO_PORTSPEED_GET 0x02000035
53 #define SN_SAL_SYSCTL_SLAB_GET 0x02000036
54 #define SN_SAL_BUS_CONFIG 0x02000037
55 #define SN_SAL_SYS_SERIAL_GET 0x02000038
56 #define SN_SAL_PARTITION_SERIAL_GET 0x02000039
57 #define SN_SAL_SYSCTL_PARTITION_GET 0x0200003a
58 #define SN_SAL_SYSTEM_POWER_DOWN 0x0200003b
59 #define SN_SAL_GET_MASTER_BASEIO_NASID 0x0200003c
60 #define SN_SAL_COHERENCE 0x0200003d
61 #define SN_SAL_MEMPROTECT 0x0200003e
62 #define SN_SAL_SYSCTL_FRU_CAPTURE 0x0200003f
64 #define SN_SAL_SYSCTL_IOBRICK_PCI_OP 0x02000042 // reentrant
65 #define SN_SAL_IROUTER_OP 0x02000043
66 #define SN_SAL_IOIF_INTERRUPT 0x0200004a
67 #define SN_SAL_HWPERF_OP 0x02000050 // lock
68 #define SN_SAL_IOIF_ERROR_INTERRUPT 0x02000051
70 #define SN_SAL_IOIF_SLOT_ENABLE 0x02000053
71 #define SN_SAL_IOIF_SLOT_DISABLE 0x02000054
72 #define SN_SAL_IOIF_GET_HUBDEV_INFO 0x02000055
73 #define SN_SAL_IOIF_GET_PCIBUS_INFO 0x02000056
74 #define SN_SAL_IOIF_GET_PCIDEV_INFO 0x02000057
75 #define SN_SAL_IOIF_GET_WIDGET_DMAFLUSH_LIST 0x02000058
77 #define SN_SAL_HUB_ERROR_INTERRUPT 0x02000060
81 * Service-specific constants
84 /* Console interrupt manipulation */
86 #define SAL_CONSOLE_INTR_OFF 0 /* turn the interrupt off */
87 #define SAL_CONSOLE_INTR_ON 1 /* turn the interrupt on */
88 #define SAL_CONSOLE_INTR_STATUS 2 /* retrieve the interrupt status */
89 /* interrupt specification & status return codes */
90 #define SAL_CONSOLE_INTR_XMIT 1 /* output interrupt */
91 #define SAL_CONSOLE_INTR_RECV 2 /* input interrupt */
93 /* interrupt handling */
94 #define SAL_INTR_ALLOC 1
95 #define SAL_INTR_FREE 2
98 * IRouter (i.e. generalized system controller) operations
100 #define SAL_IROUTER_OPEN 0 /* open a subchannel */
101 #define SAL_IROUTER_CLOSE 1 /* close a subchannel */
102 #define SAL_IROUTER_SEND 2 /* send part of an IRouter packet */
103 #define SAL_IROUTER_RECV 3 /* receive part of an IRouter packet */
104 #define SAL_IROUTER_INTR_STATUS 4 /* check the interrupt status for
107 #define SAL_IROUTER_INTR_ON 5 /* enable an interrupt */
108 #define SAL_IROUTER_INTR_OFF 6 /* disable an interrupt */
109 #define SAL_IROUTER_INIT 7 /* initialize IRouter driver */
111 /* IRouter interrupt mask bits */
112 #define SAL_IROUTER_INTR_XMIT SAL_CONSOLE_INTR_XMIT
113 #define SAL_IROUTER_INTR_RECV SAL_CONSOLE_INTR_RECV
119 #define SALRET_MORE_PASSES 1
121 #define SALRET_NOT_IMPLEMENTED (-1)
122 #define SALRET_INVALID_ARG (-2)
123 #define SALRET_ERROR (-3)
127 * sn_sal_rev_major - get the major SGI SAL revision number
129 * The SGI PROM stores its version in sal_[ab]_rev_(major|minor).
130 * This routine simply extracts the major value from the
131 * @ia64_sal_systab structure constructed by ia64_sal_init().
134 sn_sal_rev_major(void)
136 struct ia64_sal_systab *systab = efi.sal_systab;
138 return (int)systab->sal_b_rev_major;
142 * sn_sal_rev_minor - get the minor SGI SAL revision number
144 * The SGI PROM stores its version in sal_[ab]_rev_(major|minor).
145 * This routine simply extracts the minor value from the
146 * @ia64_sal_systab structure constructed by ia64_sal_init().
149 sn_sal_rev_minor(void)
151 struct ia64_sal_systab *systab = efi.sal_systab;
153 return (int)systab->sal_b_rev_minor;
157 * Specify the minimum PROM revsion required for this kernel.
158 * Note that they're stored in hex format...
160 #define SN_SAL_MIN_MAJOR 0x4 /* SN2 kernels need at least PROM 4.0 */
161 #define SN_SAL_MIN_MINOR 0x0
164 * Returns the master console nasid, if the call fails, return an illegal
168 ia64_sn_get_console_nasid(void)
170 struct ia64_sal_retval ret_stuff;
172 ret_stuff.status = 0;
176 SAL_CALL(ret_stuff, SN_SAL_GET_MASTER_NASID, 0, 0, 0, 0, 0, 0, 0);
178 if (ret_stuff.status < 0)
179 return ret_stuff.status;
181 /* Master console nasid is in 'v0' */
186 * Returns the master baseio nasid, if the call fails, return an illegal
190 ia64_sn_get_master_baseio_nasid(void)
192 struct ia64_sal_retval ret_stuff;
194 ret_stuff.status = 0;
198 SAL_CALL(ret_stuff, SN_SAL_GET_MASTER_BASEIO_NASID, 0, 0, 0, 0, 0, 0, 0);
200 if (ret_stuff.status < 0)
201 return ret_stuff.status;
203 /* Master baseio nasid is in 'v0' */
208 ia64_sn_get_klconfig_addr(nasid_t nasid)
210 struct ia64_sal_retval ret_stuff;
213 cnodeid = nasid_to_cnodeid(nasid);
214 ret_stuff.status = 0;
218 SAL_CALL(ret_stuff, SN_SAL_GET_KLCONFIG_ADDR, (u64)nasid, 0, 0, 0, 0, 0, 0);
221 * We should panic if a valid cnode nasid does not produce
222 * a klconfig address.
224 if (ret_stuff.status != 0) {
225 panic("ia64_sn_get_klconfig_addr: Returned error %lx\n", ret_stuff.status);
227 return ret_stuff.v0 ? __va(ret_stuff.v0) : NULL;
231 * Returns the next console character.
234 ia64_sn_console_getc(int *ch)
236 struct ia64_sal_retval ret_stuff;
238 ret_stuff.status = 0;
242 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_CONSOLE_GETC, 0, 0, 0, 0, 0, 0, 0);
244 /* character is in 'v0' */
245 *ch = (int)ret_stuff.v0;
247 return ret_stuff.status;
251 * Read a character from the SAL console device, after a previous interrupt
252 * or poll operation has given us to know that a character is available
256 ia64_sn_console_readc(void)
258 struct ia64_sal_retval ret_stuff;
260 ret_stuff.status = 0;
264 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_CONSOLE_READC, 0, 0, 0, 0, 0, 0, 0);
266 /* character is in 'v0' */
271 * Sends the given character to the console.
274 ia64_sn_console_putc(char ch)
276 struct ia64_sal_retval ret_stuff;
278 ret_stuff.status = 0;
282 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_CONSOLE_PUTC, (uint64_t)ch, 0, 0, 0, 0, 0, 0);
284 return ret_stuff.status;
288 * Sends the given buffer to the console.
291 ia64_sn_console_putb(const char *buf, int len)
293 struct ia64_sal_retval ret_stuff;
295 ret_stuff.status = 0;
299 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_CONSOLE_PUTB, (uint64_t)buf, (uint64_t)len, 0, 0, 0, 0, 0);
301 if ( ret_stuff.status == 0 ) {
308 * Print a platform error record
311 ia64_sn_plat_specific_err_print(int (*hook)(const char*, ...), char *rec)
313 struct ia64_sal_retval ret_stuff;
315 ret_stuff.status = 0;
319 SAL_CALL_REENTRANT(ret_stuff, SN_SAL_PRINT_ERROR, (uint64_t)hook, (uint64_t)rec, 0, 0, 0, 0, 0);
321 return ret_stuff.status;
325 * Check for Platform errors
328 ia64_sn_plat_cpei_handler(void)
330 struct ia64_sal_retval ret_stuff;
332 ret_stuff.status = 0;
336 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_LOG_CE, 0, 0, 0, 0, 0, 0, 0);
338 return ret_stuff.status;
342 * Checks for console input.
345 ia64_sn_console_check(int *result)
347 struct ia64_sal_retval ret_stuff;
349 ret_stuff.status = 0;
353 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_CONSOLE_POLL, 0, 0, 0, 0, 0, 0, 0);
355 /* result is in 'v0' */
356 *result = (int)ret_stuff.v0;
358 return ret_stuff.status;
362 * Checks console interrupt status
365 ia64_sn_console_intr_status(void)
367 struct ia64_sal_retval ret_stuff;
369 ret_stuff.status = 0;
373 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_CONSOLE_INTR,
374 0, SAL_CONSOLE_INTR_STATUS,
377 if (ret_stuff.status == 0) {
385 * Enable an interrupt on the SAL console device.
388 ia64_sn_console_intr_enable(uint64_t intr)
390 struct ia64_sal_retval ret_stuff;
392 ret_stuff.status = 0;
396 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_CONSOLE_INTR,
397 intr, SAL_CONSOLE_INTR_ON,
402 * Disable an interrupt on the SAL console device.
405 ia64_sn_console_intr_disable(uint64_t intr)
407 struct ia64_sal_retval ret_stuff;
409 ret_stuff.status = 0;
413 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_CONSOLE_INTR,
414 intr, SAL_CONSOLE_INTR_OFF,
419 * Sends a character buffer to the console asynchronously.
422 ia64_sn_console_xmit_chars(char *buf, int len)
424 struct ia64_sal_retval ret_stuff;
426 ret_stuff.status = 0;
430 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_CONSOLE_XMIT_CHARS,
431 (uint64_t)buf, (uint64_t)len,
434 if (ret_stuff.status == 0) {
442 * Returns the iobrick module Id
445 ia64_sn_sysctl_iobrick_module_get(nasid_t nasid, int *result)
447 struct ia64_sal_retval ret_stuff;
449 ret_stuff.status = 0;
453 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_SYSCTL_IOBRICK_MODULE_GET, nasid, 0, 0, 0, 0, 0, 0);
455 /* result is in 'v0' */
456 *result = (int)ret_stuff.v0;
458 return ret_stuff.status;
462 * ia64_sn_pod_mode - call the SN_SAL_POD_MODE function
464 * SN_SAL_POD_MODE actually takes an argument, but it's always
465 * 0 when we call it from the kernel, so we don't have to expose
469 ia64_sn_pod_mode(void)
471 struct ia64_sal_retval isrv;
472 SAL_CALL(isrv, SN_SAL_POD_MODE, 0, 0, 0, 0, 0, 0, 0);
479 * ia64_sn_probe_mem - read from memory safely
480 * @addr: address to probe
481 * @size: number bytes to read (1,2,4,8)
482 * @data_ptr: address to store value read by probe (-1 returned if probe fails)
484 * Call into the SAL to do a memory read. If the read generates a machine
485 * check, this routine will recover gracefully and return -1 to the caller.
486 * @addr is usually a kernel virtual address in uncached space (i.e. the
487 * address starts with 0xc), but if called in physical mode, @addr should
488 * be a physical address.
491 * 0 - probe successful
492 * 1 - probe failed (generated MCA)
497 ia64_sn_probe_mem(long addr, long size, void *data_ptr)
499 struct ia64_sal_retval isrv;
501 SAL_CALL(isrv, SN_SAL_PROBE, addr, size, 0, 0, 0, 0, 0);
506 *((u8*)data_ptr) = (u8)isrv.v0;
509 *((u16*)data_ptr) = (u16)isrv.v0;
512 *((u32*)data_ptr) = (u32)isrv.v0;
515 *((u64*)data_ptr) = (u64)isrv.v0;
525 * Retrieve the system serial number as an ASCII string.
528 ia64_sn_sys_serial_get(char *buf)
530 struct ia64_sal_retval ret_stuff;
531 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_SYS_SERIAL_GET, buf, 0, 0, 0, 0, 0, 0);
532 return ret_stuff.status;
535 extern char sn_system_serial_number_string[];
536 extern u64 sn_partition_serial_number;
539 sn_system_serial_number(void) {
540 if (sn_system_serial_number_string[0]) {
541 return(sn_system_serial_number_string);
543 ia64_sn_sys_serial_get(sn_system_serial_number_string);
544 return(sn_system_serial_number_string);
550 * Returns a unique id number for this system and partition (suitable for
551 * use with license managers), based in part on the system serial number.
554 ia64_sn_partition_serial_get(void)
556 struct ia64_sal_retval ret_stuff;
557 SAL_CALL(ret_stuff, SN_SAL_PARTITION_SERIAL_GET, 0, 0, 0, 0, 0, 0, 0);
558 if (ret_stuff.status != 0)
564 sn_partition_serial_number_val(void) {
565 if (sn_partition_serial_number) {
566 return(sn_partition_serial_number);
568 return(sn_partition_serial_number = ia64_sn_partition_serial_get());
573 * Returns the partition id of the nasid passed in as an argument,
574 * or INVALID_PARTID if the partition id cannot be retrieved.
576 static inline partid_t
577 ia64_sn_sysctl_partition_get(nasid_t nasid)
579 struct ia64_sal_retval ret_stuff;
580 SAL_CALL(ret_stuff, SN_SAL_SYSCTL_PARTITION_GET, nasid,
582 if (ret_stuff.status != 0)
583 return INVALID_PARTID;
584 return ((partid_t)ret_stuff.v0);
588 * Returns the partition id of the current processor.
591 extern partid_t sn_partid;
593 static inline partid_t
594 sn_local_partid(void) {
596 return (sn_partid = ia64_sn_sysctl_partition_get(cpuid_to_nasid(smp_processor_id())));
603 * Register or unregister a physical address range being referenced across
604 * a partition boundary for which certain SAL errors should be scanned for,
605 * cleaned up and ignored. This is of value for kernel partitioning code only.
606 * Values for the operation argument:
607 * 1 = register this address range with SAL
608 * 0 = unregister this address range with SAL
610 * SAL maintains a reference count on an address range in case it is registered
613 * On success, returns the reference count of the address range after the SAL
614 * call has performed the current registration/unregistration. Returns a
615 * negative value if an error occurred.
618 sn_register_xp_addr_region(u64 paddr, u64 len, int operation)
620 struct ia64_sal_retval ret_stuff;
621 SAL_CALL(ret_stuff, SN_SAL_XP_ADDR_REGION, paddr, len, (u64)operation,
623 return ret_stuff.status;
627 * Register or unregister an instruction range for which SAL errors should
628 * be ignored. If an error occurs while in the registered range, SAL jumps
629 * to return_addr after ignoring the error. Values for the operation argument:
630 * 1 = register this instruction range with SAL
631 * 0 = unregister this instruction range with SAL
633 * Returns 0 on success, or a negative value if an error occurred.
636 sn_register_nofault_code(u64 start_addr, u64 end_addr, u64 return_addr,
637 int virtual, int operation)
639 struct ia64_sal_retval ret_stuff;
642 call = SN_SAL_NO_FAULT_ZONE_VIRTUAL;
644 call = SN_SAL_NO_FAULT_ZONE_PHYSICAL;
646 SAL_CALL(ret_stuff, call, start_addr, end_addr, return_addr, (u64)1,
648 return ret_stuff.status;
652 * Change or query the coherence domain for this partition. Each cpu-based
653 * nasid is represented by a bit in an array of 64-bit words:
654 * 0 = not in this partition's coherency domain
655 * 1 = in this partition's coherency domain
657 * It is not possible for the local system's nasids to be removed from
658 * the coherency domain. Purpose of the domain arguments:
659 * new_domain = set the coherence domain to the given nasids
660 * old_domain = return the current coherence domain
662 * Returns 0 on success, or a negative value if an error occurred.
665 sn_change_coherence(u64 *new_domain, u64 *old_domain)
667 struct ia64_sal_retval ret_stuff;
668 SAL_CALL(ret_stuff, SN_SAL_COHERENCE, new_domain, old_domain, 0, 0,
670 return ret_stuff.status;
674 * Change memory access protections for a physical address range.
675 * nasid_array is not used on Altix, but may be in future architectures.
676 * Available memory protection access classes are defined after the function.
679 sn_change_memprotect(u64 paddr, u64 len, u64 perms, u64 *nasid_array)
681 struct ia64_sal_retval ret_stuff;
683 unsigned long irq_flags;
685 cnodeid = nasid_to_cnodeid(get_node_number(paddr));
686 // spin_lock(&NODEPDA(cnodeid)->bist_lock);
687 local_irq_save(irq_flags);
688 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_MEMPROTECT, paddr, len, nasid_array,
690 local_irq_restore(irq_flags);
691 // spin_unlock(&NODEPDA(cnodeid)->bist_lock);
692 return ret_stuff.status;
694 #define SN_MEMPROT_ACCESS_CLASS_0 0x14a080
695 #define SN_MEMPROT_ACCESS_CLASS_1 0x2520c2
696 #define SN_MEMPROT_ACCESS_CLASS_2 0x14a1ca
697 #define SN_MEMPROT_ACCESS_CLASS_3 0x14a290
698 #define SN_MEMPROT_ACCESS_CLASS_6 0x084080
699 #define SN_MEMPROT_ACCESS_CLASS_7 0x021080
702 * Turns off system power.
705 ia64_sn_power_down(void)
707 struct ia64_sal_retval ret_stuff;
708 SAL_CALL(ret_stuff, SN_SAL_SYSTEM_POWER_DOWN, 0, 0, 0, 0, 0, 0, 0);
714 * ia64_sn_fru_capture - tell the system controller to capture hw state
716 * This routine will call the SAL which will tell the system controller(s)
717 * to capture hw mmr information from each SHub in the system.
720 ia64_sn_fru_capture(void)
722 struct ia64_sal_retval isrv;
723 SAL_CALL(isrv, SN_SAL_SYSCTL_FRU_CAPTURE, 0, 0, 0, 0, 0, 0, 0);
730 * Performs an operation on a PCI bus or slot -- power up, power down
734 ia64_sn_sysctl_iobrick_pci_op(nasid_t n, u64 connection_type,
738 struct ia64_sal_retval rv = {0, 0, 0, 0};
740 SAL_CALL_NOLOCK(rv, SN_SAL_SYSCTL_IOBRICK_PCI_OP, connection_type, n, action,
741 bus, (u64) slot, 0, 0);
749 * Open a subchannel for sending arbitrary data to the system
750 * controller network via the system controller device associated with
751 * 'nasid'. Return the subchannel number or a negative error code.
754 ia64_sn_irtr_open(nasid_t nasid)
756 struct ia64_sal_retval rv;
757 SAL_CALL_REENTRANT(rv, SN_SAL_IROUTER_OP, SAL_IROUTER_OPEN, nasid,
763 * Close system controller subchannel 'subch' previously opened on 'nasid'.
766 ia64_sn_irtr_close(nasid_t nasid, int subch)
768 struct ia64_sal_retval rv;
769 SAL_CALL_REENTRANT(rv, SN_SAL_IROUTER_OP, SAL_IROUTER_CLOSE,
770 (u64) nasid, (u64) subch, 0, 0, 0, 0);
771 return (int) rv.status;
775 * Read data from system controller associated with 'nasid' on
776 * subchannel 'subch'. The buffer to be filled is pointed to by
777 * 'buf', and its capacity is in the integer pointed to by 'len'. The
778 * referent of 'len' is set to the number of bytes read by the SAL
779 * call. The return value is either SALRET_OK (for bytes read) or
780 * SALRET_ERROR (for error or "no data available").
783 ia64_sn_irtr_recv(nasid_t nasid, int subch, char *buf, int *len)
785 struct ia64_sal_retval rv;
786 SAL_CALL_REENTRANT(rv, SN_SAL_IROUTER_OP, SAL_IROUTER_RECV,
787 (u64) nasid, (u64) subch, (u64) buf, (u64) len,
789 return (int) rv.status;
793 * Write data to the system controller network via the system
794 * controller associated with 'nasid' on suchannel 'subch'. The
795 * buffer to be written out is pointed to by 'buf', and 'len' is the
796 * number of bytes to be written. The return value is either the
797 * number of bytes written (which could be zero) or a negative error
801 ia64_sn_irtr_send(nasid_t nasid, int subch, char *buf, int len)
803 struct ia64_sal_retval rv;
804 SAL_CALL_REENTRANT(rv, SN_SAL_IROUTER_OP, SAL_IROUTER_SEND,
805 (u64) nasid, (u64) subch, (u64) buf, (u64) len,
811 * Check whether any interrupts are pending for the system controller
812 * associated with 'nasid' and its subchannel 'subch'. The return
813 * value is a mask of pending interrupts (SAL_IROUTER_INTR_XMIT and/or
814 * SAL_IROUTER_INTR_RECV).
817 ia64_sn_irtr_intr(nasid_t nasid, int subch)
819 struct ia64_sal_retval rv;
820 SAL_CALL_REENTRANT(rv, SN_SAL_IROUTER_OP, SAL_IROUTER_INTR_STATUS,
821 (u64) nasid, (u64) subch, 0, 0, 0, 0);
826 * Enable the interrupt indicated by the intr parameter (either
827 * SAL_IROUTER_INTR_XMIT or SAL_IROUTER_INTR_RECV).
830 ia64_sn_irtr_intr_enable(nasid_t nasid, int subch, u64 intr)
832 struct ia64_sal_retval rv;
833 SAL_CALL_REENTRANT(rv, SN_SAL_IROUTER_OP, SAL_IROUTER_INTR_ON,
834 (u64) nasid, (u64) subch, intr, 0, 0, 0);
839 * Disable the interrupt indicated by the intr parameter (either
840 * SAL_IROUTER_INTR_XMIT or SAL_IROUTER_INTR_RECV).
843 ia64_sn_irtr_intr_disable(nasid_t nasid, int subch, u64 intr)
845 struct ia64_sal_retval rv;
846 SAL_CALL_REENTRANT(rv, SN_SAL_IROUTER_OP, SAL_IROUTER_INTR_OFF,
847 (u64) nasid, (u64) subch, intr, 0, 0, 0);
852 * ia64_sn_get_fit_compt - read a FIT entry from the PROM header
853 * @nasid: NASID of node to read
854 * @index: FIT entry index to be retrieved (0..n)
855 * @fitentry: 16 byte buffer where FIT entry will be stored.
856 * @banbuf: optional buffer for retrieving banner
857 * @banlen: length of banner buffer
859 * Access to the physical PROM chips needs to be serialized since reads and
860 * writes can't occur at the same time, so we need to call into the SAL when
861 * we want to look at the FIT entries on the chips.
865 * %SALRET_INVALID_ARG if index too big
866 * %SALRET_NOT_IMPLEMENTED if running on older PROM
867 * ??? if nasid invalid OR banner buffer not large enough
870 ia64_sn_get_fit_compt(u64 nasid, u64 index, void *fitentry, void *banbuf,
873 struct ia64_sal_retval rv;
874 SAL_CALL_NOLOCK(rv, SN_SAL_GET_FIT_COMPT, nasid, index, fitentry,
875 banbuf, banlen, 0, 0);
876 return (int) rv.status;
880 * Initialize the SAL components of the system controller
881 * communication driver; specifically pass in a sizable buffer that
882 * can be used for allocation of subchannel queues as new subchannels
883 * are opened. "buf" points to the buffer, and "len" specifies its
887 ia64_sn_irtr_init(nasid_t nasid, void *buf, int len)
889 struct ia64_sal_retval rv;
890 SAL_CALL_REENTRANT(rv, SN_SAL_IROUTER_OP, SAL_IROUTER_INIT,
891 (u64) nasid, (u64) buf, (u64) len, 0, 0, 0);
892 return (int) rv.status;
896 * Returns the nasid, subnode & slice corresponding to a SAPIC ID
899 * arg0 - SN_SAL_GET_SAPIC_INFO
900 * arg1 - sapicid (lid >> 16)
907 ia64_sn_get_sapic_info(int sapicid, int *nasid, int *subnode, int *slice)
909 struct ia64_sal_retval ret_stuff;
911 ret_stuff.status = 0;
915 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_GET_SAPIC_INFO, sapicid, 0, 0, 0, 0, 0, 0);
917 /***** BEGIN HACK - temp til old proms no longer supported ********/
918 if (ret_stuff.status == SALRET_NOT_IMPLEMENTED) {
919 if (nasid) *nasid = sapicid & 0xfff;
920 if (subnode) *subnode = (sapicid >> 13) & 1;
921 if (slice) *slice = (sapicid >> 12) & 3;
924 /***** END HACK *******/
926 if (ret_stuff.status < 0)
927 return ret_stuff.status;
929 if (nasid) *nasid = (int) ret_stuff.v0;
930 if (subnode) *subnode = (int) ret_stuff.v1;
931 if (slice) *slice = (int) ret_stuff.v2;
936 * Returns information about the HUB/SHUB.
938 * arg0 - SN_SAL_GET_HUB_INFO
939 * arg1 - 0 (other values reserved for future use)
941 * v0 - shub type (0=shub1, 1=shub2)
942 * v1 - masid mask (ex., 0x7ff for 11 bit nasid)
943 * v2 - bit position of low nasid bit
946 ia64_sn_get_hub_info(int fc, u64 *arg1, u64 *arg2, u64 *arg3)
948 struct ia64_sal_retval ret_stuff;
950 ret_stuff.status = 0;
954 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_GET_HUB_INFO, fc, 0, 0, 0, 0, 0, 0);
956 /***** BEGIN HACK - temp til old proms no longer supported ********/
957 if (ret_stuff.status == SALRET_NOT_IMPLEMENTED) {
959 if (arg2) *arg2 = 0x7ff;
960 if (arg3) *arg3 = 38;
963 /***** END HACK *******/
965 if (ret_stuff.status < 0)
966 return ret_stuff.status;
968 if (arg1) *arg1 = ret_stuff.v0;
969 if (arg2) *arg2 = ret_stuff.v1;
970 if (arg3) *arg3 = ret_stuff.v2;
975 * This is the access point to the Altix PROM hardware performance
976 * and status monitoring interface. For info on using this, see
977 * include/asm-ia64/sn/sn2/sn_hwperf.h
980 ia64_sn_hwperf_op(nasid_t nasid, u64 opcode, u64 a0, u64 a1, u64 a2,
981 u64 a3, u64 a4, int *v0)
983 struct ia64_sal_retval rv;
984 SAL_CALL_NOLOCK(rv, SN_SAL_HWPERF_OP, (u64)nasid,
985 opcode, a0, a1, a2, a3, a4);
988 return (int) rv.status;
991 #endif /* _ASM_IA64_SN_SN_SAL_H */