apic_bus arinc429_bus
API Reference Manual  /  4 Model-to-Model Interfaces  / 

apic_cpu

Description
This interface is implemented by the local APIC device and is used by the processor and machine initialization code to interact with the local APIC.

The tpr_r and tpr_w methods read and write the task priority register. The format of the tpr argument and the returned value from tpr_r is the same as for CR8, meaning TPR[bits 7:4], zero extended to 64 bits.

Interrupts coming from the CPU itself are passed via the local_int function. The type of interrupt is one of the constants defined in local_apic_interrupt_t.

typedef enum {
        Apic_Lvt_2e = 0x2e0,
        Apic_CMCI = 0x2f0,
        Apic_Performance_Counter = 0x340,
        Apic_Thermal_Sensor = 0x330
} local_apic_interrupt_t;

The init function is called by the CPU when it receives the INIT signal. The APIC should only update its internal state and not propagate this signal further. Both the CPU and the APIC should reset their pending interrupt flags when this function is called. The init function is not called at instantiation time.

The power_on function is called at machine creation time, and the call initializes the APIC to the power on state. The bsp argument is true if the APIC is connected to the boot processor, and false otherwise. The initial APIC ID is set through the apic_id argument. The power_on function would typically be called from component code for the processor that includes the APIC.

The enabled_r method returns bit 11 from the APIC BASE MSR, and is used by the processor to return the correct status for CPUID.

SIM_INTERFACE(apic_cpu) {
        uint64 (*tpr_r)(conf_object_t *NOTNULL obj);
        void (*tpr_w)(conf_object_t *NOTNULL obj, uint64 tpr);
        void (*local_int)(conf_object_t *NOTNULL obj,
                          local_apic_interrupt_t int_type);
        void (*power_on)(conf_object_t *NOTNULL obj, bool bsp, int apic_id);
        void (*init)(conf_object_t *NOTNULL obj);
        bool (*enabled_r)(conf_object_t *NOTNULL obj);
};

#define APIC_CPU_INTERFACE "apic_cpu"

Execution Context
Cell Context for all methods.

apic_bus arinc429_bus