162306a36Sopenharmony_ci/* SPDX-License-Identifier: MIT */
262306a36Sopenharmony_ci/******************************************************************************
362306a36Sopenharmony_ci * nmi.h
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * NMI callback registration and reason codes.
662306a36Sopenharmony_ci *
762306a36Sopenharmony_ci * Copyright (c) 2005, Keir Fraser <keir@xensource.com>
862306a36Sopenharmony_ci */
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci#ifndef __XEN_PUBLIC_NMI_H__
1162306a36Sopenharmony_ci#define __XEN_PUBLIC_NMI_H__
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci#include <xen/interface/xen.h>
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci/*
1662306a36Sopenharmony_ci * NMI reason codes:
1762306a36Sopenharmony_ci * Currently these are x86-specific, stored in arch_shared_info.nmi_reason.
1862306a36Sopenharmony_ci */
1962306a36Sopenharmony_ci /* I/O-check error reported via ISA port 0x61, bit 6. */
2062306a36Sopenharmony_ci#define _XEN_NMIREASON_io_error     0
2162306a36Sopenharmony_ci#define XEN_NMIREASON_io_error      (1UL << _XEN_NMIREASON_io_error)
2262306a36Sopenharmony_ci /* PCI SERR reported via ISA port 0x61, bit 7. */
2362306a36Sopenharmony_ci#define _XEN_NMIREASON_pci_serr     1
2462306a36Sopenharmony_ci#define XEN_NMIREASON_pci_serr      (1UL << _XEN_NMIREASON_pci_serr)
2562306a36Sopenharmony_ci /* Unknown hardware-generated NMI. */
2662306a36Sopenharmony_ci#define _XEN_NMIREASON_unknown      2
2762306a36Sopenharmony_ci#define XEN_NMIREASON_unknown       (1UL << _XEN_NMIREASON_unknown)
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci/*
3062306a36Sopenharmony_ci * long nmi_op(unsigned int cmd, void *arg)
3162306a36Sopenharmony_ci * NB. All ops return zero on success, else a negative error code.
3262306a36Sopenharmony_ci */
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci/*
3562306a36Sopenharmony_ci * Register NMI callback for this (calling) VCPU. Currently this only makes
3662306a36Sopenharmony_ci * sense for domain 0, vcpu 0. All other callers will be returned EINVAL.
3762306a36Sopenharmony_ci * arg == pointer to xennmi_callback structure.
3862306a36Sopenharmony_ci */
3962306a36Sopenharmony_ci#define XENNMI_register_callback   0
4062306a36Sopenharmony_cistruct xennmi_callback {
4162306a36Sopenharmony_ci    unsigned long handler_address;
4262306a36Sopenharmony_ci    unsigned long pad;
4362306a36Sopenharmony_ci};
4462306a36Sopenharmony_ciDEFINE_GUEST_HANDLE_STRUCT(xennmi_callback);
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ci/*
4762306a36Sopenharmony_ci * Deregister NMI callback for this (calling) VCPU.
4862306a36Sopenharmony_ci * arg == NULL.
4962306a36Sopenharmony_ci */
5062306a36Sopenharmony_ci#define XENNMI_unregister_callback 1
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci#endif /* __XEN_PUBLIC_NMI_H__ */
53