#ifndef _SYS_PSM_TYPES_H
#define _SYS_PSM_TYPES_H
#include <sys/types.h>
#include <sys/cpuvar.h>
#include <sys/time.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef enum psm_intr_op_e {
PSM_INTR_OP_ALLOC_VECTORS = 0,
PSM_INTR_OP_FREE_VECTORS,
PSM_INTR_OP_NAVAIL_VECTORS,
PSM_INTR_OP_XLATE_VECTOR,
PSM_INTR_OP_GET_PENDING,
PSM_INTR_OP_CLEAR_MASK,
PSM_INTR_OP_SET_MASK,
PSM_INTR_OP_GET_CAP,
PSM_INTR_OP_SET_CAP,
PSM_INTR_OP_SET_PRI,
PSM_INTR_OP_GET_SHARED,
PSM_INTR_OP_CHECK_MSI,
PSM_INTR_OP_SET_CPU,
PSM_INTR_OP_GET_INTR,
PSM_INTR_OP_GRP_SET_CPU,
PSM_INTR_OP_APIC_TYPE
} psm_intr_op_t;
typedef enum psm_state_op_e {
PSM_STATE_ALLOC = 1,
PSM_STATE_FREE,
PSM_STATE_SAVE,
PSM_STATE_RESTORE
} psm_state_op_t;
typedef struct psm_state_req {
psm_state_op_t psr_cmd;
union psm_req {
struct {
void *psr_state;
size_t psr_state_size;
} psm_state_req;
} req;
} psm_state_request_t;
typedef enum psm_cpu_op_e {
PSM_CPU_ADD = 1,
PSM_CPU_REMOVE,
PSM_CPU_STOP
} psm_cpu_op_t;
typedef struct psm_cpu_request {
psm_cpu_op_t pcr_cmd;
union {
struct {
processorid_t cpuid;
void *argp;
} cpu_add;
struct {
processorid_t cpuid;
} cpu_remove;
struct {
processorid_t cpuid;
void *ctx;
} cpu_stop;
} req;
} psm_cpu_request_t;
struct psm_ops {
int (*psm_probe)(void);
void (*psm_softinit)(void);
void (*psm_picinit)(void);
int (*psm_intr_enter)(int ipl, int *vectorp);
void (*psm_intr_exit)(int ipl, int irqno);
void (*psm_setspl)(int ipl);
int (*psm_addspl)(int irqno, int ipl, int min_ipl, int max_ipl);
int (*psm_delspl)(int irqno, int ipl, int min_ipl, int max_ipl);
int (*psm_disable_intr)(processorid_t cpun);
void (*psm_enable_intr)(processorid_t cpun);
int (*psm_softlvl_to_irq)(int ipl);
void (*psm_set_softintr)(int ipl);
void (*psm_set_idlecpu)(processorid_t cpun);
void (*psm_unset_idlecpu)(processorid_t cpun);
#if defined(PSMI_1_3) || defined(PSMI_1_4) || defined(PSMI_1_5) || \
defined(PSMI_1_6) || defined(PSMI_1_7)
int (*psm_clkinit)(int hertz);
#else
void (*psm_clkinit)(int hertz);
#endif
int (*psm_get_clockirq)(int ipl);
void (*psm_hrtimeinit)(void);
hrtime_t (*psm_gethrtime)(void);
processorid_t (*psm_get_next_processorid)(processorid_t cpu_id);
#if defined(PSMI_1_5) || defined(PSMI_1_6) || defined(PSMI_1_7)
int (*psm_cpu_start)(processorid_t cpun, caddr_t ctxt);
#else
void (*psm_cpu_start)(processorid_t cpun, caddr_t rm_code);
#endif
int (*psm_post_cpu_start)(void);
#if defined(PSMI_1_2) || defined(PSMI_1_3) || defined(PSMI_1_4) || \
defined(PSMI_1_5) || defined(PSMI_1_6) || defined(PSMI_1_7)
void (*psm_shutdown)(int cmd, int fcn);
#else
void (*psm_shutdown)(void);
#endif
int (*psm_get_ipivect)(int ipl, int type);
void (*psm_send_ipi)(processorid_t cpun, int ipl);
int (*psm_translate_irq)(dev_info_t *dip, int irqno);
#if defined(PSMI_1_2) || defined(PSMI_1_3) || defined(PSMI_1_4)
int (*psm_tod_get)(todinfo_t *tod);
int (*psm_tod_set)(todinfo_t *tod);
#endif
void (*psm_notify_error)(int level, char *errmsg);
#if defined(PSMI_1_2) || defined(PSMI_1_3) || defined(PSMI_1_4) || \
defined(PSMI_1_5) || defined(PSMI_1_6) || defined(PSMI_1_7)
void (*psm_notify_func)(int msg);
#endif
#if defined(PSMI_1_3) || defined(PSMI_1_4) || defined(PSMI_1_5) || \
defined(PSMI_1_6) || defined(PSMI_1_7)
void (*psm_timer_reprogram)(hrtime_t time);
void (*psm_timer_enable)(void);
void (*psm_timer_disable)(void);
void (*psm_post_cyclic_setup)(void *arg);
#endif
#if defined(PSMI_1_4) || defined(PSMI_1_5) || defined(PSMI_1_6) || \
defined(PSMI_1_7)
void (*psm_preshutdown)(int cmd, int fcn);
#endif
#if defined(PSMI_1_5) || defined(PSMI_1_6) || defined(PSMI_1_7)
int (*psm_intr_ops)(dev_info_t *dip, ddi_intr_handle_impl_t *handle,
psm_intr_op_t op, int *result);
#endif
#if defined(PSMI_1_6) || defined(PSMI_1_7)
int (*psm_state)(psm_state_request_t *request);
#endif
#if defined(PSMI_1_7)
int (*psm_cpu_ops)(psm_cpu_request_t *reqp);
int (*psm_get_pir_ipivect)(void);
void (*psm_send_pir_ipi)(processorid_t cpu);
void (*psm_cmci_setup)(processorid_t cpu, boolean_t);
#endif
};
struct psm_info {
ushort_t p_version;
ushort_t p_owner;
struct psm_ops *p_ops;
char *p_mach_idstring;
char *p_mach_desc;
};
#define PSM_INFO_VER01 0x8601
#define PSM_INFO_VER01_1 0x8602
#define PSM_INFO_VER01_2 0x8603
#define PSM_INFO_VER01_3 0x8604
#define PSM_INFO_VER01_4 0x8605
#define PSM_INFO_VER01_5 0x8606
#define PSM_INFO_VER01_6 0x8607
#define PSM_INFO_VER01_7 0x8608
#define PSM_INFO_VER01_X (PSM_INFO_VER01_1 & 0xFFF0)
#define PSM_OWN_SYS_DEFAULT 0x0001
#define PSM_OWN_EXCLUSIVE 0x0002
#define PSM_OWN_OVERRIDE 0x0003
#define PSM_NULL_INFO -1
#define PSM_DEBUG_ENTER 1
#define PSM_DEBUG_EXIT 2
#define PSM_PANIC_ENTER 3
#define PSM_SV_SOFTWARE -1
#define PSM_SV_MIXED -2
#define PSM_INTR_IPI_HI 0x01
#define PSM_INTR_IPI_LO 0x02
#define PSM_INTR_POKE 0x03
#define PSMGI_CPU_USER_BOUND 0x80000000
#define PSMGI_CPU_FLAGS 0x80000000
#define PSM_SUCCESS DDI_SUCCESS
#define PSM_FAILURE DDI_FAILURE
#define PSM_INVALID_IPL 0
#define PSM_INVALID_CPU -1
struct psm_ops_ver01 {
int (*psm_probe)(void);
void (*psm_softinit)(void);
void (*psm_picinit)(void);
int (*psm_intr_enter)(int ipl, int *vectorp);
void (*psm_intr_exit)(int ipl, int irqno);
void (*psm_setspl)(int ipl);
int (*psm_addspl)(int irqno, int ipl, int min_ipl, int max_ipl);
int (*psm_delspl)(int irqno, int ipl, int min_ipl, int max_ipl);
int (*psm_disable_intr)(processorid_t cpun);
void (*psm_enable_intr)(processorid_t cpun);
int (*psm_softlvl_to_irq)(int ipl);
void (*psm_set_softintr)(int ipl);
void (*psm_set_idlecpu)(processorid_t cpun);
void (*psm_unset_idlecpu)(processorid_t cpun);
void (*psm_clkinit)(int hertz);
int (*psm_get_clockirq)(int ipl);
void (*psm_hrtimeinit)(void);
hrtime_t (*psm_gethrtime)(void);
processorid_t (*psm_get_next_processorid)(processorid_t cpu_id);
void (*psm_cpu_start)(processorid_t cpun, caddr_t rm_code);
int (*psm_post_cpu_start)(void);
void (*psm_shutdown)(void);
int (*psm_get_ipivect)(int ipl, int type);
void (*psm_send_ipi)(processorid_t cpun, int ipl);
};
#ifdef __cplusplus
}
#endif
#endif