apix.h revision 7ff178cd8db129d385d3177eb20744d3b6efc59b
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#ifndef __SYS_APIX_APIX_H
#define __SYS_APIX_APIX_H
#include <sys/traptrace.h>
#include <sys/apic_common.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef DEBUG
#ifndef TRAPTRACE
#define TRAPTRACE
#endif
#endif
#define APIX_NAME "apix"
#define APIX_INVALID_VECT 0 /* invalid vector */
/* vector type */
#define APIX_TYPE_IPI 8
/* vector states */
enum {
APIX_STATE_FREED = 0,
APIX_STATE_OBSOLETED, /* 1 */
APIX_STATE_ALLOCED, /* 2 */
APIX_STATE_ENABLED, /* 3 */
APIX_STATE_DISABLED /* 4 */
};
#define IS_VECT_FREE(p) \
#define IS_VECT_OBSOL(p) \
#define IS_VECT_ENABLED(p) \
/* flags */
#define APIX_VECT_USER_BOUND 0x1
#define APIX_VECT_MASKABLE 0x2
/*
* Number of interrupt vectors reserved by software on each LOCAL APIC:
* 1. Dtrace
* 2. int80
* 3. system-call
* 4. fast-trap
* 5. apix-reserved
*/
#define APIX_SW_RESERVED_VECTORS 5
/*
* Macros to help deal with shared interrupts and to differentiate
* between vector and irq number when passing arguments to interfaces
* xxx_avintr()
*/
#define APIX_VIRTVEC_VECMASK 0xff
#define APIX_VIRTVEC_FLAG 0x80000000
#define APIX_VIRTVECTOR(cpuid, v) \
#define APIX_IS_VIRTVEC(vv) \
((vv) & APIX_VIRTVEC_FLAG)
#define APIX_VIRTVEC_VECTOR(vv) \
#define APIX_VIRTVEC_CPU(vv) \
struct apix_dev_vector;
typedef struct apix_vector {
int v_inum; /* irq for fixed, inum for msi/x */
/* find us in this */
void *v_intrmap_private; /* intr remap data */
typedef struct apix_impl {
/* pointer to head of interrupt pending list */
/* pointer to tail of interrupt pending list */
} apix_impl_t;
#define HILEVEL_PENDING(cpu) \
#define LOWLEVEL_PENDING(cpu) \
#define IS_HILEVEL_RUNNING(cpu) \
#define IS_LOWLEVEL_RUNNING(cpu) \
((ipl) <= LOCK_LEVEL ? \
/*
* We need a way to find allocated vector for a device. One option
* is to maintain a mapping table in pcplusmp. Another option would
* be to record vector or irq with interrupt handler hdlp->ih_vector or
* hdlp->ih_irq.
* Second option requires interface changes, such as, a new interface
* for noticing vector changes caused by interrupt re-targeting.
* Currently we choose the first option cause it doesn't require
* new interfaces.
*/
typedef struct apix_dev_vector {
int dv_inum; /* interrupt number */
int dv_type; /* interrupt type */
extern apix_impl_t *apixs[];
extern int apix_nipis;
extern int apix_cpu_nvectors;
extern apix_dev_vector_t **apix_dev_vector;
extern processorid_t *apix_major_to_cpu;
extern kmutex_t apix_mutex;
#define APIX_IPI_MAX APIC_MAX_VECTOR
#define APIX_AVINTR_MIN 0x20
#define APIX_NAVINTR \
#define APIX_AVINTR_MAX \
((APIX_NAVINTR <= 0) ? 0 : \
(APIX_IPI_MIN - 2) : \
#define IS_VALID_AVINTR(v) \
((v) >= APIX_AVINTR_MIN && (v) <= APIX_AVINTR_MAX)
/* Get dip for msi/x */
#define APIX_GET_DIP(v) \
/*
* For irq
*/
#define IS_IRQ_FREE(p) \
/*
* From mp_platform_common.c
*/
extern int apic_intr_policy;
extern iflag_t apic_sci_flags;
extern int apic_hpet_vect;
extern iflag_t apic_hpet_flags;
extern int apic_redist_cpu_skip;
extern int apic_num_imbalance;
extern int apic_num_rebind;
extern struct apic_io_intr *apic_io_intrp;
extern int apic_use_acpi_madt_only;
extern uint32_t eisa_level_intr_mask;
extern int apic_pci_bus_total;
extern uchar_t apic_single_pci_busid;
extern ACPI_MADT_INTERRUPT_OVERRIDE *acpi_isop;
extern int acpi_iso_cnt;
extern int apic_defconf;
extern int apic_irq_translate;
extern int apic_max_reps_clear_pending;
extern int apic_probe_common(char *modname);
extern int apic_find_bus_id(int bustype);
/*
* From apic_regops.c
*/
extern int apic_have_32bit_cr8;
/*
*/
/*
*/
typedef struct apix_rebind_info {
int i_go; /* if rebinding op is in progress */
extern struct apix_rebind_info apix_rebindinfo;
}
#define APIX_CLR_REBIND_INFO() \
apix_rebindinfo.i_go = 0
#define APIX_IS_FAKE_INTR(_vector)\
if (APIX_IS_FAKE_INTR(_vector)) {\
tp->av_prilevel);\
}\
}
int virt_vect);
int count);
extern void ioapix_init_intr(int mask_apic);
/*
* apix.c
*/
extern void apix_intx_enable(int irqno);
extern void apix_intx_disable(int irqno);
extern void apix_intx_free(int irqno);
int *result);
int *result);
extern void apix_level_intr_pre_eoi(int irq);
extern void apix_level_intr_post_dispatch(int irq);
#ifdef __cplusplus
}
#endif
#endif /* __SYS_APIX_APIX_H */