1181624Skmacy/******************************************************************************
2181624Skmacy * nmi.h
3181624Skmacy *
4181624Skmacy * NMI callback registration and reason codes.
5181624Skmacy *
6181624Skmacy * Permission is hereby granted, free of charge, to any person obtaining a copy
7181624Skmacy * of this software and associated documentation files (the "Software"), to
8181624Skmacy * deal in the Software without restriction, including without limitation the
9181624Skmacy * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10181624Skmacy * sell copies of the Software, and to permit persons to whom the Software is
11181624Skmacy * furnished to do so, subject to the following conditions:
12181624Skmacy *
13181624Skmacy * The above copyright notice and this permission notice shall be included in
14181624Skmacy * all copies or substantial portions of the Software.
15181624Skmacy *
16181624Skmacy * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17181624Skmacy * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18181624Skmacy * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19181624Skmacy * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20181624Skmacy * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21181624Skmacy * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22181624Skmacy * DEALINGS IN THE SOFTWARE.
23181624Skmacy *
24181624Skmacy * Copyright (c) 2005, Keir Fraser <keir@xensource.com>
25181624Skmacy */
26181624Skmacy
27181624Skmacy#ifndef __XEN_PUBLIC_NMI_H__
28181624Skmacy#define __XEN_PUBLIC_NMI_H__
29181624Skmacy
30251767Sgibbs#include "xen.h"
31251767Sgibbs
32181624Skmacy/*
33181624Skmacy * NMI reason codes:
34181624Skmacy * Currently these are x86-specific, stored in arch_shared_info.nmi_reason.
35181624Skmacy */
36181624Skmacy /* I/O-check error reported via ISA port 0x61, bit 6. */
37181624Skmacy#define _XEN_NMIREASON_io_error     0
38181624Skmacy#define XEN_NMIREASON_io_error      (1UL << _XEN_NMIREASON_io_error)
39288917Sroyger /* PCI SERR reported via ISA port 0x61, bit 7. */
40288917Sroyger#define _XEN_NMIREASON_pci_serr     1
41288917Sroyger#define XEN_NMIREASON_pci_serr      (1UL << _XEN_NMIREASON_pci_serr)
42288917Sroyger#if __XEN_INTERFACE_VERSION__ < 0x00040300 /* legacy alias of the above */
43181624Skmacy /* Parity error reported via ISA port 0x61, bit 7. */
44181624Skmacy#define _XEN_NMIREASON_parity_error 1
45181624Skmacy#define XEN_NMIREASON_parity_error  (1UL << _XEN_NMIREASON_parity_error)
46288917Sroyger#endif
47181624Skmacy /* Unknown hardware-generated NMI. */
48181624Skmacy#define _XEN_NMIREASON_unknown      2
49181624Skmacy#define XEN_NMIREASON_unknown       (1UL << _XEN_NMIREASON_unknown)
50181624Skmacy
51181624Skmacy/*
52181624Skmacy * long nmi_op(unsigned int cmd, void *arg)
53181624Skmacy * NB. All ops return zero on success, else a negative error code.
54181624Skmacy */
55181624Skmacy
56181624Skmacy/*
57181624Skmacy * Register NMI callback for this (calling) VCPU. Currently this only makes
58181624Skmacy * sense for domain 0, vcpu 0. All other callers will be returned EINVAL.
59181624Skmacy * arg == pointer to xennmi_callback structure.
60181624Skmacy */
61181624Skmacy#define XENNMI_register_callback   0
62181624Skmacystruct xennmi_callback {
63181624Skmacy    unsigned long handler_address;
64181624Skmacy    unsigned long pad;
65181624Skmacy};
66181624Skmacytypedef struct xennmi_callback xennmi_callback_t;
67181624SkmacyDEFINE_XEN_GUEST_HANDLE(xennmi_callback_t);
68181624Skmacy
69181624Skmacy/*
70181624Skmacy * Deregister NMI callback for this (calling) VCPU.
71181624Skmacy * arg == NULL.
72181624Skmacy */
73181624Skmacy#define XENNMI_unregister_callback 1
74181624Skmacy
75181624Skmacy#endif /* __XEN_PUBLIC_NMI_H__ */
76181624Skmacy
77181624Skmacy/*
78181624Skmacy * Local variables:
79181624Skmacy * mode: C
80288917Sroyger * c-file-style: "BSD"
81181624Skmacy * c-basic-offset: 4
82181624Skmacy * tab-width: 4
83181624Skmacy * indent-tabs-mode: nil
84181624Skmacy * End:
85181624Skmacy */
86