#ifndef _DDIFM_H
#define _DDIFM_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/dditypes.h>
#include <sys/va_list.h>
extern int ddi_system_fmcap;
#define DDI_FM_OK 0
#define DDI_FM_FATAL -1
#define DDI_FM_NONFATAL -2
#define DDI_FM_UNKNOWN -3
#define DDI_FM_NOT_CAPABLE 0x00000000
#define DDI_FM_EREPORT_CAPABLE 0x00000001
#define DDI_FM_ACCCHK_CAPABLE 0x00000002
#define DDI_FM_DMACHK_CAPABLE 0x00000004
#define DDI_FM_ERRCB_CAPABLE 0x00000008
#define DDI_FM_DEFAULT_CAP(cap) (cap == DDI_FM_NOT_CAPABLE)
#define DDI_FM_EREPORT_CAP(cap) (cap & DDI_FM_EREPORT_CAPABLE)
#define DDI_FM_ACC_ERR_CAP(cap) (cap & DDI_FM_ACCCHK_CAPABLE)
#define DDI_FM_DMA_ERR_CAP(cap) (cap & DDI_FM_DMACHK_CAPABLE)
#define DDI_FM_ERRCB_CAP(cap) (cap & DDI_FM_ERRCB_CAPABLE)
#define DDI_FM_ERR_UNEXPECTED 0
#define DDI_FM_ERR_EXPECTED 1
#define DDI_FM_ERR_POKE 2
#define DDI_FM_ERR_PEEK 3
#ifdef _KERNEL
typedef struct ddi_fm_error {
int fme_version;
int fme_status;
int fme_flag;
uint64_t fme_ena;
ddi_acc_handle_t fme_acc_handle;
ddi_dma_handle_t fme_dma_handle;
void *fme_bus_specific;
int fme_bus_type;
} ddi_fm_error_t;
#define DDI_FME_VER0 0
#define DDI_FME_VER1 1
#define DDI_FME_VERSION DDI_FME_VER1
#define DDI_FME_BUS_TYPE_DFLT 0
#define DDI_FME_BUS_TYPE_PCI 1
typedef int (*ddi_err_func_t)(dev_info_t *, ddi_fm_error_t *, const void *);
extern void ddi_fm_ereport_post(dev_info_t *, const char *, uint64_t, int, ...);
extern void ndi_fm_ereport_post(dev_info_t *, const char *, uint64_t, int, ...);
extern void ddi_fm_service_impact(dev_info_t *, int);
extern void ddi_fm_handler_register(dev_info_t *, ddi_err_func_t, void *);
extern void ddi_fm_handler_unregister(dev_info_t *);
extern void ddi_fm_init(dev_info_t *, int *, ddi_iblock_cookie_t *);
extern void ddi_fm_fini(dev_info_t *);
extern int ddi_fm_capable(dev_info_t *dip);
extern void ddi_fm_dma_err_get(ddi_dma_handle_t, ddi_fm_error_t *, int);
extern void ddi_fm_acc_err_get(ddi_acc_handle_t, ddi_fm_error_t *, int);
extern void ddi_fm_dma_err_clear(ddi_dma_handle_t, int);
extern void ddi_fm_acc_err_clear(ddi_acc_handle_t, int);
#endif
#ifdef __cplusplus
}
#endif
#endif