1/** 2 * \file 3 */ 4 5/* 6 * Copyright (c) 2009, ETH Zurich. 7 * All rights reserved. 8 * 9 * This file is distributed under the terms in the attached LICENSE file. 10 * If you do not find this file, copies can be found by writing to: 11 * ETH Zurich D-INFK, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group. 12 */ 13 14#ifndef APIC_H 15#define APIC_H 16 17#include <stdint.h> 18 19// Source material from AMD64 Manual, System Programming, Chapter 16: APIC 20 21struct apic { 22 uint64_t mmio_base_va; 23 24 // registers 25 uint32_t spurious_intr_vec_reg; 26 uint32_t lvt_timer_reg; 27 uint32_t err_stat_reg; 28 uint32_t lvt_thermal_monitor_reg; 29 uint32_t lvt_perf_counter_reg; 30 uint32_t lvt_lint0_reg; 31 uint32_t lvt_lint1_reg; 32 uint32_t lvt_err_reg; 33}; 34 35struct apic * apic_new (uint64_t mmio_base_va); 36int apic_handle_mmio_read (struct apic *a, uint64_t addr, enum opsize size, 37 uint64_t *val); 38int apic_handle_mmio_write (struct apic *a, uint64_t addr, enum opsize size, 39 uint64_t val); 40void apic_assert_irq (struct apic *a, uint8_t irq); 41void apic_assert_pic_irq (struct apic *a, uint8_t irq); 42 43#endif // APIC_H 44