]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/i386/lapic.h
xnu-4570.51.1.tar.gz
[apple/xnu.git] / osfmk / i386 / lapic.h
index 655864230384b4eb609158226009919edbf86840..ca9db2dbfb8919d035908db29d04d8b9c5c8e284 100644 (file)
@@ -174,15 +174,20 @@ typedef enum {
 #define        LAPIC_MSR(reg)          (LAPIC_MSR_BASE + LAPIC_MSR_OFFSET(reg))
 
 typedef struct {
-       void            (*init) (void);
-       uint32_t        (*read) (lapic_register_t);
-       void            (*write)(lapic_register_t, uint32_t);
+       void            (*init)         (void);
+       uint32_t        (*read)         (lapic_register_t);
+       void            (*write)        (lapic_register_t, uint32_t);
+       uint64_t        (*read_icr)     (void);
+       void            (*write_icr)    (uint32_t, uint32_t);
 } lapic_ops_table_t;
 extern  lapic_ops_table_t *lapic_ops;
 
+#define LAPIC_INIT()                   lapic_ops->init();
 #define LAPIC_WRITE(reg,val)           lapic_ops->write(reg, val)
 #define LAPIC_READ(reg)                        lapic_ops->read(reg)
 #define LAPIC_READ_OFFSET(reg,off)     LAPIC_READ((reg)+(off))
+#define LAPIC_READ_ICR()               lapic_ops->read_icr()
+#define LAPIC_WRITE_ICR(dst,cmd)       lapic_ops->write_icr(dst, cmd)
 
 typedef enum {
        periodic,
@@ -215,16 +220,18 @@ typedef uint32_t lapic_timer_count_t;
  */
 
 #define LAPIC_PERFCNT_INTERRUPT                0xF
-#define LAPIC_TIMER_INTERRUPT          0xE
-#define LAPIC_INTERPROCESSOR_INTERRUPT 0xD
+#define LAPIC_INTERPROCESSOR_INTERRUPT 0xE
+#define LAPIC_TIMER_INTERRUPT          0xD
 #define LAPIC_THERMAL_INTERRUPT                0xC
 #define LAPIC_ERROR_INTERRUPT          0xB
 #define LAPIC_SPURIOUS_INTERRUPT       0xA
 #define LAPIC_CMCI_INTERRUPT           0x9
 #define LAPIC_PMC_SW_INTERRUPT         0x8
 #define LAPIC_PM_INTERRUPT             0x7
+#define LAPIC_KICK_INTERRUPT           0x6
 
 #define LAPIC_PMC_SWI_VECTOR           (LAPIC_DEFAULT_INTERRUPT_BASE + LAPIC_PMC_SW_INTERRUPT)
+#define LAPIC_TIMER_VECTOR             (LAPIC_DEFAULT_INTERRUPT_BASE + LAPIC_TIMER_INTERRUPT)
 
 /* The vector field is ignored for NMI interrupts via the LAPIC
  * or otherwise, so this is not an offset from the interrupt
@@ -246,6 +253,7 @@ extern void         lapic_shutdown(void);
 extern void            lapic_smm_restore(void);
 extern boolean_t       lapic_probe(void);
 extern void            lapic_dump(void);
+extern void            lapic_cpu_map_dump(void);
 extern int             lapic_interrupt(
                                int interrupt, x86_saved_state_t *state);
 extern void            lapic_end_of_interrupt(void);
@@ -256,6 +264,7 @@ extern void         lapic_send_ipi(int cpu, int interupt);
 extern int             lapic_to_cpu[];
 extern int             cpu_to_lapic[];
 extern int             lapic_interrupt_base;
+extern void            lapic_cpu_map_init(void);
 extern void            lapic_cpu_map(int lapic, int cpu_num);
 extern uint32_t                ml_get_apicid(uint32_t cpu);
 extern uint32_t                ml_get_cpuid(uint32_t lapic_index);
@@ -293,6 +302,12 @@ static inline void lapic_set_timer_func(i386_intr_func_t func)
 {
        lapic_set_intr_func(LAPIC_VECTOR(TIMER), func);
 }
+/* We don't support dynamic adjustment of the LAPIC timer base vector here
+ * it's effectively incompletely supported elsewhere as well.
+ */
+static inline void     lapic_timer_swi(void) {
+       __asm__ __volatile__("int %0" :: "i"(LAPIC_DEFAULT_INTERRUPT_BASE + LAPIC_TIMER_INTERRUPT):"memory");
+}
 
 static inline void     lapic_set_thermal_func(i386_intr_func_t func)
 {
@@ -312,8 +327,10 @@ extern boolean_t   lapic_is_interrupting(uint8_t vector);
 extern void            lapic_interrupt_counts(uint64_t intrs[256]);
 extern void            lapic_disable_timer(void);
 
+extern uint8_t         lapic_get_cmci_vector(void);
+
+#define        MAX_LAPICIDS    (LAPIC_ID_MAX+1)
 #ifdef MP_DEBUG
-extern void            lapic_cpu_map_dump(void);
 #define LAPIC_CPU_MAP_DUMP()   lapic_cpu_map_dump()
 #define LAPIC_DUMP()           lapic_dump()
 #else