1*3a9fd824SRoger Pau Monné /****************************************************************************** 2*3a9fd824SRoger Pau Monné * nmi.h 3*3a9fd824SRoger Pau Monné * 4*3a9fd824SRoger Pau Monné * NMI callback registration and reason codes. 5*3a9fd824SRoger Pau Monné * 6*3a9fd824SRoger Pau Monné * Permission is hereby granted, free of charge, to any person obtaining a copy 7*3a9fd824SRoger Pau Monné * of this software and associated documentation files (the "Software"), to 8*3a9fd824SRoger Pau Monné * deal in the Software without restriction, including without limitation the 9*3a9fd824SRoger Pau Monné * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10*3a9fd824SRoger Pau Monné * sell copies of the Software, and to permit persons to whom the Software is 11*3a9fd824SRoger Pau Monné * furnished to do so, subject to the following conditions: 12*3a9fd824SRoger Pau Monné * 13*3a9fd824SRoger Pau Monné * The above copyright notice and this permission notice shall be included in 14*3a9fd824SRoger Pau Monné * all copies or substantial portions of the Software. 15*3a9fd824SRoger Pau Monné * 16*3a9fd824SRoger Pau Monné * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17*3a9fd824SRoger Pau Monné * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18*3a9fd824SRoger Pau Monné * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19*3a9fd824SRoger Pau Monné * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20*3a9fd824SRoger Pau Monné * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21*3a9fd824SRoger Pau Monné * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22*3a9fd824SRoger Pau Monné * DEALINGS IN THE SOFTWARE. 23*3a9fd824SRoger Pau Monné * 24*3a9fd824SRoger Pau Monné * Copyright (c) 2005, Keir Fraser <keir@xensource.com> 25*3a9fd824SRoger Pau Monné */ 26*3a9fd824SRoger Pau Monné 27*3a9fd824SRoger Pau Monné #ifndef __XEN_PUBLIC_NMI_H__ 28*3a9fd824SRoger Pau Monné #define __XEN_PUBLIC_NMI_H__ 29*3a9fd824SRoger Pau Monné 30*3a9fd824SRoger Pau Monné #include "xen.h" 31*3a9fd824SRoger Pau Monné 32*3a9fd824SRoger Pau Monné /* 33*3a9fd824SRoger Pau Monné * NMI reason codes: 34*3a9fd824SRoger Pau Monné * Currently these are x86-specific, stored in arch_shared_info.nmi_reason. 35*3a9fd824SRoger Pau Monné */ 36*3a9fd824SRoger Pau Monné /* I/O-check error reported via ISA port 0x61, bit 6. */ 37*3a9fd824SRoger Pau Monné #define _XEN_NMIREASON_io_error 0 38*3a9fd824SRoger Pau Monné #define XEN_NMIREASON_io_error (1UL << _XEN_NMIREASON_io_error) 39*3a9fd824SRoger Pau Monné /* PCI SERR reported via ISA port 0x61, bit 7. */ 40*3a9fd824SRoger Pau Monné #define _XEN_NMIREASON_pci_serr 1 41*3a9fd824SRoger Pau Monné #define XEN_NMIREASON_pci_serr (1UL << _XEN_NMIREASON_pci_serr) 42*3a9fd824SRoger Pau Monné #if __XEN_INTERFACE_VERSION__ < 0x00040300 /* legacy alias of the above */ 43*3a9fd824SRoger Pau Monné /* Parity error reported via ISA port 0x61, bit 7. */ 44*3a9fd824SRoger Pau Monné #define _XEN_NMIREASON_parity_error 1 45*3a9fd824SRoger Pau Monné #define XEN_NMIREASON_parity_error (1UL << _XEN_NMIREASON_parity_error) 46*3a9fd824SRoger Pau Monné #endif 47*3a9fd824SRoger Pau Monné /* Unknown hardware-generated NMI. */ 48*3a9fd824SRoger Pau Monné #define _XEN_NMIREASON_unknown 2 49*3a9fd824SRoger Pau Monné #define XEN_NMIREASON_unknown (1UL << _XEN_NMIREASON_unknown) 50*3a9fd824SRoger Pau Monné 51*3a9fd824SRoger Pau Monné /* 52*3a9fd824SRoger Pau Monné * long nmi_op(unsigned int cmd, void *arg) 53*3a9fd824SRoger Pau Monné * NB. All ops return zero on success, else a negative error code. 54*3a9fd824SRoger Pau Monné */ 55*3a9fd824SRoger Pau Monné 56*3a9fd824SRoger Pau Monné /* 57*3a9fd824SRoger Pau Monné * Register NMI callback for this (calling) VCPU. Currently this only makes 58*3a9fd824SRoger Pau Monné * sense for domain 0, vcpu 0. All other callers will be returned EINVAL. 59*3a9fd824SRoger Pau Monné * arg == pointer to xennmi_callback structure. 60*3a9fd824SRoger Pau Monné */ 61*3a9fd824SRoger Pau Monné #define XENNMI_register_callback 0 62*3a9fd824SRoger Pau Monné struct xennmi_callback { 63*3a9fd824SRoger Pau Monné unsigned long handler_address; 64*3a9fd824SRoger Pau Monné unsigned long pad; 65*3a9fd824SRoger Pau Monné }; 66*3a9fd824SRoger Pau Monné typedef struct xennmi_callback xennmi_callback_t; 67*3a9fd824SRoger Pau Monné DEFINE_XEN_GUEST_HANDLE(xennmi_callback_t); 68*3a9fd824SRoger Pau Monné 69*3a9fd824SRoger Pau Monné /* 70*3a9fd824SRoger Pau Monné * Deregister NMI callback for this (calling) VCPU. 71*3a9fd824SRoger Pau Monné * arg == NULL. 72*3a9fd824SRoger Pau Monné */ 73*3a9fd824SRoger Pau Monné #define XENNMI_unregister_callback 1 74*3a9fd824SRoger Pau Monné 75*3a9fd824SRoger Pau Monné #endif /* __XEN_PUBLIC_NMI_H__ */ 76*3a9fd824SRoger Pau Monné 77*3a9fd824SRoger Pau Monné /* 78*3a9fd824SRoger Pau Monné * Local variables: 79*3a9fd824SRoger Pau Monné * mode: C 80*3a9fd824SRoger Pau Monné * c-file-style: "BSD" 81*3a9fd824SRoger Pau Monné * c-basic-offset: 4 82*3a9fd824SRoger Pau Monné * tab-width: 4 83*3a9fd824SRoger Pau Monné * indent-tabs-mode: nil 84*3a9fd824SRoger Pau Monné * End: 85*3a9fd824SRoger Pau Monné */ 86