aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2007-05-15 20:03:54 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-05-15 23:23:02 -0400
commitc7754d465b1feade85b5f1c4492781a30f6652a2 (patch)
tree9a3b6ccb18983c1ea389377028ca51c8170730ef /include
parent7b104bcb8e460e45a1aebe3da9b86aacdb4cab12 (diff)
[SPARC64]: Add hypervisor API negotiation and fix console bugs.
Hypervisor interfaces need to be negotiated in order to use some API calls reliably. So add a small set of interfaces to request API versions and query current settings. This allows us to fix some bugs in the hypervisor console: 1) If we can negotiate API group CORE of at least major 1 minor 1 we can use con_read and con_write which can improve console performance quite a bit. 2) When we do a console write request, we should hold the spinlock around the whole request, not a byte at a time. What would happen is that it's easy for output from different cpus to get mixed with each other. 3) Use consistent udelay() based polling, udelay(1) each loop with a limit of 1000 polls to handle stuck hypervisor console. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/asm-sparc64/hypervisor.h83
1 files changed, 82 insertions, 1 deletions
diff --git a/include/asm-sparc64/hypervisor.h b/include/asm-sparc64/hypervisor.h
index 612bf319753f..a5558c87556d 100644
--- a/include/asm-sparc64/hypervisor.h
+++ b/include/asm-sparc64/hypervisor.h
@@ -940,6 +940,54 @@ struct hv_fault_status {
940 */ 940 */
941#define HV_FAST_CONS_PUTCHAR 0x61 941#define HV_FAST_CONS_PUTCHAR 0x61
942 942
943/* con_read()
944 * TRAP: HV_FAST_TRAP
945 * FUNCTION: HV_FAST_CONS_READ
946 * ARG0: buffer real address
947 * ARG1: buffer size in bytes
948 * RET0: status
949 * RET1: bytes read or BREAK or HUP
950 * ERRORS: EWOULDBLOCK No character available.
951 *
952 * Reads characters into a buffer from the console device. If no
953 * character is available then an EWOULDBLOCK error is returned.
954 * If a character is available, then the returned status is EOK
955 * and the number of bytes read into the given buffer is provided
956 * in RET1.
957 *
958 * A virtual BREAK is represented by the 64-bit RET1 value -1.
959 *
960 * A virtual HUP signal is represented by the 64-bit RET1 value -2.
961 *
962 * If BREAK or HUP are indicated, no bytes were read into buffer.
963 */
964#define HV_FAST_CONS_READ 0x62
965
966/* con_write()
967 * TRAP: HV_FAST_TRAP
968 * FUNCTION: HV_FAST_CONS_WRITE
969 * ARG0: buffer real address
970 * ARG1: buffer size in bytes
971 * RET0: status
972 * RET1: bytes written
973 * ERRORS: EWOULDBLOCK Output buffer currently full, would block
974 *
975 * Send a characters in buffer to the console device. Breaks must be
976 * sent using con_putchar().
977 */
978#define HV_FAST_CONS_WRITE 0x63
979
980#ifndef __ASSEMBLY__
981extern long sun4v_con_getchar(long *status);
982extern long sun4v_con_putchar(long c);
983extern long sun4v_con_read(unsigned long buffer,
984 unsigned long size,
985 unsigned long *bytes_read);
986extern unsigned long sun4v_con_write(unsigned long buffer,
987 unsigned long size,
988 unsigned long *bytes_written);
989#endif
990
943/* Trap trace services. 991/* Trap trace services.
944 * 992 *
945 * The hypervisor provides a trap tracing capability for privileged 993 * The hypervisor provides a trap tracing capability for privileged
@@ -2121,8 +2169,41 @@ struct hv_mmu_statistics {
2121#define HV_FAST_MMUSTAT_INFO 0x103 2169#define HV_FAST_MMUSTAT_INFO 0x103
2122 2170
2123/* Function numbers for HV_CORE_TRAP. */ 2171/* Function numbers for HV_CORE_TRAP. */
2124#define HV_CORE_VER 0x00 2172#define HV_CORE_SET_VER 0x00
2125#define HV_CORE_PUTCHAR 0x01 2173#define HV_CORE_PUTCHAR 0x01
2126#define HV_CORE_EXIT 0x02 2174#define HV_CORE_EXIT 0x02
2175#define HV_CORE_GET_VER 0x03
2176
2177/* Hypervisor API groups for use with HV_CORE_SET_VER and
2178 * HV_CORE_GET_VER.
2179 */
2180#define HV_GRP_SUN4V 0x0000
2181#define HV_GRP_CORE 0x0001
2182#define HV_GRP_INTR 0x0002
2183#define HV_GRP_SOFT_STATE 0x0003
2184#define HV_GRP_PCI 0x0100
2185#define HV_GRP_LDOM 0x0101
2186#define HV_GRP_SVC_CHAN 0x0102
2187#define HV_GRP_NCS 0x0103
2188#define HV_GRP_NIAG_PERF 0x0200
2189#define HV_GRP_FIRE_PERF 0x0201
2190#define HV_GRP_DIAG 0x0300
2191
2192#ifndef __ASSEMBLY__
2193extern unsigned long sun4v_get_version(unsigned long group,
2194 unsigned long *major,
2195 unsigned long *minor);
2196extern unsigned long sun4v_set_version(unsigned long group,
2197 unsigned long major,
2198 unsigned long minor,
2199 unsigned long *actual_minor);
2200
2201extern int sun4v_hvapi_register(unsigned long group, unsigned long major,
2202 unsigned long *minor);
2203extern void sun4v_hvapi_unregister(unsigned long group);
2204extern int sun4v_hvapi_get(unsigned long group,
2205 unsigned long *major,
2206 unsigned long *minor);
2207#endif
2127 2208
2128#endif /* !(_SPARC64_HYPERVISOR_H) */ 2209#endif /* !(_SPARC64_HYPERVISOR_H) */