sn_sal.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:4k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. #ifndef _ASM_IA64_SN_SN_SAL_H
  2. #define _ASM_IA64_SN_SN_SAL_H
  3. /*
  4.  * System Abstraction Layer definitions for IA64
  5.  *
  6.  * This file is subject to the terms and conditions of the GNU General Public
  7.  * License.  See the file "COPYING" in the main directory of this archive
  8.  * for more details.
  9.  *
  10.  * Copyright (c) 2000-2002 Silicon Graphics, Inc.  All rights reserved.
  11.  */
  12. #include <asm/sal.h>
  13. #include <asm/sn/sn_cpuid.h>
  14. // SGI Specific Calls
  15. #define  SN_SAL_POD_MODE                           0x02000001
  16. #define  SN_SAL_SYSTEM_RESET                       0x02000002
  17. #define  SN_SAL_PROBE                              0x02000003
  18. #define  SN_SAL_GET_CONSOLE_NASID                  0x02000004
  19. #define  SN_SAL_GET_KLCONFIG_ADDR    0x02000005
  20. #define  SN_SAL_LOG_CE    0x02000006
  21. #define  SN_SAL_REGISTER_CE    0x02000007
  22. #define  SN_SAL_CONSOLE_PUTC                       0x02000021
  23. #define  SN_SAL_CONSOLE_GETC                       0x02000022
  24. #define  SN_SAL_CONSOLE_PUTS                       0x02000023
  25. #define  SN_SAL_CONSOLE_GETS                       0x02000024
  26. #define  SN_SAL_CONSOLE_GETS_TIMEOUT               0x02000025
  27. #define  SN_SAL_CONSOLE_POLL                       0x02000026
  28. #define  SN_SAL_CONSOLE_INTR                       0x02000027
  29. /*
  30.  * Service-specific constants
  31.  */
  32. #define SAL_CONSOLE_INTR_IN     0       /* manipulate input interrupts */
  33. #define SAL_CONSOLE_INTR_OUT    1       /* manipulate output low-water
  34.                                          * interrupts
  35.                                          */
  36. #define SAL_CONSOLE_INTR_OFF    0       /* turn the interrupt off */
  37. #define SAL_CONSOLE_INTR_ON     1       /* turn the interrupt on */
  38. u64 ia64_sn_probe_io_slot(long paddr, long size, void *data_ptr);
  39. /*
  40.  * Returns the master console nasid, if the call fails, return an illegal
  41.  * value.
  42.  */
  43. static inline u64
  44. ia64_sn_get_console_nasid(void)
  45. {
  46. struct ia64_sal_retval ret_stuff;
  47. ret_stuff.status = (uint64_t)0;
  48. ret_stuff.v0 = (uint64_t)0;
  49. ret_stuff.v1 = (uint64_t)0;
  50. ret_stuff.v2 = (uint64_t)0;
  51. SAL_CALL(ret_stuff, SN_SAL_GET_CONSOLE_NASID, 0, 0, 0, 0, 0, 0, 0);
  52. if (ret_stuff.status < 0)
  53. return ret_stuff.status;
  54. /* Master console nasid is in 'v0' */
  55. return ret_stuff.v0;
  56. }
  57. static inline u64
  58. ia64_sn_get_klconfig_addr(nasid_t nasid)
  59. {
  60. struct ia64_sal_retval ret_stuff;
  61. extern u64 klgraph_addr[];
  62. int cnodeid;
  63. cnodeid = nasid_to_cnodeid(nasid);
  64. if (klgraph_addr[cnodeid] == 0) {
  65. ret_stuff.status = (uint64_t)0;
  66. ret_stuff.v0 = (uint64_t)0;
  67. ret_stuff.v1 = (uint64_t)0;
  68. ret_stuff.v2 = (uint64_t)0;
  69. SAL_CALL(ret_stuff, SN_SAL_GET_KLCONFIG_ADDR, (u64)nasid, 0, 0, 0, 0, 0, 0);
  70. /*
  71.   * We should panic if a valid cnode nasid does not produce
  72.   * a klconfig address.
  73.   */
  74. if (ret_stuff.status != 0) {
  75. panic("ia64_sn_get_klconfig_addr: Returned error %lxn", ret_stuff.status);
  76. }
  77. klgraph_addr[cnodeid] = ret_stuff.v0;
  78. }
  79. return(klgraph_addr[cnodeid]);
  80. }
  81. /*
  82.  * Returns the next console character.
  83.  */
  84. static inline u64
  85. ia64_sn_console_getc(int *ch)
  86. {
  87. struct ia64_sal_retval ret_stuff;
  88. ret_stuff.status = (uint64_t)0;
  89. ret_stuff.v0 = (uint64_t)0;
  90. ret_stuff.v1 = (uint64_t)0;
  91. ret_stuff.v2 = (uint64_t)0;
  92. SAL_CALL(ret_stuff, SN_SAL_CONSOLE_GETC, 0, 0, 0, 0, 0, 0, 0);
  93. /* character is in 'v0' */
  94. *ch = (int)ret_stuff.v0;
  95. return ret_stuff.status;
  96. }
  97. /*
  98.  * Sends the given character to the console.
  99.  */
  100. static inline u64
  101. ia64_sn_console_putc(char ch)
  102. {
  103. struct ia64_sal_retval ret_stuff;
  104. ret_stuff.status = (uint64_t)0;
  105. ret_stuff.v0 = (uint64_t)0;
  106. ret_stuff.v1 = (uint64_t)0;
  107. ret_stuff.v2 = (uint64_t)0;
  108. SAL_CALL(ret_stuff, SN_SAL_CONSOLE_PUTC, (uint64_t)ch, 0, 0, 0, 0, 0, 0);
  109. return ret_stuff.status;
  110. }
  111. /*
  112.  * Checks for console input.
  113.  */
  114. static inline u64
  115. ia64_sn_console_check(int *result)
  116. {
  117. struct ia64_sal_retval ret_stuff;
  118. ret_stuff.status = (uint64_t)0;
  119. ret_stuff.v0 = (uint64_t)0;
  120. ret_stuff.v1 = (uint64_t)0;
  121. ret_stuff.v2 = (uint64_t)0;
  122. SAL_CALL(ret_stuff, SN_SAL_CONSOLE_POLL, 0, 0, 0, 0, 0, 0, 0);
  123. /* result is in 'v0' */
  124. *result = (int)ret_stuff.v0;
  125. return ret_stuff.status;
  126. }
  127. #endif /* _ASM_IA64_SN_SN_SAL_H */